RunTest.sh
963 Bytes
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
#!/bin/sh
usage="$0 <ctm validation script location> [-v]"
if [ "$#" -lt '1' ]; then
echo Script missing
echo $usage
exit 1
fi
ctm=$1
if [ ! -x "$ctm" ]; then
echo Script not executable
echo $usage
exit 1
fi
if [ "$2" = '-v' ] ; then
verbose=true
else
verbose=false
fi
for file in test*.ctm ; do
if [ -f "$file.toskip" ] ; then
echo "(skipping) Testing $file..."
else
echo "Testing $file..."
base=`echo $file | perl -pe 's/.ctm//'`
log="$base.log.saved"
tmp="$base.log.tmp"
if [ ! -f "$log" ] ; then
perl $ctm -i $file > $log
fi
perl $ctm -i $file > $tmp
diff_status=`diff $log $tmp | wc -l`
if [ $diff_status -ne 0 ] ; then
echo " Output log differs from saved log"
if [ $verbose = true ] ; then
diff $log $tmp | sed 's/^/ /'
fi
# exit with error status
exit 1
else
rm $tmp
fi
fi
done
# exit with ok status
exit 0