Debian Codegraph @

dtest

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 TMP=`mktempscip-shell system . . mktemp. bmXXXXXX`
4
5 # Run simple unit tests first.
6 typeset -i count=0
7 echoscip-shell system . . echo. -n 'Running unit tests:'
8 for t in test_*
9 do
10 if [scip-shell system . . `[`. -x "$t" ]
11 then
12 errmsg=`./exrun "$t" 2>&1`
13 errno=$?
14 if [scip-shell system . . `[`. "$errno" = 0 ]
15 then
16 count=count+1
17 else
18 rmscip-shell system . . rm. -f $TMP
19 echoscip-shell system . . echo. " $t FAILED ($errno)"
20 echoscip-shell system . . echo.
21 echoscip-shell system . . echo. "$errmsg"
22 exit $?
23 fi
24 fi
25 done
26 echoscip-shell system . . echo. " $count tests succeeded"
27 echoscip-shell system . . echo. 'All unit tests passed' >> $TMP
28
29 # Assume AUTO_INCREMENT id column in images table will get 1 in
30 # load_jpeg call below, since we reset the DB before doing it.
31 export QUERY_STRING=id=1
32
33 # Now run examples to test high-level behavior. The repeated use of
34 # resetdb is intentional! It's run after each example that changes
35 # the database in a way that will cause a subsequent example to fail
36 # because data it expects isn't present.
37 echoscip-shell system . . echo. -n 'Running examples:'
38 for t in \
39 resetdb simple[0-9] store_if for_each multiquery tquery1 \
40 resetdb tquery[2-9] \
41 resetdb ssqls[0-9] \
42 load_jpeg cgi_jpeg
43 do
44 if [scip-shell system . . `[`. -x $t ]
45 then
46 if [scip-shell system . . `[`. "$t" = "resetdb" ]
47 then
48 echoscip-shell system . . echo.
49 echoscip-shell system . . echo. -n " "
50 fi
51
52 echoscip-shell system . . echo. -n "$t "
53 echoscip-shell system . . echo. "---------------- BEGIN $t OUTPUT ----------------" >> $TMP
54 if ! ./exrun $t -D $* >> $TMP
55 then
56 echoscip-shell system . . echo.
57 echoscip-shell system . . echo. 'TESTING ABORTED.'
58 rmscip-shell system . . rm. -f $TMP
59 exit $?
60 fi
61 echoscip-shell system . . echo. "================ END $t OUTPUT ================" >> $TMP
62 echoscip-shell system . . echo. >> $TMP
63 fi
64 done
65 echoscip-shell system . . echo.
66
67 # Test ssqlsxlat -o. Note that it suppresses stdout but keeps stderr
68 # so warnings about directives and line elements it doesn't understand
69 # aren't suppressed. We run the first pass's output back through
70 # ssqlsxlat to deal with comments, whitespace differences, line element
71 # ordering, boolean value and type canonicalization, and other niggly
72 # differences we really don't care about. diff -w isn't enough.
73 for f in {examples,test}/*.ssqls
74 do
75 echoscip-shell system . . echo. -n "Testing ssqlsxlat -i $f -o..."
76 echoscip-shell system . . echo. "--- BEGIN ssqlsxlat -i $f -o ERROR OUTPUT ---" >> $TMP
77 pass1=/tmp/dtest-ssxgv2-pass1-$bnf
78 pass2=/tmp/dtest-ssxgv2-pass2-$bnf
79 echoscip-shell system . . echo. -n "pass 1"
80 ./exrun ssqlsxlat -i $f -o $pass1 > /dev/nullscip-shell filesystem . . `/dev/null`. 2>> $TMP
81 echoscip-shell system . . echo. -n ", pass 2"
82 ./exrun ssqlsxlat -i $pass1 -o $pass2 > /dev/nullscip-shell filesystem . . `/dev/null`. 2>> $TMP
83 echoscip-shell system . . echo. -n ", diff"
84 diffscip-shell system . . diff. $pass1 $pass2 > /dev/nullscip-shell filesystem . . `/dev/null`. >> $TMP
85 echoscip-shell system . . echo. "==== END ssqlsxlat -i $f -o ERROR OUTPUT ====" >> $TMP
86 echoscip-shell system . . echo.
87 done
88
89 # Check for any changes
90 BFILE=bmark.txt
91 if [scip-shell system . . `[`. -f $BFILE ]
92 then
93 if diffscip-shell system . . diff. -u -w $BFILE $TMP
94 then
95 echoscip-shell system . . echo.
96 echoscip-shell system . . echo. 'All tests passed.'
97 fi
98 rmscip-shell system . . rm. -f $TMP
99 else
100 mvscip-shell system . . mv. $TMP $BFILE
101 chmodscip-shell system . . chmod. -w $BFILE
102 echoscip-shell system . . echo.
103 echoscip-shell system . . echo. 'BENCHMARK FILE REGENERATED.'
104 echoscip-shell system . . echo.
105 fi