diff options
author | Ron Yorston | 2018-02-09 09:52:52 +0000 |
---|---|---|
committer | Denys Vlasenko | 2018-04-09 20:35:48 +0200 |
commit | 1f27fa98380c134cd0f5f03b4cd3dfe2e83c09b7 (patch) | |
tree | a41b553f1cd5506d94a1c60951cdafbe9f6f6917 /testsuite | |
parent | 9db344a0f4ed5f6f893940b734215d05e48320e9 (diff) | |
download | busybox-1f27fa98380c134cd0f5f03b4cd3dfe2e83c09b7.zip busybox-1f27fa98380c134cd0f5f03b4cd3dfe2e83c09b7.tar.gz |
testsuite: allow tests to work in paths containing spaces
Tweak some tests so they work when the path to the test directory or
$HOME contains spaces.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/grep.tests | 2 | ||||
-rwxr-xr-x | testsuite/printf.tests | 2 | ||||
-rw-r--r-- | testsuite/pwd/pwd-prints-working-directory | 2 | ||||
-rwxr-xr-x | testsuite/sum.tests | 6 | ||||
-rw-r--r-- | testsuite/xargs/xargs-works | 6 |
5 files changed, 10 insertions, 8 deletions
diff --git a/testsuite/grep.tests b/testsuite/grep.tests index d0b0d27..e578897 100755 --- a/testsuite/grep.tests +++ b/testsuite/grep.tests @@ -15,7 +15,7 @@ testing "grep (exit with error)" "grep nonexistent 2> /dev/null ; echo \$?" \ "1\n" "" "" -testing "grep (exit success)" "grep grep $0 > /dev/null 2>&1 ; echo \$?" "0\n" \ +testing "grep (exit success)" "grep grep '$0' > /dev/null 2>&1 ; echo \$?" "0\n" \ "" "" # Test various data sources and destinations diff --git a/testsuite/printf.tests b/testsuite/printf.tests index 9a3c874..963ded9 100755 --- a/testsuite/printf.tests +++ b/testsuite/printf.tests @@ -20,7 +20,7 @@ testing "printf produces no further output 2" \ "" "" testing "printf repeatedly uses pattern for each argv" \ - "${bb}printf '%s\n' foo \$HOME" \ + "${bb}printf '%s\n' foo '$HOME'" \ "foo\n$HOME\n" \ "" "" diff --git a/testsuite/pwd/pwd-prints-working-directory b/testsuite/pwd/pwd-prints-working-directory index 971adb5..fc7fea7 100644 --- a/testsuite/pwd/pwd-prints-working-directory +++ b/testsuite/pwd/pwd-prints-working-directory @@ -1,4 +1,4 @@ # shell's $PWD may leave symlinks unresolved. # "pwd" may be a built-in and have the same problem. # External pwd _can't_ have that problem (current dir on Unix is physical). -test $(`which pwd`) = $(busybox pwd) +test "$(`which pwd`)" = "$(busybox pwd)" diff --git a/testsuite/sum.tests b/testsuite/sum.tests index b9f4cbf..e637934 100755 --- a/testsuite/sum.tests +++ b/testsuite/sum.tests @@ -13,12 +13,12 @@ # test can create a file "actual" instead of writing to stdout testing "sum -r file doesn't print file's name" \ - "sum -r $0 | grep -c $0 && echo wrongly_printed_filename || echo yes" \ + "sum -r '$0' | grep -c '$0' && echo wrongly_printed_filename || echo yes" \ "0\nyes\n" "" "" testing "sum -r file file does print both names" \ - "sum -r $0 $0 | grep -c $0 && echo yes || echo wrongly_omitted_filename" \ + "sum -r '$0' '$0' | grep -c '$0' && echo yes || echo wrongly_omitted_filename" \ "2\nyes\n" "" "" testing "sum -s file does print file's name" \ - "sum -s $0 | grep -c $0 && echo yes || echo wrongly_omitted_filename" \ + "sum -s '$0' | grep -c '$0' && echo yes || echo wrongly_omitted_filename" \ "1\nyes\n" "" "" exit $FAILCOUNT diff --git a/testsuite/xargs/xargs-works b/testsuite/xargs/xargs-works index c95869e..a4bba76 100644 --- a/testsuite/xargs/xargs-works +++ b/testsuite/xargs/xargs-works @@ -1,4 +1,6 @@ +# FEATURE: CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM + [ -n "$d" ] || d=.. -find "$d" -name \*works -type f | xargs md5sum > logfile.gnu -find "$d" -name \*works -type f | busybox xargs md5sum > logfile.bb +find "$d" -name \*works -type f -print0 | xargs -0 md5sum > logfile.gnu +find "$d" -name \*works -type f -print0 | busybox xargs -0 md5sum > logfile.bb diff -u logfile.gnu logfile.bb |