Debian Codegraph @

bin/ktest-all

raw symbols SCIP
1 #! /bin/shscip-shell filesystem . . `/bin/sh`.
2 # script to run all tests in test-suite.tcl
3 #
4 # Copyright (c) 1995 The Regents of the University of California.
5 # All rights reserved.
6 #
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
9 # are met:
10 # 1. Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
15 # 3. All advertising materials mentioning features or use of this software
16 # must display the following acknowledgement:
17 # This product includes software developed by the Network Research
18 # Group at Lawrence Berkeley National Laboratory.
19 # 4. Neither the name of the University nor of the Laboratory may be used
20 # to endorse or promote products derived from this software without
21 # specific prior written permission.
22 #
23 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 # SUCH DAMAGE.
34 #
35 # @(#) $Header: /cvsroot/nsnam/ns-2/bin/ktest-all,v 1.6 1997/09/11 00:50:51 heideman Exp $
36 #
37 # This script was written and contributed by Matt Mathis ([email protected])
38 # This script was later hacked extensively by Kannan to build the rtglib
39 # test suites. The script has been renamed to reflet this extensive hacking.
40 # -- Kannan ([email protected]) Mon Apr 28 10:44:11 PDT 1997
41 #
42 PROG=`basenamescip-shell system . . basename. $0`
43
44 # Compress raw trace files for storage.
45 COMPRESSP=:
46
47 if [scip-shell system . . `[`. $# -ge 1 ] ; then
48 TESTSUITE=tcl/test/test-suite-$1
49 shift
50 else
51 TESTSUITE=tcl/test/test-suite-routed
52 fi
53
54 old_tests=`perlscip-shell system . . perl. -ane 'm.^proc test_. &&
55 print substr($F[1], index($F[1], "_")+1), " "' $TESTSUITE.tcl`
56 new_tests=`perlscip-shell system . . perl. -ane 'm.^Class Test/. &&
57 print substr($F[1], index($F[1], "/")+1), " "' $TESTSUITE.tcl`
58 top=`perlscip-shell system . . perl. -ane 'm.^Class Topology/. &&
59 print substr($F[1], index($F[1], "/")+1), " "' tcl/test/topologies.tcl`
60
61 if [scip-shell system . . `[`. -n "$old_tests" -a -n "$new_tests" ] ; then
62 echoscip-shell system . . echo. "$PROG: warning $TESTSUITE.tcl mixes old and new test suites" 2>&1
63 echoscip-shell system . . echo. "$PROG: ignore old tests" 2>&1
64 old_tests=
65 fi
66
67 if [scip-shell system . . `[`. $# -ge 1 ] ; then
68 tests="$@"
69 else
70 tests="$old_tests $new_tests"
71 fi
72 topologies=${top:-X}
73
74 # Note that the telnet test includes random source behavior - its output
75 # is not currently repeatable from run to run
76
77 if [scip-shell system . . `[`. ! -d test-output-raw ]; then
78 mkdirscip-shell system . . mkdir. test-output-raw
79 fi
80
81 comparescip-shell shell shell-project 0.0.0 compare().() {
82 if [scip-shell system . . `[`. -f all.tr ]
83 then
84 file=`perlscip-shell system . . perl. -ane '$F[2] =~ s/test_// ; $F[2] =~ s/_/-/g; print $F[2]; exit' out.tr`
85 # if echo $file | grep : >/dev/null ; then
86 # file=`echo $file | sed 's/^[a-zA-Z0-9_]*:\(.*\)/'$1':\1/'`
87 # fi
88 if [scip-shell system . . `[`. -f test-output-raw/$file.gz ]
89 then
90 gunzipscip-shell system . . gunzip. test-output-raw/$file.gz
91 fi
92 COMPRESS=$COMPRESSP
93 if [scip-shell system . . `[`. ! -f test-output-raw/$file ]
94 then
95 echoscip-shell system . . echo. saving output to $file for future validation
96 cpscip-shell system . . cp. all.tr test-output-raw/$file
97 else
98 cmpscip-shell system . . cmp. -s all.tr test-output-raw/$file
99 if [scip-shell system . . `[`. $? = 0 ]
100 then
101 echoscip-shell system . . echo. Test output agrees with reference output "($file)"
102 else
103 echoscip-shell system . . echo. Test output differs from reference output "($file)"
104 DIFFCMD="diff test-output-raw/$file.test test-output-raw/$file"
105 if [scip-shell system . . `[`. `diffscip-shell system . . diff. test-output-raw/$file all.tr | wcscip-shell system . . wc. -l` -le 10 ]
106 then
107 echoscip-shell system . . echo. "output of $DIFFCMD"
108 diffscip-shell system . . diff. -c all.tr test-output-raw/$file
109 fi
110 cpscip-shell system . . cp. all.tr test-output-raw/$file.test
111 echoscip-shell system . . echo. "Diagnose with: $DIFFCMD"
112 COMPRESS=false
113 fi
114 fi
115 if [scip-shell system . . `[`. -n "$DISPLAY" ] ; then
116 raw2xg -s 0.01 -m 90 out.tr | xgraph &
117 sleepscip-shell system . . sleep. 5
118 else
119 if [scip-shell system . . `[`. ! -d ps-files ] ; then
120 mkdirscip-shell system . . mkdir. ps-files
121 fi
122 if raw2gp -g -a -s 0.01 -m 90 out.tr | gnuplot ; then
123 egrepscip-shell system . . egrep. BoundingBox $file.ps > ps-files/$file.bb
124 gzipscip-shell system . . gzip. $file.ps
125 mvscip-shell system . . mv. $file.ps.gz ps-files
126 rmscip-shell system . . rm. -f packets drops link-fails link-recovery
127 fi
128 fi
129 if ${COMPRESS} ; then
130 gzipscip-shell system . . gzip. test-output-raw/$file
131 fi
132 else
133 echoscip-shell system . . echo. "Test $1 did not run over topology $2. Continuing..."
134 fi
135 }
136
137 #
138
139 echoscip-shell system . . echo. $tests
140 for t in $tests; do
141 for p in $topologies; do
142 echoscip-shell system . . echo.
143 echoscip-shell system . . echo. -n Running test: ./ns $TESTSUITE.tcl $t
144 case $p in
145 X) p=""; echoscip-shell system . . echo. "" ;;
146 *) echoscip-shell system . . echo. " $p" ;;
147 esac
148
149 # Beware that xgraph is run on temp.rands asynchronously, if it
150 # is slow to launch, you may get an incorrect graph
151 rmscip-shell system . . rm. -f all.tr out.tr core
152 ./ns $TESTSUITE.tcl $t $p && comparescip-shell shell shell-project 0.0.0 compare(). $t $p
153 if [scip-shell system . . `[`. -f core ] ; then
154 if [scip-shell system . . `[`. ! -d crash ] ; then
155 mkdirscip-shell system . . mkdir. crash
156 fi
157 mvscip-shell system . . mv. core crash/$t:$p.core
158 echoscip-shell system . . echo. Core dump moved to crash/$t:$p.core
159 fi
160 done
161 if [scip-shell system . . `[`. -n "$DISPLAY" ] ; then
162 echoscip-shell system . . echo. 'next?'
163 read answer
164 fi
165 done