4 cleanups="cat OUTPUT/console.txt "
6 for fixup in `echo $REF_CONSOLE_FIXUPS`
8 if [ -f $FIXUPDIR/$fixup ]
11 *.sed) cleanups="$cleanups | sed -f $FIXUPDIR/$fixup";;
12 *.pl) cleanups="$cleanups | perl $FIXUPDIR/$fixup";;
13 *.awk) cleanups="$cleanups | awk -f $FIXUPDIR/$fixup";;
14 *) echo Unknown fixup type: $fixup;;
19 rm -f OUTPUT/console-fixed.txt OUTPUT/console.diff
20 $CONSOLEDIFFDEBUG && echo Cleanups is $cleanups
21 eval $cleanups >OUTPUT/console-fixed.txt
22 if diff -u -w -b -B $REF_CONSOLE_OUTPUT OUTPUT/console-fixed.txt >OUTPUT/console.diff
24 echo "Console output matched"
26 echo "Console output differed"
32 if [ -z "$REF_CONSOLE_OUTPUT" ] && [ -n "$REFCONSOLEOUTPUT" ]
34 REF_CONSOLE_OUTPUT=$REFCONSOLEOUTPUT
37 if [ -z "$REF_CONSOLE_FIXUPS" ] && [ -n "$REFCONSOLEFIXUPS" ]
39 REF_CONSOLE_FIXUPS=$REFCONSOLEFIXUPS
42 if [ -z "$REF_PUB_OUTPUT" ] && [ -n "$REFPUBOUTPUT" ]
44 REF_PUB_OUTPUT=$REFPUBOUTPUT
47 if [ -z "$REF_PRIV_OUTPUT" ] && [ -n "$REFPRIVOUTPUT" ]
49 REF_PRIV_OUTPUT=$REFPRIVOUTPUT
53 # this is called to set additional variables that depend upon testparams.sh
55 HOSTSTART=$POOLSPACE/$TESTHOST/start.sh
61 # record results records the status of each test in
62 # $REGRESSRESULTS/$testname/status
64 # If the status is negative, then the "OUTPUT" directory of the test is
65 # copied to $REGRESSRESULTS/$testname/OUTPUT as well.
67 # The file $testname/description.txt if it exists is copied as well.
69 # If $REGRESSRESULTS is not set, then nothing is done.
71 # See testing/utils/regress-summarizeresults.pl for a tool to build a nice
72 # report from these files.
74 # See testing/utils/regress-nightly.sh and regress-stage2.sh for code
75 # that sets up $REGRESSRESULTS.
77 # usage: recordresults testname testtype status
83 if [ -n "$REGRESSRESULTS" ]
85 mkdir -p $REGRESSRESULTS/$testname
87 # note that 0/1 is shell sense.
92 false) sucesss=false;;
93 succeed) success=true;;
97 *) echo 'functions.sh:recordresults()' Bad value for success: $success >&2;
101 echo $success >$REGRESSRESULTS/$testname/status
103 if [ -f $testname/description.txt ]
105 cp $testname/description.txt $REGRESSRESULTS/$testname
108 if [ -n "$TEST_PURPOSE" ]
110 case $TEST_PURPOSE in
111 regress) echo ${TEST_PROB_REPORT} >$REGRESSRESULTS/$testname/regress.txt;;
112 goal) echo ${TEST_GOAL_ITEM} >$REGRESSRESULTS/$testname/goal.txt;;
113 exploit) echo ${TEST_EXPLOIT_URL} >$REGRESSRESULTS/$testname/exploit.txt;;
121 mkdir -p $REGRESSRESULTS/$testname/OUTPUT
122 tar cf - $testname/OUTPUT | (cd $REGRESSRESULTS && tar xf - )
127 # The following variables need to be set before calling the tests
129 # TESTNAME - the name of the test
130 # SCRIPT - a script to load on the console
131 # PRIVINPUT - a pcap file to feed on private side
132 # PUBINPUT - a pcap file to feed on the public side
134 # If set, then the public and private packet output will be captured,
135 # turned into ASCII with tcpdump, and diff'ed against these files.
136 # REF_PRIVO_UTPUT - for private side
137 # REF_PUB_OUTPUT - for public side
138 # TCPDUMPARGS - extra args for TCPDUMP.
140 # If set, then the console output will be diff'ed against this file:
143 # The console output may need to be sanitized. The list of fixups from
144 # REF_CONSOLE_FIXUPS will be appled from "fixups". The extension is used to
145 # determine what program to use.
147 # Some additional options to control the network emulator
148 # EXITONEMPTY=--exitonempty - if pcap file end should signal end of test
149 # ARPREPLY=--arpreply - if ARPs should be answered
165 if [ -n "$PRIVINPUT" ]
167 NJARGS="$NJARGS --playprivate $PRIVINPUT"
170 if [ -n "$PUBINPUT" ]
172 NJARGS="$NJARGS --playpublic $PUBINPUT"
175 if [ -n "$REF_PRIV_OUTPUT" ]
177 PRIVOUTPUT=`basename $REF_PRIV_OUTPUT .txt `
178 NJARGS="$NJARGS --recordprivate OUTPUT/$PRIVOUTPUT.pcap"
181 if [ -n "$REF_PUB_OUTPUT" ]
183 PUBOUTPUT=`basename $REF_PUB_OUTPUT .txt`
184 NJARGS="$NJARGS --recordpublic OUTPUT/$PUBOUTPUT.pcap"
187 if [ -n "$NETJIGARGS" ]
189 NJARGS="$NJARGS $NETJIGARGS"
192 rm -f OUTPUT/console.txt
193 $NETJIGDEBUG && echo $NJ --tcpdump $ARPREPLY $EXITONEMPTY $NJARGS --startup "expect -f $UTILS/host-test.tcl $HOSTSTART ${SCRIPT} "
194 $NJ --tcpdump $ARPREPLY $EXITONEMPTY `eval echo $NJARGS` --startup "expect -f $UTILS/host-test.tcl $HOSTSTART ${SCRIPT} >OUTPUT/console.txt"
196 uml_mconsole $TESTHOST halt
198 if [ -z "$REF_PRIV_FILTER" ]
203 if [ -n "$PRIVOUTPUT" ]
205 rm -f OUTPUT/$PRIVOUTPUT.txt
206 echo $TCPDUMP -t $TCPDUMPFLAGS -r OUTPUT/$PRIVOUTPUT.pcap '>'OUTPUT/$PRIVOUTPUT.txt
207 eval $TCPDUMP -t $TCPDUMPFLAGS -r OUTPUT/$PRIVOUTPUT.pcap | $REF_PRIV_FILTER >OUTPUT/$PRIVOUTPUT.txt
209 rm -f OUTPUT/$PRIVOUTPUT.diff
210 if diff -u -w -b -B $REF_PRIV_OUTPUT OUTPUT/$PRIVOUTPUT.txt >OUTPUT/$PRIVOUTPUT.diff
212 echo "Private side output matched"
214 echo "Private side output failed"
220 if [ -z "$REF_PUB_FILTER" ]
225 if [ -n "$PUBOUTPUT" ]
227 rm -f OUTPUT/$PUBOUTPUT.txt
228 echo $TCPDUMP -t $TCPDUMPFLAGS -r OUTPUT/$PUBOUTPUT.pcap '>'OUTPUT/$PUBOUTPUT.txt
229 eval $TCPDUMP -t $TCPDUMPFLAGS -r OUTPUT/$PUBOUTPUT.pcap | $REF_PUB_FILTER >|OUTPUT/$PUBOUTPUT.txt
231 rm -f OUTPUT/$PUBOUTPUT.diff
232 if diff -u -w -b -B $REF_PUB_OUTPUT OUTPUT/$PUBOUTPUT.txt >OUTPUT/$PUBOUTPUT.diff
234 echo "Public side output matched"
236 echo "Public side output failed"
241 if [ -n "$REF_CONSOLE_OUTPUT" ]
260 rm -f OUTPUT/console.txt
261 expect -f $UTILS/host-test.tcl $HOSTSTART ${SCRIPT} >OUTPUT/console.txt
263 if [ -n "$REFCONSOLEOUTPUT" ]
280 echo '******* KLIPS RUNNING' $testdir '*******'
282 if [ ! -r $testdir/testparams.sh ]
284 echo ' ' No configuration
287 ( cd $testdir && . ./testparams.sh && netjigtest )
289 recordresults $testdir $testtype $stat
292 echo '******* PASSED '$testdir' ********'
294 echo '******* FAILED '$testdir' ********'
302 echo '******* KERN RUNNING' $testdir '*******'
304 if [ ! -r $testdir/testparams.sh ]
306 echo ' ' No configuration
309 ( cd $testdir && . ./testparams.sh && umltest )
311 recordresults $testdir $testtype $stat
314 echo '******* PASSED '$testdir' ********'
316 echo '******* FAILED '$testdir' ********'
324 echo '******* NOT RUNNING' $testdir '*******'