aboutsummaryrefslogtreecommitdiff
path: root/shell/msh_test/run-all
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-03-02 19:57:53 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-03-02 19:57:53 +0000
commita43dba76ea394d789de67c6322b51e1d65bdba3b (patch)
treec99cde48cb834d4310ec06b3d377783029103ae1 /shell/msh_test/run-all
parent444639cc2134d483bf0845416e9b6ce8935af795 (diff)
downloadbusybox-w32-a43dba76ea394d789de67c6322b51e1d65bdba3b.tar.gz
busybox-w32-a43dba76ea394d789de67c6322b51e1d65bdba3b.tar.bz2
busybox-w32-a43dba76ea394d789de67c6322b51e1d65bdba3b.zip
msh: create testsuite (based on hush one)
hush: add TODO (doesn't know ":" command)
Diffstat (limited to 'shell/msh_test/run-all')
-rwxr-xr-xshell/msh_test/run-all64
1 files changed, 64 insertions, 0 deletions
diff --git a/shell/msh_test/run-all b/shell/msh_test/run-all
new file mode 100755
index 000000000..43bc9fc0b
--- /dev/null
+++ b/shell/msh_test/run-all
@@ -0,0 +1,64 @@
1#!/bin/sh
2
3test -x msh || {
4 echo "No ./msh?! Perhaps you want to run 'ln -s ../../busybox msh'"
5 exit
6}
7
8PATH="$PWD:$PATH" # for msh
9export PATH
10
11THIS_SH="$PWD/msh"
12export THIS_SH
13
14do_test()
15{
16 test -d "$1" || return 0
17# echo Running tests in directory "$1"
18 (
19 cd "$1" || { echo "cannot cd $1!"; exit 1; }
20 for x in run-*; do
21 test -f "$x" || continue
22 case "$x" in
23 "$0"|run-minimal|run-gprof) ;;
24 *.orig|*~) ;;
25 #*) echo $x ; sh $x ;;
26 *)
27 sh "$x" >"../$1-$x.fail" 2>&1 && \
28 { echo "$1/$x: ok"; rm "../$1-$x.fail"; } || echo "$1/$x: fail";
29 ;;
30 esac
31 done
32 # Many bash run-XXX scripts just do this,
33 # no point in duplication it all over the place
34 for x in *.tests; do
35 test -x "$x" || continue
36 name="${x%%.tests}"
37 test -f "$name.right" || continue
38# echo Running test: "$name.right"
39 {
40 "$THIS_SH" "./$x" >"$name.xx" 2>&1
41 diff -u "$name.xx" "$name.right" >"../$1-$x.fail" && rm -f "$name.xx" "../$1-$x.fail"
42 } && echo "$1/$x: ok" || echo "$1/$x: fail"
43 done
44 )
45}
46
47# Main part of this script
48# Usage: run-all [directories]
49
50if [ $# -lt 1 ]; then
51 # All sub directories
52 modules=`ls -d msh-*`
53
54 for module in $modules; do
55 do_test $module
56 done
57else
58 while [ $# -ge 1 ]; do
59 if [ -d $1 ]; then
60 do_test $1
61 fi
62 shift
63 done
64fi