1 : |
jhr |
1200 |
#!/bin/ksh
|
2 : |
|
|
#
|
3 : |
|
|
# A script for running a single Diderot regression test
|
4 : |
|
|
#
|
5 : |
|
|
# usage:
|
6 : |
|
|
# scripts/run-one.sh test [diderotc] [flags]
|
7 : |
|
|
#
|
8 : |
|
|
# @configure_input@
|
9 : |
|
|
#
|
10 : |
|
|
|
11 : |
|
|
# set up the path so that we can find unu
|
12 : |
|
|
#
|
13 : |
|
|
PATH=/bin:/usr/bin:@TEEM_DIR@/bin
|
14 : |
|
|
|
15 : |
|
|
# this script should be run from the rtest directory
|
16 : |
|
|
#
|
17 : |
|
|
HERE=$(pwd)
|
18 : |
|
|
if [ ! -d $HERE/tests ] ; then
|
19 : |
|
|
echo "run script from rtest directory"
|
20 : |
|
|
exit 1
|
21 : |
|
|
fi
|
22 : |
|
|
|
23 : |
|
|
# get the name of the test to run
|
24 : |
|
|
#
|
25 : |
|
|
if (( $# >= 1 )) ; then
|
26 : |
|
|
RTEST=$1
|
27 : |
|
|
shift
|
28 : |
|
|
if [ ! -d tests/$RTEST ] ; then
|
29 : |
|
|
echo "$RTEST is not a valid regression-test name"
|
30 : |
|
|
exit 1
|
31 : |
|
|
fi
|
32 : |
|
|
else
|
33 : |
|
|
echo "usage: scripts/run-one.sh test [diderotc] [flags]"
|
34 : |
|
|
exit 1
|
35 : |
|
|
fi
|
36 : |
|
|
|
37 : |
|
|
# process the rest of the command-line arguments
|
38 : |
|
|
#
|
39 : |
|
|
DIDEROTC="@DIDEROT_BINDIR@/diderotc"
|
40 : |
|
|
DIDEROTC_FLAGS=""
|
41 : |
|
|
while [ $# -ne 0 ] ; do
|
42 : |
|
|
case $1 in
|
43 : |
|
|
-*) DIDEROTC_FLAGS="$DIDEROTC_FLAGS $1" ;;
|
44 : |
|
|
*) if [ -x $1 ] ; then
|
45 : |
|
|
case $1 in
|
46 : |
|
|
/*) DIDEROTC=$1 ;; # absolute path
|
47 : |
|
|
*) DIDEROTC=$HERE/$1 ;; #relative path
|
48 : |
|
|
esac
|
49 : |
|
|
else
|
50 : |
|
|
echo "unrecognized argument"
|
51 : |
|
|
exit 1
|
52 : |
|
|
fi
|
53 : |
|
|
;;
|
54 : |
|
|
esac
|
55 : |
|
|
shift
|
56 : |
|
|
done
|
57 : |
|
|
|
58 : |
|
|
DATE=$( date +"%F-%H-%M-%S" )
|
59 : |
|
|
LOG=$HERE/log-$RTEST.$DATE
|
60 : |
|
|
REPORT=$HERE/report-$RTEST.$DATE
|
61 : |
|
|
|
62 : |
|
|
echo "testing $DIDEROTC" > $REPORT
|
63 : |
|
|
( cd tests/$RTEST;
|
64 : |
|
|
echo "********** $RTEST **********" >> $LOG
|
65 : |
|
|
echo -n "checking $RTEST ... " >> $REPORT
|
66 : |
|
|
echo "$DIDEROTC $DIDEROTC_FLAGS $RTEST.diderot" >> $LOG
|
67 : |
|
|
$DIDEROTC $DIDEROTC_FLAGS $RTEST.diderot 2>> $LOG 1>> $LOG
|
68 : |
|
|
if [ "$?" -eq "0" ] ; then
|
69 : |
|
|
echo -n "compile succeeded ... " >> $REPORT
|
70 : |
|
|
echo "./$RTEST" >> $LOG
|
71 : |
|
|
./$RTEST 2>> $LOG 1>> $LOG
|
72 : |
|
|
if [ "$?" -eq "0" ] ; then
|
73 : |
|
|
echo -n "execution succeeded ... " >> $REPORT
|
74 : |
|
|
result=$(./assess.sh)
|
75 : |
|
|
if (($result < 1.0)) ; then
|
76 : |
|
|
echo "result is good ($result)" >> $REPORT
|
77 : |
|
|
echo "ok" >> $LOG
|
78 : |
|
|
echo "$RTEST is okay"
|
79 : |
jhr |
1301 |
rm -f $RTEST.c $RTEST.o $RTEST $RTEST.log $RTEST.txt
|
80 : |
jhr |
1200 |
else
|
81 : |
|
|
echo "result is bad ($result)" >> $REPORT
|
82 : |
|
|
echo "$RTEST failed"
|
83 : |
|
|
fi
|
84 : |
|
|
else
|
85 : |
|
|
echo "execution failed" >> $REPORT
|
86 : |
|
|
echo "$RTEST failed"
|
87 : |
|
|
fi
|
88 : |
|
|
else
|
89 : |
|
|
echo "compile failed" >> $REPORT
|
90 : |
|
|
echo "$RTEST failed"
|
91 : |
|
|
fi
|
92 : |
|
|
echo "**********" >> $LOG
|
93 : |
|
|
)
|
94 : |
|
|
echo "complete report at $REPORT"
|