Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/testsuite


Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (9 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
11 added
1 deleted
24 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/testsuite/ar.tests

    r2725 r3621  
    1616       "" \
    1717       ""
    18 rm test.a
     18rm test.a 2>/dev/null
    1919
    2020testing "ar replaces things in archives" \
  • branches/3.3/mindi-busybox/testsuite/awk.tests

    r3232 r3621  
    2525
    2626# 4294967295 = 0xffffffff
    27 testing "awk bitwise op"  "awk '{ print or(4294967295,1) }'" "4.29497e+09\n" "" "\n"
     27testing "awk bitwise op"  "awk '{ print or(4294967295,1) }'" "4294967295\n" "" "\n"
     28
     29# we were testing for a non-empty body when deciding if a function was
     30# defined or not. The testcase below caused:
     31# awk: cmd. line:8: Call to undefined function
     32prg='
     33function empty_fun(count) {
     34  # empty
     35}
     36END {
     37  i=1
     38  print "L" i "\n"
     39  empty_fun(i + i + ++i)
     40  print "L" i "\n"
     41}'
     42testing "awk handles empty function f(arg){}" \
     43    "awk '$prg'" \
     44    "L1\n\nL2\n\n" \
     45    "" ""
     46
     47prg='
     48function outer_fun() {
     49  return 1
     50}
     51END {
     52  i=1
     53  print "L" i "\n"
     54  i += outer_fun()
     55  print "L" i "\n"
     56}'
     57testing "awk properly handles function from other scope" \
     58    "awk '$prg'" \
     59    "L1\n\nL2\n\n" \
     60    "" ""
     61
     62prg='
     63END {
     64  i=1
     65  print "L" i "\n"
     66  i + trigger_error_fun()
     67  print "L" i "\n"
     68}'
     69testing "awk properly handles undefined function" \
     70    "awk '$prg' 2>&1" \
     71    "L1\n\nawk: cmd. line:5: Call to undefined function\n" \
     72    "" ""
     73
     74
    2875optional DESKTOP
    29 testing "awk hex const 1" "awk '{ print or(0xffffffff,1) }'" "4.29497e+09\n" "" "\n"
    30 testing "awk hex const 2" "awk '{ print or(0x80000000,1) }'" "2.14748e+09\n" "" "\n"
     76testing "awk hex const 1" "awk '{ print or(0xffffffff,1) }'" "4294967295\n" "" "\n"
     77testing "awk hex const 2" "awk '{ print or(0x80000000,1) }'" "2147483649\n" "" "\n"
    3178testing "awk oct const"   "awk '{ print or(01234,1) }'"      "669\n"         "" "\n"
    3279SKIP=
     
    223270    "a:b c:d\ne:f g:h"
    224271
     272optional FEATURE_AWK_LIBM
     273testing "awk large integer" \
     274    "awk 'BEGIN{n=(2^31)-1; print n, int(n), n%1, ++n, int(n), n%1}'" \
     275    "2147483647 2147483647 0 2147483648 2147483648 0\n" \
     276    "" ""
     277SKIP=
     278
     279testing "awk length(array)" \
     280    "awk 'BEGIN{ A[1]=2; A[\"qwe\"]=\"asd\"; print length(A)}'" \
     281    "2\n" \
     282    "" ""
     283
     284testing "awk length()" \
     285    "awk '{print length; print length(); print length(\"qwe\"); print length(99+9)}'" \
     286    "3\n3\n3\n3\n" \
     287    "" "qwe"
     288
     289testing "awk -f and ARGC" \
     290    "awk -f - input" \
     291    "re\n2\n" \
     292    "do re mi\n" \
     293    '{print $2; print ARGC;}' \
     294
     295optional FEATURE_AWK_GNU_EXTENSIONS
     296testing "awk -e and ARGC" \
     297    "awk -e '{print \$2; print ARGC;}' input" \
     298    "re\n2\n" \
     299    "do re mi\n" \
     300    ""
     301SKIP=
     302
     303# The examples are in fact not valid awk programs (break/continue
     304# can only be used inside loops).
     305# But we do accept them outside of loops.
     306# We had a bug with misparsing "break ; else" sequence.
     307# Test that *that* bug is fixed, using simplest possible scripts:
     308testing "awk break" \
     309    "awk -f - 2>&1; echo \$?" \
     310    "0\n" \
     311    "" \
     312    'BEGIN { if (1) break; else a = 1 }'
     313testing "awk continue" \
     314    "awk -f - 2>&1; echo \$?" \
     315    "0\n" \
     316    "" \
     317    'BEGIN { if (1) continue; else a = 1 }'
     318
    225319# testing "description" "command" "result" "infile" "stdin"
    226320
  • branches/3.3/mindi-busybox/testsuite/busybox.tests

    r2725 r3621  
    66
    77. ./testing.sh
     8
     9ln -s `which busybox` unknown
     10
     11testing "busybox as unknown name" "./unknown 2>&1" \
     12    "unknown: applet not found\n" "" ""
     13rm unknown
     14
     15# We need busybox --help to be enabled for the rest of tests
     16test x"$CONFIG_BUSYBOX" = x"y" \
     17|| { echo "SKIPPED: busybox --help"; exit 0; }
    818
    919HELPDUMP=`true | busybox 2>&1 | cat`
     
    3949rm busybox-suffix
    4050
    41 ln -s `which busybox` unknown
    42 
    43 testing "busybox as unknown name" "./unknown 2>&1" \
    44     "unknown: applet not found\n" "" ""
    45 rm unknown
    46 
    4751exit $FAILCOUNT
  • branches/3.3/mindi-busybox/testsuite/bzcat.tests

    r3232 r3621  
    22
    33FAILCOUNT=0
    4 
    5 ext=bz2
    64
    75bb="busybox "
     
    119unset LANG
    1210unset LANGUAGE
     11
     12hello_Z() {
     13    # Compressed "HELLO\n"
     14    $ECHO -ne "\x1f\x9d\x90\x48\x8a\x30\x61\xf2\x44\x01"
     15}
    1316
    1417hello_gz() {
     
    2629}
    2730
    28 prep() {
    29     rm -f t*
    30     hello_$ext >t1.$ext
    31     hello_$ext >t2.$ext
    32 }
     31for ext in \
     32    `test x"$CONFIG_GUNZIP"     = x"y" && echo gz` \
     33    `test x"$CONFIG_BUNZIP2"    = x"y" && echo bz2` \
     34    `test x"$CONFIG_UNCOMPRESS" = x"y" && echo Z`
     35do
     36    prep() {
     37    rm -f t1.$ext t2.$ext t_actual
     38    hello_$ext >t1.$ext
     39    hello_$ext >t2.$ext
     40    }
    3341
    34 check() {
    35     eval $2 >t_actual 2>&1
    36     if $ECHO -ne "$expected" | cmp - t_actual; then
    37     echo "PASS: $1"
    38     else
    39     echo "FAIL: $1"
    40     FAILCOUNT=$((FAILCOUNT + 1))
    41     fi
    42 }
     42    check() {
     43    eval $2 >t_actual 2>&1
     44    if $ECHO -ne "$expected" | cmp - t_actual; then
     45        echo "PASS: $1"
     46    else
     47        echo "FAIL: $1"
     48        FAILCOUNT=$((FAILCOUNT + 1))
     49    fi
     50    }
    4351
    44 mkdir testdir 2>/dev/null
    45 (
    46 cd testdir || { echo "cannot cd testdir!"; exit 1; }
    47 
    48 expected="HELLO\nok\n"
    49 prep; check "bzcat: dont delete src" "${bb}bzcat t2.bz2; test -f t2.bz2 && echo ok"
    50 
    51 )
    52 rm -rf testdir
    53 
     52    mkdir testdir 2>/dev/null
     53    (
     54    cd testdir || { echo "cannot cd testdir!"; exit 1; }
     55    expected="HELLO\nok\n"
     56    prep
     57    check "zcat: dont delete $ext src" "${bb}zcat t2.$ext; test -f t2.$ext && echo ok"
     58    exit $FAILCOUNT
     59    )
     60    FAILCOUNT=$?
     61    rm -rf testdir
     62done
    5463
    5564
     
    6069
    6170# testing "test name" "command" "expected result" "file input" "stdin"
     71
     72## bzip algorithm
    6273
    6374# "input" file is bzipped file with "a\n" data
     
    8091"\x42\x5a\x68\x39\x17\x72\x45\x38\x50\x90\x00\x00\x00\x00" ""
    8192
     93## compress algorithm
     94
     95# "input" file is compressed (.Z) file with "a\n" data
     96test x"$CONFIG_UNCOMPRESS" = x"y" && \
     97testing "zcat can print many files" \
     98"$ECHO -ne '$hexdump' | zcat input input; echo \$?" \
     99"\
     100a
     101a
     1020
     103" "\
     104\x1f\x9d\x90\x61\x14\x00\
     105" ""
     106
     107# "input" file is compressed (.Z) zero byte file
     108test x"$CONFIG_UNCOMPRESS" = x"y" && \
     109testing "zcat can handle compressed zero-length (.Z) files" \
     110"$ECHO -ne '$hexdump' | zcat input input; echo \$?" \
     111"0\n" \
     112"\x1f\x9d\x90\x00" ""
     113
    82114
    83115
  • branches/3.3/mindi-busybox/testsuite/date/date-works

    r2725 r3621  
    3232test x"$dt" = x"Sat Jan  2 03:04:05"
    3333
    34 dt=`busybox date -d 01231133`
    35 dt=`echo "$dt" | cut -b5-19`
    36 test x"$dt" = x"Jan 23 11:33:00"
     34# date (GNU coreutils) 8.17 doesn't accept 01231133 either:
     35# date: invalid date '01231133'
     36#dt=`busybox date -d 01231133`
     37#dt=`echo "$dt" | cut -b5-19`
     38#test x"$dt" = x"Jan 23 11:33:00"
    3739
    3840dt=`busybox date -d 200001231133`
  • branches/3.3/mindi-busybox/testsuite/date/date-works-1

    r2725 r3621  
    4242# date (GNU coreutils) 6.10 reports:
    4343#   date: invalid date '01231133'
    44 dt=`busybox date -d 01231133 +%c`
    45 dt=`echo "$dt" | cut -b5-19`
    46 test x"$dt" = x"Jan 23 11:33:00"
     44#dt=`busybox date -d 01231133 +%c`
     45#dt=`echo "$dt" | cut -b5-19`
     46#test x"$dt" = x"Jan 23 11:33:00"
    4747
    4848# date (GNU coreutils) 6.10 reports:
  • branches/3.3/mindi-busybox/testsuite/diff.tests

    r2725 r3621  
    4545    "stdin"
    4646
     47testing "diff of empty file against stdin" \
     48    "diff -u - input | $TRIM_TAB" \
     49"\
     50--- -
     51+++ input
     52@@ -1 +0,0 @@
     53-a
     54" \
     55    "" \
     56    "a\n"
     57
    4758testing "diff of empty file against nonempty one" \
    4859    "diff -u - input | $TRIM_TAB" \
     
    8899    "\nb\n\n"
    89100
     101testing "diff -B ignores blank single line change" \
     102    'diff -qB - input; echo $?' \
     103    "0\n" \
     104    "\n1\n" \
     105    "1\n"
     106
     107testing "diff -B does not ignore non-blank single line change" \
     108    'diff -qB - input; echo $?' \
     109    "Files - and input differ\n1\n" \
     110    "0\n" \
     111    "1\n"
     112
    90113testing "diff always takes context from old file" \
    91114    "diff -ub - input | $TRIM_TAB" \
  • branches/3.3/mindi-busybox/testsuite/du/du-k-works

    r3232 r3621  
    33dd if=/dev/zero of=file1 bs=1k count=64 2>/dev/null
    44dd if=/dev/zero of=file2 bs=1k count=16 2>/dev/null
     5# ext4 on images <512M gives 81kb
     6# ext3 on images <512M gives 83kb
     7# a bsd system reportedly gives 82kb
    58test x"`busybox du -k .`" = x"80    ." \
     9  -o x"`busybox du -k .`" = x"81    ." \
     10  -o x"`busybox du -k .`" = x"82    ." \
     11  -o x"`busybox du -k .`" = x"83    ." \
    612  -o x"`busybox du -k .`" = x"84    ." \
    713  -o x"`busybox du -k .`" = x"88    ."
  • branches/3.3/mindi-busybox/testsuite/du/du-l-works

    r2725 r3621  
    77dd if=/dev/zero of=file2 bs=1k count=16 2>/dev/null
    88test x"`busybox du -l .`" = x"144   ." \
     9  -o x"`busybox du -l .`" = x"146   ." \
    910  -o x"`busybox du -l .`" = x"148   ." \
    1011  -o x"`busybox du -l .`" = x"152   ." \
  • branches/3.3/mindi-busybox/testsuite/du/du-m-works

    r2725 r3621  
    22
    33dd if=/dev/zero of=file bs=1M count=1 2>/dev/null
    4 test x"`busybox du -m .`" = x"1 ."
     4test x"`busybox du -m file`" = x"1  file"
  • branches/3.3/mindi-busybox/testsuite/grep.tests

    r3232 r3621  
    8383    "two\nthree\n0\n" "tw\ntwo\nthree\n" "tw.\nthr\n"
    8484
     85# -x (whole line match)
     86testing "grep -x (full match)" "grep -x foo input ; echo \$?" \
     87    "foo\n0\n" "foo\n" ""
     88testing "grep -x (partial match 1)" "grep -x foo input ; echo \$?" \
     89    "1\n" "foo bar\n" ""
     90testing "grep -x (partial match 2)" "grep -x foo input ; echo \$?" \
     91    "1\n" "bar foo\n" ""
     92testing "grep -x -F (full match)" "grep -x -F foo input ; echo \$?" \
     93    "foo\n0\n" "foo\n" ""
     94testing "grep -x -F (partial match 1)" "grep -x -F foo input ; echo \$?" \
     95    "1\n" "foo bar\n" ""
     96testing "grep -x -F (partial match 2)" "grep -x -F foo input ; echo \$?" \
     97    "1\n" "bar foo\n" ""
     98
    8599optional FEATURE_GREP_EGREP_ALIAS
    86100testing "grep -E supports extended regexps" "grep -E fo+" "foo\n" "" \
     
    128142    ""
    129143
     144testing "grep -w doesn't stop on 1st mismatch" \
     145    "grep -w foo input" \
     146    "foop foo\n" \
     147    "foop foo\n" \
     148    ""
     149
     150testing "grep -w ^str doesn't match str not at the beginning" \
     151    "grep -w ^str input" \
     152    "" \
     153    "strstr\n" \
     154    ""
     155
     156testing "grep -w ^ doesn't hang" \
     157    "grep -w ^ input" \
     158    "" \
     159    "anything\n" \
     160    ""
     161
     162testing "grep -w word doesn't match wordword" \
     163    "grep -w word input" \
     164    "" \
     165    "wordword\n" \
     166    ""
     167
     168testing "grep -w word match second word" \
     169    "grep -w word input" \
     170    "bword,word\n""wordb,word\n""bwordb,word\n" \
     171    "bword,word\n""wordb,word\n""bwordb,word\n" \
     172    ""
     173
     174# -r on symlink to dir should recurse into dir
     175mkdir -p grep.testdir/foo
     176echo bar > grep.testdir/foo/file
     177ln -s foo grep.testdir/symfoo
     178testing "grep -r on symlink to dir" \
     179    "grep -r . grep.testdir/symfoo" \
     180    "grep.testdir/symfoo/file:bar\n" \
     181    "" ""
     182rm -Rf grep.testdir
     183
     184# But -r on dir/symlink_to_dir should not recurse into symlink_to_dir
     185mkdir -p grep.testdir/foo
     186echo bar > grep.testdir/foo/file
     187ln -s foo grep.testdir/symfoo
     188testing "grep -r on dir/symlink to dir" \
     189    "grep -r . grep.testdir" \
     190    "grep.testdir/foo/file:bar\n" \
     191    "" ""
     192rm -Rf grep.testdir
     193
    130194# testing "test name" "commands" "expected result" "file input" "stdin"
    131195#   file input will be file called "input"
  • branches/3.3/mindi-busybox/testsuite/hostid/hostid-works

    r2725 r3621  
    11h=x$(busybox hostid)
    22# Is $h a sequence of hex numbers?
    3 x="${h//[0123456789abcdef]/x}"
    4 x="${x//xxx/x}"
    5 x="${x//xxx/x}"
    6 x="${x//xxx/x}"
    7 x="${x//xx/x}"
    8 test x"$x" = x"x"
     3case "$h" in
     4 x*[!0-9a-f]*) false;;
     5 *) true;;
     6esac
  • branches/3.3/mindi-busybox/testsuite/makedevs.tests

    r2725 r3621  
    2626mkdir makedevs.testdir
    2727
    28 optional FEATURE_MAKEDEVS_TABLE FEATURE_FIND_NOT FEATURE_FIND_TYPE FEATURE_LS_RECURSIVE FEATURE_LS_SORTFILES
     28optional FEATURE_MAKEDEVS_TABLE FEATURE_FIND_NOT FEATURE_FIND_TYPE FEATURE_LS_RECURSIVE FEATURE_LS_SORTFILES FEATURE_LS_TIMESTAMPS
    2929testing "makedevs -d ../makedevs.device_table.txt ." \
    3030    "(cd makedevs.testdir && makedevs -d ../makedevs.device_table.txt . 2>&1);
  • branches/3.3/mindi-busybox/testsuite/md5sum.tests

    r2725 r3621  
    3131while test $n -le 999; do
    3232    echo "$text" | head -c $n | "$sum"
    33     : $((n++))
     33    n=$(($n+1))
    3434done | "$sum"
    3535)`
    3636
    3737if test x"$result" = x"$expected  -"; then
    38     echo "PASS: $sum"
    39     exit 0
     38    echo "PASS: $sum"
     39    exit 0
    4040fi
    4141
  • branches/3.3/mindi-busybox/testsuite/mdev.tests

    r3232 r3621  
    169169rm -rf mdev.testdir/dev/*
    170170echo "sda 0:0 644 @echo @echo TEST" >mdev.testdir/etc/mdev.conf
    171 optional STATIC FEATURE_MDEV_CONF FEATURE_MDEV_EXEC FEATURE_LS_RECURSIVE FEATURE_LS_TIMESTAMPS FEATURE_LS_USERNAME FEATURE_SH_IS_ASH
     171optional STATIC FEATURE_MDEV_CONF FEATURE_MDEV_EXEC FEATURE_LS_RECURSIVE FEATURE_LS_TIMESTAMPS FEATURE_LS_USERNAME FEATURE_SH_IS_ASH ASH_BUILTIN_ECHO
    172172testing "mdev command" \
    173173    "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
  • branches/3.3/mindi-busybox/testsuite/pwd/pwd-prints-working-directory

    r821 r3621  
    1 test $(pwd) = $(busybox pwd)
     1# shell's $PWD may leave symlinks unresolved.
     2# "pwd" may be a built-in and have the same problem.
     3# External pwd _can't_ have that problem (current dir on Unix is physical).
     4test $(`which pwd`) = $(busybox pwd)
  • branches/3.3/mindi-busybox/testsuite/readlink.tests

    r2725 r3621  
    2222optional FEATURE_READLINK_FOLLOW
    2323
    24 testing "readlink -f on a file" "readlink -f ./$TESTFILE" "$PWD/$TESTFILE\n" "" ""
    25 testing "readlink -f on a link" "readlink -f ./$TESTLINK" "$PWD/$TESTFILE\n" "" ""
     24# shell's $PWD may leave symlinks unresolved.
     25# "pwd" may be a built-in and have the same problem.
     26# External pwd _can't_ have that problem (current dir on Unix is physical).
     27pwd=`which pwd`
     28pwd=`$pwd`
     29testing "readlink -f on a file" "readlink -f ./$TESTFILE" "$pwd/$TESTFILE\n" "" ""
     30testing "readlink -f on a link" "readlink -f ./$TESTLINK" "$pwd/$TESTFILE\n" "" ""
    2631testing "readlink -f on an invalid link" "readlink -f ./$FAILLINK" "" "" ""
    27 testing "readlink -f on a wierd dir" "readlink -f $TESTDIR/../$TESTFILE" "$PWD/$TESTFILE\n" "" ""
     32testing "readlink -f on a wierd dir" "readlink -f $TESTDIR/../$TESTFILE" "$pwd/$TESTFILE\n" "" ""
    2833
    2934
  • branches/3.3/mindi-busybox/testsuite/sed.tests

    r3232 r3621  
    136136testing "sed cat plus empty file" "sed -e 's/nohit//' input -" "one\ntwo" \
    137137    "one\ntwo" ""
    138 test x"$SKIP_KNOWN_BUGS" = x"" && {
    139138testing "sed append autoinserts newline" "sed -e '/woot/a woo' -" \
    140139    "woot\nwoo\n" "" "woot"
    141 }
     140testing "sed append autoinserts newline 2" "sed -e '/oot/a woo' - input" \
     141    "woot\nwoo\nboot\nwoo\n" "boot" "woot"
     142testing "sed append autoinserts newline 3" "sed -e '/oot/a woo' -i input && cat input" \
     143    "boot\nwoo\n" "boot" ""
    142144testing "sed insert doesn't autoinsert newline" "sed -e '/woot/i woo' -" \
    143145    "woo\nwoot" "" "woot"
     
    155157    "sed -ne 's/woo/bang/p' input -" "a bang\nb bang" "a woo\nb woo" \
    156158    "c no\nd no"
    157 test x"$SKIP_KNOWN_BUGS" = x"" && {
    158159testing "sed clusternewline" \
    159160    "sed -e '/one/a 111' -e '/two/i 222' -e p input -" \
    160161    "one\none\n111\n222\ntwo\ntwo" "one" "two"
    161 }
    162162testing "sed subst+write" \
    163163    "sed -e 's/i/z/' -e 'woutputw' input -; $ECHO -n X; cat outputw" \
     
    278278'
    279279
     280testing "sed a cmd understands \\n,\\t,\\r" \
     281    "sed '/1/a\\\\t\\rzero\\none\\\\ntwo\\\\\\nthree'" \
     282"\
     283line1
     284\t\rzero
     285one\\\\ntwo\\
     286three
     287" "" "line1\n"
     288
     289testing "sed i cmd understands \\n,\\t,\\r" \
     290    "sed '/1/i\\\\t\\rzero\\none\\\\ntwo\\\\\\nthree'" \
     291"\
     292\t\rzero
     293one\\\\ntwo\\
     294three
     295line1
     296" "" "line1\n"
     297
    280298# first three lines are deleted; 4th line is matched and printed by "2,3" and by "4" ranges
    281299testing "sed with N skipping lines past ranges on next cmds" \
     
    311329    "qwerty_\n" "" "qwerty\n"
    312330
     331testing "sed /\$_in_regex/ should not match newlines, only end-of-line" \
     332    "sed ': testcont; /\\\\$/{ =; N; b testcont }'" \
     333    "\
     334this is a regular line
     3352
     336line with \\
     337continuation
     338more regular lines
     3395
     340line with \\
     341continuation
     342" \
     343    "" "\
     344this is a regular line
     345line with \\
     346continuation
     347more regular lines
     348line with \\
     349continuation
     350"
     351
     352testing "sed s///NUM test" \
     353    "sed -e 's/a/b/2; s/a/c/g'" \
     354    "cb\n" "" "aa\n"
     355
     356testing "sed /regex/,N{...} addresses work" \
     357    "sed /^2/,2{d}" \
     358    "1\n3\n4\n5\n" \
     359    "" \
     360    "1\n2\n3\n4\n5\n"
     361
     362testing "sed /regex/,+N{...} addresses work" \
     363    "sed /^2/,+2{d}" \
     364    "1\n5\n" \
     365    "" \
     366    "1\n2\n3\n4\n5\n"
     367
     368testing "sed /regex/,+N{...} -i works" \
     369    "cat - >input2; sed /^4/,+2{d} -i input input2; echo \$?; cat input input2; rm input2" \
     370    "0\n""1\n2\n3\n7\n8\n""1\n2\n7\n8\n" \
     371    "1\n2\n3\n4\n5\n6\n7\n8\n" \
     372    "1\n2\n4\n5\n6\n7\n8\n" \
     373
     374# GNU sed 4.2.1 would also accept "/^4/,+{d}" with the same meaning, we don't
     375testing "sed /regex/,+0{...} -i works" \
     376    "cat - >input2; sed /^4/,+0{d} -i input input2; echo \$?; cat input input2; rm input2" \
     377    "0\n""1\n2\n3\n5\n6\n7\n8\n""1\n2\n5\n6\n7\n8\n" \
     378    "1\n2\n3\n4\n5\n6\n7\n8\n" \
     379    "1\n2\n4\n5\n6\n7\n8\n" \
     380
     381# GNU sed 4.2.1 would also accept "/^4/,+d" with the same meaning, we don't
     382testing "sed /regex/,+0<cmd> -i works" \
     383    "cat - >input2; sed /^4/,+0d -i input input2; echo \$?; cat input input2; rm input2" \
     384    "0\n""1\n2\n3\n5\n6\n7\n8\n""1\n2\n5\n6\n7\n8\n" \
     385    "1\n2\n3\n4\n5\n6\n7\n8\n" \
     386    "1\n2\n4\n5\n6\n7\n8\n" \
     387
     388testing "sed 's///w FILE'" \
     389    "sed 's/qwe/ZZZ/wz'; cat z; rm z" \
     390    "123\nZZZ\nasd\n""ZZZ\n" \
     391    "" \
     392    "123\nqwe\nasd\n"
     393
    313394# testing "description" "commands" "result" "infile" "stdin"
    314395
  • branches/3.3/mindi-busybox/testsuite/sort.tests

    r2725 r3621  
    4848" "$data" ""
    4949
    50 test x"$SKIP_KNOWN_BUGS" = x"" && {
    51 # Busybox is definitely doing these wrong.  FIXME
    5250testing "sort key range with numeric option and global reverse" \
    5351"sort -k2,3n -r input" \
     
    6664egg 1   2   papyrus
    6765" "$data" ""
    68 }
    6966
    7067testing "sort key range with two -k options" "sort -k 2,2n -k 1,1r input" "\
     
    10299" ""
    103100
     101testing "sort with non-default leading delim 4" "sort -t: -k1,1 input" "\
     102a:b
     103a/a:a
     104" "\
     105a/a:a
     106a:b
     107" ""
     108
     109testing "sort with ENDCHAR" "sort -t. -k1,1.1 -k2 input" "\
     110ab.1
     111aa.2
     112" "\
     113aa.2
     114ab.1
     115" ""
     116
     117testing "glibc build sort" "sort -t. -k 1,1 -k 2n,2n -k 3 input" "\
     118GLIBC_2.1
     119GLIBC_2.1.1
     120GLIBC_2.2
     121GLIBC_2.2.1
     122GLIBC_2.10
     123GLIBC_2.20
     124GLIBC_2.21
     125" "\
     126GLIBC_2.21
     127GLIBC_2.1.1
     128GLIBC_2.2.1
     129GLIBC_2.2
     130GLIBC_2.20
     131GLIBC_2.10
     132GLIBC_2.1
     133" ""
     134
     135testing "glibc build sort unique" "sort -u -t. -k 1,1 -k 2n,2n -k 3 input" "\
     136GLIBC_2.1
     137GLIBC_2.1.1
     138GLIBC_2.2
     139GLIBC_2.2.1
     140GLIBC_2.10
     141GLIBC_2.20
     142GLIBC_2.21
     143" "\
     144GLIBC_2.10
     145GLIBC_2.2.1
     146GLIBC_2.1.1
     147GLIBC_2.20
     148GLIBC_2.2
     149GLIBC_2.1
     150GLIBC_2.21
     151" ""
     152
    104153testing "sort -u should consider field only when discarding" "sort -u -k2 input" "\
    105154a c
  • branches/3.3/mindi-busybox/testsuite/tar.tests

    r3232 r3621  
    1616# testing "test name" "script" "expected result" "file input" "stdin"
    1717
     18testing "Empty file is not a tarball" '\
     19tar xvf - 2>&1; echo $?
     20' "\
     21tar: short read
     221
     23" \
     24"" ""
     25SKIP=
     26
     27optional FEATURE_SEAMLESS_GZ GUNZIP
     28# In NOMMU case, "invalid magic" message comes from gunzip child process.
     29# Otherwise, it comes from tar.
     30# Need to fix output up to avoid false positive.
     31testing "Empty file is not a tarball.tar.gz" '\
     32{ tar xvzf - 2>&1; echo $?; } | grep -Fv "invalid magic"
     33' "\
     34tar: short read
     351
     36" \
     37"" ""
     38SKIP=
     39
     40testing "Two zeroed blocks is a ('truncated') empty tarball" '\
     41dd if=/dev/zero bs=512 count=2 2>/dev/null | tar xvf - 2>&1; echo $?
     42' "\
     430
     44" \
     45"" ""
     46SKIP=
     47
     48testing "Twenty zeroed blocks is an empty tarball" '\
     49dd if=/dev/zero bs=512 count=20 2>/dev/null | tar xvf - 2>&1; echo $?
     50' "\
     510
     52" \
     53"" ""
     54SKIP=
     55
     56# "tar cf test.tar input input_dir/ input_hard1 input_hard2 input_hard1 input_dir/ input":
     57# GNU tar 1.26 records as hardlinks:
     58#  input_hard2 -> input_hard1
     59#  input_hard1 -> input_hard1 (!!!)
     60#  input_dir/file -> input_dir/file
     61#  input -> input
     62# As of 1.24.0, we don't record last two: for them, nlink==1
     63# and we check for "hardlink"ness only files with nlink!=1
     64# We also don't use "hrw-r--r--" notation for hardlinks in "tar tv" listing.
    1865optional FEATURE_TAR_CREATE FEATURE_LS_SORTFILES
    1966testing "tar hardlinks and repeated files" '\
     
    2774tar cf test.tar input input_dir/ input_hard1 input_hard2 input_hard1 input_dir/ input
    2875tar tvf test.tar | sed "s/.*[0-9] input/input/"
     76rm -rf input_dir
    2977tar xf test.tar 2>&1
    3078echo Ok: $?
     
    157205# Had a bug where on extract autodetect first "switched off" -z
    158206# and then failed to recognize .tgz extension
    159 optional FEATURE_TAR_CREATE FEATURE_SEAMLESS_GZ
     207optional FEATURE_TAR_CREATE FEATURE_SEAMLESS_GZ GUNZIP
    160208testing "tar extract tgz" "\
    161209dd count=1 bs=1M if=/dev/zero of=F0 2>/dev/null
     
    209257SKIP=
    210258
     259# attack.tar.bz2 has symlink pointing to a system file
     260# followed by a regular file with the same name
     261# containing "root::0:0::/root:/bin/sh":
     262#  lrwxrwxrwx root/root passwd -> /tmp/passwd
     263#  -rw-r--r-- root/root passwd
     264# naive tar implementation may end up creating the symlink
     265# and then writing into it.
     266# The correct implementation unlinks target before
     267# creating the second file.
     268# We test that /tmp/passwd remains empty:
     269optional UUDECODE FEATURE_TAR_AUTODETECT FEATURE_SEAMLESS_BZ2
     270testing "tar does not extract into symlinks" "\
     271>>/tmp/passwd && uudecode -o input && tar xf input 2>&1 && rm passwd; cat /tmp/passwd; echo \$?
     272" "\
     2730
     274" \
     275"" "\
     276begin-base64 644 attack.tar.bz2
     277QlpoOTFBWSZTWRVn/bIAAKt7hMqwAEBAAP2QAhB0Y96AAACACCAAlISgpqe0
     278po0DIaDynqAkpDRP1ANAhiYNSPR8VchKhAz0AK59+DA6FcMKBggOARIJdVHL
     279DGllrjs20ATUgR1HmccBX3EhoMnpMJaNyggmxgLDMz54lBnBTJO/1L1lbMS4
     280l4/V8LDoe90yiWJhOJvIypgEfxdyRThQkBVn/bI=
     281====
     282"
     283SKIP=
     284# And same with -k
     285optional UUDECODE FEATURE_TAR_AUTODETECT FEATURE_SEAMLESS_BZ2
     286testing "tar -k does not extract into symlinks" "\
     287>>/tmp/passwd && uudecode -o input && tar xf input -k 2>&1 && rm passwd; cat /tmp/passwd; echo \$?
     288" "\
     289tar: can't open 'passwd': File exists
     2900
     291" \
     292"" "\
     293begin-base64 644 attack.tar.bz2
     294QlpoOTFBWSZTWRVn/bIAAKt7hMqwAEBAAP2QAhB0Y96AAACACCAAlISgpqe0
     295po0DIaDynqAkpDRP1ANAhiYNSPR8VchKhAz0AK59+DA6FcMKBggOARIJdVHL
     296DGllrjs20ATUgR1HmccBX3EhoMnpMJaNyggmxgLDMz54lBnBTJO/1L1lbMS4
     297l4/V8LDoe90yiWJhOJvIypgEfxdyRThQkBVn/bI=
     298====
     299"
     300SKIP=
     301
    211302
    212303cd .. && rm -rf tar.tempdir || exit 1
  • branches/3.3/mindi-busybox/testsuite/test.tests

    r2725 r3621  
    7777    "" ""
    7878
     79testing "test '!' = '!': should be true (0)" \
     80    "busybox test '!' = '!'; echo \$?" \
     81    "0\n" \
     82    "" ""
     83
     84testing "test '(' = '(': should be true (0)" \
     85    "busybox test '(' = '('; echo \$?" \
     86    "0\n" \
     87    "" ""
     88
     89testing "test '!' '!' = '!': should be false (1)" \
     90    "busybox test '!' '!' = '!'; echo \$?" \
     91    "1\n" \
     92    "" ""
     93
     94testing "test '!' '(' = '(': should be false (1)" \
     95    "busybox test '!' '(' = '('; echo \$?" \
     96    "1\n" \
     97    "" ""
     98
    7999exit $FAILCOUNT
  • branches/3.3/mindi-busybox/testsuite/testing.sh

    r3232 r3621  
    5757    SKIP=
    5858    while test "$1"; do
    59         if test x"${OPTIONFLAGS/*:$1:*/y}" != x"y"; then
    60             SKIP=1
    61             return
    62         fi
     59        case "${OPTIONFLAGS}" in
     60            *:$1:*) ;;
     61            *) SKIP=1; return ;;
     62        esac
    6363        shift
    6464    done
  • branches/3.3/mindi-busybox/testsuite/unzip.tests

    r2725 r3621  
    88. ./testing.sh
    99
    10 # testing "test name" "options" "expected result" "file input" "stdin"
     10# testing "test name" "commands" "expected result" "file input" "stdin"
    1111#   file input will be file called "input"
    1212#   test can create a file "actual" instead of writing to stdout
     
    3131rm foo.zip
    3232
     33# File containing some damaged encrypted stream
     34testing "unzip (bad archive)" "uudecode; unzip bad.zip 2>&1; echo \$?" \
     35"Archive:  bad.zip
     36  inflating: ]3j½r«IK-%Ix
     37unzip: corrupted data
     38unzip: inflate error
     391
     40" \
     41"" "\
     42begin-base64 644 bad.zip
     43UEsDBBQAAgkIAAAAIQA5AAAANwAAADwAAAAQAAcAXTNqwr1ywqtJGxJLLSVJ
     44eCkBD0AdKBk8JzQsIj01JC0/ORJQSwMEFAECCAAAAAAhADoAAAAPAAAANgAA
     45AAwAAQASw73Ct1DCokohPXQiNjoUNTUiHRwgLT4WHlBLAQIQABQAAggIAAAA
     46oQA5AAAANwAAADwAAAAQQAcADAAAACwAMgCAAAAAAABdM2rCvXLCq0kbEkst
     47JUl4KQEPQB0oGSY4Cz4QNgEnJSYIPVBLAQIAABQAAggAAAAAIQAqAAAADwAA
     48BDYAAAAMAAEADQAAADIADQAAAEEAAAASw73Ct1DKokohPXQiNzA+FAI1HCcW
     49NzITNFBLBQUKAC4JAA04Cw0EOhZQSwUGAQAABAIAAgCZAAAAeQAAAAIALhM=
     50====
     51"
     52
     53rm *
     54
    3355# Clean up scratch directory.
    3456
  • branches/3.3/mindi-busybox/testsuite/which/which-uses-default-path

    r821 r3621  
    1 BUSYBOX=$(type -p busybox)
     1BUSYBOX=$(command -v busybox)
    22SAVED_PATH=$PATH
    33unset PATH
Note: See TracChangeset for help on using the changeset viewer.