1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
#! /bin/sh
# TOM test run script.
# Written by Pieter J. Schoenmakers <tiggr@gerbil.org>
#
# Copyright (C) 1996-1999 Pieter J. Schoenmakers.
#
# This file is part of TOM. TOM is distributed under the terms of the
# TOM License, a copy of which can be found in the TOM distribution; see
# the file LICENSE.
#
# $Id: run,v 1.24 1999/08/20 14:44:27 tiggr Exp $
passed () {
echo $test passed 2>&1 | tee -a $test.log
rm $test $test.out.run 2>&1 | tee -a $test.log
}
tests=
while test $# -gt 0; do
case "$1" in
-s)
shift; srcdir=$1;
;;
-*)
echo "$0: unknown option: $1" >& 2
exit 2
;;
*)
tests="$tests $1"
;;
esac
shift
done
if test "$tests" = ""; then
echo "usage: $0 [-s srcdir] test_nr ..." >& 2
exit 2
fi
if test -z "$srcdir"; then srcdir=.; fi
# Point to the character encoding resource directory, for when we have not
# yet been fully installed.
TOM_OPTIONS=":cc-pre :cc-post :rt-resource-dir ${srcdir}/../examples/unicode/tables"
DEPS="../C/libC.la ../too/libtoo.la ../tom/libtom.la ../trt/libtrt.la"
LIBS="$DEPS $LIBS"
for t in $tests; do
test=test$t
if test ! -f $srcdir/$test.t; then
echo "$0: $srcdir/$test.t does not exist" >& 2
continue
fi
cat > Makefile$t << __EOF__
VPATH=.:$srcdir
srcdir=$srcdir
UNIT=$test
UNIT_PATH=..
USES_UNITS=tom too C
TOM_SRC=$test
tomdir=..
include $srcdir/\$(tomdir)/GNUmakefile.in-situ
include \$(TOM_MAKEFILES_DIR)/GNUmakefile.bin
__EOF__
rm -f $test.log
if ${MAKE-make} -f Makefile$t > $test.log 2>&1; then
:
else
echo $test build failed 2>&1 | tee -a $test.log
continue
fi
if test -f run$test; then
cmd="./run$test $TOM_OPTIONS"
else
cmd="./$test $TOM_OPTIONS"
if test -f $test.in; then cmd="$cmd < $test.in"; fi
fi
if eval $cmd > $test.out.run 2>&1; then
if test -f $srcdir/$test.out; then
if cmp $srcdir/$test.out $test.out.run; then
passed
else
echo $test differing output 2>&1 | tee -a $test.log
fi
elif test -s $test.out.run; then
echo $test has output 2>&1 | tee -a $test.log
else
passed
fi
else
echo $test failed with $? 2>&1 | tee -a $test.log
fi
done
|