From 6b156ab5b70b6b5703b72e2a50214e2564fdceb5 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 8 Nov 2026 15:48:06 -0600 Subject: [PATCH] Fix various TEST_HOST failures. --- tests/grep.test | 4 ++-- tests/md5sum.test | 2 +- tests/netcat.test | 2 +- tests/paste.test | 3 ++- tests/patch.test | 2 +- tests/seq.test | 2 +- tests/tac.test | 7 ++++--- tests/top.test | 10 +++++++--- 8 files changed, 19 insertions(+), 13 deletions(-) diff --git a/tests/grep.test b/tests/grep.test index c1aa51ca..3220d59e 100755 --- a/tests/grep.test +++ b/tests/grep.test @@ -159,8 +159,8 @@ rm test testcmd "match after NUL byte" "-a two" "one\0and two three\n" \ "" 'one\0and two three' -testcmd "NUL in -B" "-B2 X" "A\0BBBBBB\xff\xff\xff\x7f\nX\n" \ - "" 'A\0BBBBBB\xff\xff\xff\x7f\nX\n' +testcmd "NUL in -B" "-aB2 X input" "A\0BBBBBB\xff\xff\xff\x7f\nX\n" \ + 'A\0BBBBBB\xff\xff\xff\x7f\nX\n' '' # BREs versus EREs testcmd "implicit BRE |" "'uno|dos'" "uno|dos\n" "" "uno\ndos\nuno|dos\n" diff --git a/tests/md5sum.test b/tests/md5sum.test index cda9871f..234fcfc0 100755 --- a/tests/md5sum.test +++ b/tests/md5sum.test @@ -22,7 +22,7 @@ testing "6" "md5sum" "57edf4a22be3c955ac49da2e2107b67a -\n" \ echo -n "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" > "te st" touch empty -testing "-c spaces" "md5sum -c input || echo ok" \ +testing "-c spaces" "md5sum -c input 2>/dev/null || echo ok" \ "te st: OK\nempty: FAILED\n-: OK\nok\n" \ "$(printf "d174ab98d277d9f5a5611c2c9f419d9f te st\n12345678901234567890123456789012 empty\nd41d8cd98f00b204e9800998ecf8427e -\n")" "" rm "te st" empty diff --git a/tests/netcat.test b/tests/netcat.test index 81e6ec7d..37b6b88b 100755 --- a/tests/netcat.test +++ b/tests/netcat.test @@ -5,7 +5,7 @@ #testing "name" "command" "result" "infile" "stdin" { dd if=/dev/zero bs=4k count=1 2>/dev/null | tr '\0' a; echo b; } > testfile -testing "more than buffer bytes left at end" \ +toyonly testing "more than buffer bytes left at end" \ "netcat -lp 1234 wc -c & sleep .1 && cat testfile | netcat 127.0.0.1 1234" \ "4098\n" "" "" rm -f testfile diff --git a/tests/paste.test b/tests/paste.test index c067f182..b7734be1 100755 --- a/tests/paste.test +++ b/tests/paste.test @@ -19,7 +19,8 @@ testing "" "paste one two one two" \ "one1\ttwo1\tone1\ttwo1\none2\ttwo2\tone2\ttwo2\none3\ttwo3\tone3\ttwo3\n" \ "" "" testing "" "paste five three two" "five\t\ttwo1\n\t\ttwo2\n\t\ttwo3\n" "" "" -testing "" "paste -d '私\0${UTFTEST}q' - - - - - - " \ +# debian paste -d is not utf8 aware +toyonly testing "" "paste -d '私\0${UTFTEST}q' - - - - - - " \ "one私twothree${UTFTEST}fourqfive私six\n7私89${UTFTEST}q私\n" \ "" "one\ntwo\nthree\nfour\nfive\nsix\n7\n8\n9\n" rm -f one two three four diff --git a/tests/patch.test b/tests/patch.test index 9f44e07c..9009abe7 100755 --- a/tests/patch.test +++ b/tests/patch.test @@ -95,7 +95,7 @@ testing "quoted name" "patch > /dev/null && cat 'fruit bat'" \ +hello ' -testing "bad quote" "patch 2>&1" $'patch: bad "filename\n' "" '--- "filename' +testing "bad quote" "patch |& grep -o ^patch:" 'patch:\n' "" '--- "filename' testing "dry run doesn't delete file" \ "patch --dry-run > /dev/null && [ -e 'fruit bat' ] && echo yes" "yes\n" "" ' diff --git a/tests/seq.test b/tests/seq.test index 6b80e6ac..b4cc1e75 100755 --- a/tests/seq.test +++ b/tests/seq.test @@ -26,7 +26,7 @@ testing "count by -.9" "seq .7 -.9 -2.2" "0.7\n-0.2\n-1.1\n-2.0\n" "" "" #testing "count up by zero" "seq 4 0 8 | head -n 4" "4\n4\n4\n4\n" "" "" #testing "count nowhere by zero" "seq 4 0 4 | head -n 4" "4\n4\n4\n4\n" "" "" -testing "count down by zero" "seq 8 0 4 | head -n 4" "" "" "" +testing "count down by zero" "seq 8 0 4 2>/dev/null" "" "" "" testing "separator -" "seq -s - 1 3" "1-2-3\n" "" "" testing "format string" 'seq -f %+01g -10 5 10' "-10\n-5\n+0\n+5\n+10\n" \ "" "" diff --git a/tests/tac.test b/tests/tac.test index 5c095b4b..1aad0c6e 100755 --- a/tests/tac.test +++ b/tests/tac.test @@ -14,8 +14,9 @@ testing "- file" "tac - file1" "zero-B\nzero-A\none-B\none-A\n" "" "zer testing "file -" "tac file1 -" "one-B\none-A\nzero-B\nzero-A\n" "" "zero-A\nzero-B\n" testing "file1 notfound file2" \ - "tac file1 notfound file2 2>stderr && echo ok ; tac stderr; rm stderr" \ - "one-B\none-A\ntwo-B\ntwo-A\ntac: notfound: No such file or directory\n" "" "" + "tac file1 notfound file2 2>stderr && echo ok ; grep -o ^tac: stderr" \ + "one-B\none-A\ntwo-B\ntwo-A\ntac:\n" "" "" +rm -f stderr testing "no trailing newline" "tac -" "defabc\n" "" "abc\ndef" @@ -26,4 +27,4 @@ testing "no trailing newline" "tac -" "defabc\n" "" "abc\ndef" # -rm file1 file2 \ No newline at end of file +rm file1 file2 diff --git a/tests/top.test b/tests/top.test index 3c3b5977..43d68a1d 100755 --- a/tests/top.test +++ b/tests/top.test @@ -8,6 +8,10 @@ testing "batch termination" "top -b -n1 | tail -c 1" "\n" "" "" testing "fractional seconds" "top -b -d 8.5 -n1 | tail -c 1" "\n" "" "" # These are unit tests of xparsetime. -testing "-d invalid input" "top -b -d monkey -n1 2>&1 >/dev/null" "top: Not a number 'monkey'\n" "" "" -testing "-d unknown suffix" "top -b -d 1u -n1 2>&1 >/dev/null" "top: Unknown suffix 'u'\n" "" "" -testing "-d suffix trailing junk" "top -b -d 1monkey -n1 2>&1 >/dev/null" "top: Unknown suffix 'monkey'\n" "" "" +testing "-d invalid input" \ + "top -b -d monkey -n1 |& sed -n \"s/^top: .*'monkey'/yes/p\"" "yes\n" "" "" +testing "-d unknown suffix" "top -b -d 1u -n1 2>/dev/null || echo yes" \ + "yes\n" "" "" +testing "-d suffix trailing junk" \ + "top -b -d 1monkey -n1 2>/dev/null |& sed -n \"s/^top: .*monkey'/yes/p\"" \ + "yes\n" "" "" -- 2.39.5