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