Looking at toysh again since the toybox test suite should run under it
(in mkroot or under a chroot) A problem seems to be that there is no
return command, which breaks runtest.sh to it's core. Dont know how to add one 
in yet

On my version of bash (5.2.26) TEST_HOST fails on 3 test cases,
and toysh also fails on those cases (Even tho toysh is doing the right
thing, the same as bash) The attached patch changes the test file
so that 3 test cases are resolved. And TEST_HOST works

-   Oliver Webb <[email protected]>
From 2008af1903df57683d01190234484fae703ce83f Mon Sep 17 00:00:00 2001
From: Oliver Webb <[email protected]>
Date: Thu, 7 Mar 2024 19:24:59 -0600
Subject: [PATCH] toysh: Shut up TEST_HOST, both toysh and bash are doing the
 same thing but both are failing in 3 test cases

---
 tests/sh.test | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/sh.test b/tests/sh.test
index 306a4392..07f84f2c 100644
--- a/tests/sh.test
+++ b/tests/sh.test
@@ -83,7 +83,7 @@ testing 'IFS $*' "$SH -c 'IFS=xy; echo \"\$*\"' one two tyree" "twoxtyree\n" \
 # Without the \n\n bash 5 emits SHLVL=0
 testing 'default exports' \
   "env -i \"$(which $SH)\" --noprofile --norc -c \$'env\n\n' | sort" \
-  "PWD=$(pwd)\nSHLVL=1\n_=$(which env)\n" "" ""
+  "PWD=$(pwd)\nSHLVL=1\n_=/usr/bin/env\n" "" ""
 # toysh order of operations not matching bash
 #testing "leading assignment fail" \
 #  "{ \$SH -c 'X=\${a?blah} > walroid';ls walroid;} 2>/dev/null" '' '' ''
@@ -149,7 +149,7 @@ shxpect '$_ preserved on prefix error' I$'true hello; a=1 b=2 c=${} true\n' \
   E E"$P" I$'echo $_\n' O$'hello\n'
 shxpect '$_ preserved on exec error' I$'true hello; ${}\n' \
   E E"$P" I$'echo $_\n' O$'hello\n'
-shxpect '$_ abspath on exec' I$'env | grep ^_=\n' O$'_=/usr/bin/env\n'
+testing '$_ abspath on exec' "$SH -c 'env | grep ^_='" "_=$(which env)\n" "" ""
 testing '$_ literal after exec' 'env >/dev/null; echo $_' 'env\n' '' ''
 shxpect '$_ no path for builtin' I$'true; echo $_\n' O$'true\n'
 testing 'prefix is local for builtins' 'abc=123; abc=def unset abc; echo $abc' \
@@ -576,7 +576,7 @@ testing "line continuation5" $'XYZ=xyz; echo "abc$\\\nXYZ"' 'abcxyz\n' '' ''
 testing 'SECONDS' 'readonly SECONDS=41; sleep 1; echo $SECONDS' '42\n' '' ''
 # testing 'SECONDS2' 'readonly SECONDS; SECONDS=0; echo $SECONDS' '' '' '' #bash!
 testing 'SECONDS2' 'SECONDS=123+456; echo $SECONDS' '0\n' '' '' #bash!!
-testing '$LINENO 2' $'echo $LINENO\necho $LINENO' '0\n1\n' '' ''
+testing '$LINENO 2' $'echo $LINENO\necho $LINENO' '1\n2\n' '' ''
 testing '$EUID' 'echo $EUID' "$(id -u)\n" '' ''
 testing '$UID' 'echo $UID' "$(id -ur)\n" '' ''
 
-- 
2.44.0

_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to