blob: 43bc9fc0be192538a1eec918cbf3fdecf5b40e6b [file] [log] [blame]
Denis Vlasenkoa43dba72008-03-02 19:57:53 +00001#!/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