diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2023-06-14 15:19:02 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2023-06-14 15:19:02 +0200 |
commit | 2ff01bb699d80cb7d24a93e812cc91c54be5cc20 (patch) | |
tree | a4b324819eef22453af95eeaa7842362cf7b19f1 | |
parent | 66139330fc09384f2ce95e60ea1f5268badbafc9 (diff) | |
download | busybox-w32-2ff01bb699d80cb7d24a93e812cc91c54be5cc20.tar.gz busybox-w32-2ff01bb699d80cb7d24a93e812cc91c54be5cc20.tar.bz2 busybox-w32-2ff01bb699d80cb7d24a93e812cc91c54be5cc20.zip |
shell: sync ash/hush test scripts
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rwxr-xr-x | shell/ash_test/run-all | 21 | ||||
-rwxr-xr-x | shell/hush_test/run-all | 12 |
2 files changed, 25 insertions, 8 deletions
diff --git a/shell/ash_test/run-all b/shell/ash_test/run-all index 96703ef12..066327dc0 100755 --- a/shell/ash_test/run-all +++ b/shell/ash_test/run-all | |||
@@ -47,6 +47,7 @@ do_test() | |||
47 | # $1 but with / replaced by # so that it can be used as filename part | 47 | # $1 but with / replaced by # so that it can be used as filename part |
48 | noslash=`echo "$1" | sed 's:/:#:g'` | 48 | noslash=`echo "$1" | sed 's:/:#:g'` |
49 | ( | 49 | ( |
50 | tret=0 | ||
50 | cd "$1" || { echo "cannot cd $1!"; exit 1; } | 51 | cd "$1" || { echo "cannot cd $1!"; exit 1; } |
51 | for x in run-*; do | 52 | for x in run-*; do |
52 | test -f "$x" || continue | 53 | test -f "$x" || continue |
@@ -69,13 +70,25 @@ do_test() | |||
69 | test -f "$name.right" || continue | 70 | test -f "$name.right" || continue |
70 | # echo Running test: "$x" | 71 | # echo Running test: "$x" |
71 | echo -n "$1/$x:" | 72 | echo -n "$1/$x:" |
72 | { | 73 | ( |
73 | "$THIS_SH" "./$x" 2>&1 | \ | 74 | "$THIS_SH" "./$x" 2>&1 | \ |
74 | grep -va "^ash: using fallback suid method$" >"$name.xx" | 75 | grep -va "^ash: using fallback suid method$" >"$name.xx" |
76 | r=$? | ||
77 | # filter C library differences | ||
78 | sed -i \ | ||
79 | -e "/: invalid option /s:'::g" \ | ||
80 | "$name.xx" | ||
81 | test $r -eq 77 && rm -f "$TOPDIR/$noslash-$x.fail" && exit 77 | ||
75 | diff -u "$name.xx" "$name.right" >"$TOPDIR/$noslash-$x.fail" \ | 82 | diff -u "$name.xx" "$name.right" >"$TOPDIR/$noslash-$x.fail" \ |
76 | && rm -f "$name.xx" "$TOPDIR/$noslash-$x.fail" | 83 | && rm -f "$name.xx" "$TOPDIR/$noslash-$x.fail" |
77 | } && echo " ok" || echo " fail" | 84 | ) |
85 | case $? in | ||
86 | 0) echo " ok";; | ||
87 | 77) echo " skip (feature disabled)";; | ||
88 | *) echo " fail ($?)"; tret=1;; | ||
89 | esac | ||
78 | done | 90 | done |
91 | exit $tret | ||
79 | ) | 92 | ) |
80 | } | 93 | } |
81 | 94 | ||
@@ -103,4 +116,4 @@ else | |||
103 | done | 116 | done |
104 | fi | 117 | fi |
105 | 118 | ||
106 | exit ${ret} | 119 | exit $ret |
diff --git a/shell/hush_test/run-all b/shell/hush_test/run-all index 3fbc7c531..7345fee43 100755 --- a/shell/hush_test/run-all +++ b/shell/hush_test/run-all | |||
@@ -29,7 +29,7 @@ fi | |||
29 | 29 | ||
30 | eval $(sed -e '/^#/d' -e '/^$/d' -e 's:^:export :' .config) | 30 | eval $(sed -e '/^#/d' -e '/^$/d' -e 's:^:export :' .config) |
31 | 31 | ||
32 | PATH="`pwd`:$PATH" # for hush and recho/zecho/printenv | 32 | PATH="`pwd`:$PATH" # for hush |
33 | export PATH | 33 | export PATH |
34 | 34 | ||
35 | THIS_SH="`pwd`/hush" | 35 | THIS_SH="`pwd`/hush" |
@@ -67,7 +67,8 @@ do_test() | |||
67 | # echo Running test: "$x" | 67 | # echo Running test: "$x" |
68 | echo -n "$1/$x:" | 68 | echo -n "$1/$x:" |
69 | ( | 69 | ( |
70 | "$THIS_SH" "./$x" >"$name.xx" 2>&1 | 70 | "$THIS_SH" "./$x" 2>&1 | \ |
71 | grep -va "^hush: using fallback suid method$" >"$name.xx" | ||
71 | r=$? | 72 | r=$? |
72 | # filter C library differences | 73 | # filter C library differences |
73 | sed -i \ | 74 | sed -i \ |
@@ -83,7 +84,7 @@ do_test() | |||
83 | *) echo " fail ($?)"; tret=1;; | 84 | *) echo " fail ($?)"; tret=1;; |
84 | esac | 85 | esac |
85 | done | 86 | done |
86 | exit ${tret} | 87 | exit $tret |
87 | ) | 88 | ) |
88 | } | 89 | } |
89 | 90 | ||
@@ -95,6 +96,9 @@ ret=0 | |||
95 | if [ $# -lt 1 ]; then | 96 | if [ $# -lt 1 ]; then |
96 | # All sub directories | 97 | # All sub directories |
97 | modules=`ls -d hush-*` | 98 | modules=`ls -d hush-*` |
99 | # If you want to test hush against ash testsuite | ||
100 | # (have to copy ash_test dir to current dir first): | ||
101 | #modules=`ls -d hush-* ash_test/ash-*` | ||
98 | 102 | ||
99 | for module in $modules; do | 103 | for module in $modules; do |
100 | do_test $module || ret=1 | 104 | do_test $module || ret=1 |
@@ -108,4 +112,4 @@ else | |||
108 | done | 112 | done |
109 | fi | 113 | fi |
110 | 114 | ||
111 | exit ${ret} | 115 | exit $ret |