blob: 8b0790601e612ed227a92d3de135f5429c07763c [file] [log] [blame]
apw6e551622006-04-04 08:50:53 +00001#!/bin/sh
2#
3# test -- run a client self test.
4#
5P="test"
6
apw18b9d332006-09-22 22:17:19 +00007fix=`/bin/pwd`
apw55533d22006-04-27 14:10:47 +00008fix=`dirname $fix`
9fix=`dirname $fix`
10
apw6e551622006-04-04 08:50:53 +000011me="../autotest"
12
apwbc2867d2006-04-06 18:21:16 +000013# XXX: the exit status that indicates a rerun ...
14rerun=5
15
apw6e551622006-04-04 08:50:53 +000016function runtests {
17 for i in \
18 "$@"
19 do
20 case "$i" in
apw96cdb7f2006-09-23 09:36:05 +000021 *-filter|*-out|*-tmp|*.state) continue ;;
apw6e551622006-04-04 08:50:53 +000022 esac
23
24 ##echo "*** $i ...."
25 {
26 "$me" "$i"
27 rc="$?"
28 echo "--SELFTEST-- exit $rc"
apwbc2867d2006-04-06 18:21:16 +000029 while [ "$rc" = "$rerun" ]; do
apwdf57da22006-04-27 14:11:50 +000030 "$me" --continue "$i"
apw6e551622006-04-04 08:50:53 +000031 rc="$?"
32 echo "--SELFTEST-- exit $rc"
33 done
mbligh4055ec02006-09-23 04:36:33 +000034 } 2>&1 | `dirname "$i"`/NNN-filter "$i" | \
35 sed -e "s@$fix@SRC@" -e "s@, line [0-9]*@, line N@" \
apw55533d22006-04-27 14:10:47 +000036 >"$i-tmp" 2>&1
apw6e551622006-04-04 08:50:53 +000037
38 if [ ! -f "$i-out" ]; then
39 echo "$P: WARNING: $i: no results for test"
40 cat "$i-tmp"
41
42 elif ! cmp "$i-out" "$i-tmp"; then
43 echo "$P: ERROR: $i: test failed"
apwc3240912006-09-22 22:19:05 +000044 diff -u "$i-out" "$i-tmp"
apw6e551622006-04-04 08:50:53 +000045
46 else
47 echo "$P: PASS: $i: test passed"
48 fi
49 done
50}
51
52# Run all of the tests.
53case "$1" in
apwdf57da22006-04-27 14:11:50 +000054clean) rm -rf tests/*-tmp tests/*.state ;;
apw6e551622006-04-04 08:50:53 +000055test) runtests tests/* ;;
mbligh4055ec02006-09-23 04:36:33 +000056*) runtests "$@" ;;
apw6e551622006-04-04 08:50:53 +000057esac