dc: Parse error & fix out of bounds read in xc_program_printString
[oweals/busybox.git] / testsuite / cpio.tests
index 42e3ff8dc03444dec758e8bc411591d4e59c6cc1..88ec086b6c8a5017b1cee938664540be9f875693 100755 (executable)
@@ -1,9 +1,11 @@
 #!/bin/sh
 # Copyright 2008 by Denys Vlasenko
-# Licensed under GPL v2, see file LICENSE for details.
+# Licensed under GPLv2, see file LICENSE in this source tree.
 
 . ./testing.sh
 
+umask 022
+
 # ls -ln shows date. Need to remove that, it's variable.
 # sed: coalesce spaces
 # cut: remove date
@@ -97,14 +99,14 @@ usr
 " "" ""
 SKIP=
 
-# chown on a link was affecting file, dropping its sgid bits
+# chown on a link was affecting file, dropping its suid/sgid bits
 rm -rf cpio.testdir
-optional FEATURE_CPIO_O
+optional FEATURE_CPIO_O FEATURE_STAT_FORMAT
 mkdir cpio.testdir
 touch cpio.testdir/file
-chmod 6755 cpio.testdir/file  # set the suid/sgid bit
+chmod 6755 cpio.testdir/file  # sets suid/sgid bits
 ln -sf file cpio.testdir/link
-testing "cpio restores sgid bits" \
+testing "cpio restores suid/sgid bits" \
 "cd cpio.testdir && { echo file; echo link; } | cpio -ovHnewc >pack.cpio && rm ???? && cpio -idmvu <pack.cpio 2>/dev/null;
  stat -c '%a %n' file" \
 "\
@@ -114,6 +116,43 @@ link
 " "" ""
 SKIP=
 
+# avoid 'not created: newer or same age file exists' message for directories
+rm -rf cpio.testdir cpio.testdir2 2>/dev/null
+mkdir cpio.testdir
+testing "cpio extracts in existing directory" \
+"$ECHO -ne '$hexdump' | bzcat | cpio -id 2>&1; echo \$?" \
+"\
+1 blocks
+0
+" "" ""
+SKIP=
+
+optional FEATURE_CPIO_O
+testing "cpio uses by default uid/gid" \
+"echo $0 | cpio -o -H newc | cpio -tv 2>&1 | tail -n +2 | awk ' { print \$2 } '; echo \$?" \
+"\
+$user/$group
+0
+" "" ""
+SKIP=
+
+optional FEATURE_CPIO_O
+testing "cpio -R with create" \
+"echo $0 | cpio -o -H newc -R 1234:5678 | cpio -tv 2>&1 | tail -n +2 | awk ' { print \$2 } '; echo \$?" \
+"\
+1234/5678
+0
+" "" ""
+SKIP=
+
+optional FEATURE_CPIO_O
+testing "cpio -R with extract" \
+"echo $0 | cpio -o -H newc | cpio -tv -R 8765:4321 2>&1 | tail -n +2 | awk ' { print \$2 } '; echo \$?" \
+"\
+8765/4321
+0
+" "" ""
+SKIP=
 
 # Clean up
 rm -rf cpio.testdir cpio.testdir2 2>/dev/null