blob: 02f6d2a9dbf5ed1301195e216a6c7ecb1ffc7592 [file] [log] [blame]
Denis Vlasenko1c660b42007-03-05 00:27:50 +00001#!/bin/sh
2
3test -x ash || { echo "No ./ash?!"; exit; }
4test -x printenv || gcc -O2 -o printenv printenv.c || exit $?
5test -x recho || gcc -O2 -o recho recho.c || exit $?
6test -x zecho || gcc -O2 -o zecho zecho.c || exit $?
7
8PATH="$PWD:$PATH" # for ash and recho/zecho/printenv
9export PATH
10
11THIS_SH="$PWD/ash"
12export THIS_SH
13
14do_test()
15{
16 test -d "$1" || return 0
17 (
18 cd "$1" || { echo "cannot cd $1!"; exit 1; }
19 for x in run-*; do
20 test -f "$x" || continue
Denis Vlasenkoc86e0522007-03-20 11:30:28 +000021 case "$x" in
Denis Vlasenko1c660b42007-03-05 00:27:50 +000022 "$0"|run-minimal|run-gprof) ;;
23 *.orig|*~) ;;
24 #*) echo $x ; sh $x ;;
25 *)
26 sh "$x" >"../$1-$x.fail" 2>&1 && \
27 { echo "$1/$x: ok"; rm "../$1-$x.fail"; } || echo "$1/$x: fail";
28 ;;
29 esac
30 done
31 # Many bash run-XXX scripts just do this,
32 # no point in duplication it all over the place
33 for x in *.tests; do
34 test -x "$x" || continue
35 name="${x%%.tests}"
36 test -f "$name.right" || continue
37 {
38 "$THIS_SH" "./$x" >"$name.xx" 2>&1
39 diff -u "$name.xx" "$name.right" >"../$1-$x.fail" && rm -f "$name.xx" "../$1-$x.fail"
40 } && echo "$1/$x: ok" || echo "$1/$x: fail"
41 done
42 )
43}
44
45# main part of this script
46# Usage: run-all [directories]
47
48if [ $# -lt 1 ]; then
49 # All sub directories
50 modules=`ls -d ash-*`
51
52 for module in $modules; do
53 do_test $module
54 done
55else
56 while [ $# -ge 1 ]; do
57 if [ -d $1 ]; then
58 do_test $1
59 fi
60 shift
61 done
62fi