1 | # |
---|
2 | # Run the tests |
---|
3 | # |
---|
4 | |
---|
5 | tests="$args" |
---|
6 | if [ ! "$tests" ] |
---|
7 | then |
---|
8 | set -- `echo *.exe` |
---|
9 | tests="$*" |
---|
10 | fi |
---|
11 | |
---|
12 | [ -d $logdir ] || |
---|
13 | mkdir $logdir || fatal "could not create log directory ($logdir)" |
---|
14 | |
---|
15 | # where the tmp files go |
---|
16 | trap "test_exit" 1 2 3 13 14 15 |
---|
17 | |
---|
18 | for tfile in $tests |
---|
19 | do |
---|
20 | echo $tfile | grep "exe$" >/dev/null |
---|
21 | if [ $? -eq 0 ] ; then |
---|
22 | ext=.exe |
---|
23 | else |
---|
24 | ext=.ralf |
---|
25 | fi |
---|
26 | tname=`basename $tfile ${ext}` |
---|
27 | cpus="1" |
---|
28 | TEST_TYPE="single" |
---|
29 | |
---|
30 | case $tname in |
---|
31 | # size is no longer interactive. |
---|
32 | capture* | monitor* | termios* | fileio* | pppd*) |
---|
33 | warn "Skipping $tname; it is interactive" |
---|
34 | continue |
---|
35 | ;; |
---|
36 | *-node2*) |
---|
37 | warn "Skipping $tname; 'runtest' runs both nodes when for *-node1" |
---|
38 | continue;; |
---|
39 | *-node1*) |
---|
40 | warn "Running both nodes associated with $tname" |
---|
41 | variant=`echo $tname | sed 's/.*-node[12]//' | sed 's/\.exe//'` |
---|
42 | tname=`echo $tname | sed 's/-node.*//'` |
---|
43 | TEST_TYPE="mp" |
---|
44 | ;; |
---|
45 | minimum*|stackchk*|*fatal*|termio*) |
---|
46 | continue ;; |
---|
47 | esac |
---|
48 | |
---|
49 | if [ $TEST_TYPE = "mp" ] |
---|
50 | then |
---|
51 | cpus="1 2" |
---|
52 | |
---|
53 | logfile1=$logdir/${tname}_1${variant} |
---|
54 | logfile2=$logdir/${tname}_2${variant} |
---|
55 | infofile1=$logfile1.info |
---|
56 | infofile2=$logfile2.info |
---|
57 | |
---|
58 | rm -f ${logfile1} ${logfile2} |
---|
59 | |
---|
60 | date=`date` |
---|
61 | echo "Starting $tname at $date" |
---|
62 | |
---|
63 | # XXX -c ${instruction_limit} |
---|
64 | |
---|
65 | gen_device_tree ${tname}-node1${variant}${ext} >${TREE_FILE}_1 |
---|
66 | gen_device_tree ${tname}-node2${variant}${ext} >${TREE_FILE}_2 |
---|
67 | |
---|
68 | runone ${tname}-node1${variant}${ext} \ |
---|
69 | ${max_run_time} ${TREE_FILE}_1 | \ |
---|
70 | sed -e 's/^M//' -e '/^$/d' > ${logfile1} & |
---|
71 | runone ${tname}-node2${variant}${ext} \ |
---|
72 | ${max_run_time} ${TREE_FILE}_2 | \ |
---|
73 | sed -e 's/^M//' -e '/^$/d' > ${logfile2} & |
---|
74 | wait |
---|
75 | |
---|
76 | #rm -f ${TREE_FILE}_1 ${TREE_FILE}_2 |
---|
77 | fi |
---|
78 | |
---|
79 | if [ $TEST_TYPE = "single" ] |
---|
80 | then |
---|
81 | logfile=$logdir/${tname}_1 |
---|
82 | infofile=$logfile.info |
---|
83 | |
---|
84 | rm -f ${logfile}.tmp* |
---|
85 | |
---|
86 | date=`date` |
---|
87 | echo "Starting $tname at $date" |
---|
88 | |
---|
89 | # Spin off the simulator in the background |
---|
90 | # -c could be used to set an instruction limit |
---|
91 | gen_device_tree ${tfile} >${TREE_FILE} |
---|
92 | runone ${tfile} ${max_run_time} | \ |
---|
93 | sed -e 's/^M//' -e '/^$/d' > ${logfile} |
---|
94 | |
---|
95 | rm -f ${TREE_FILE} |
---|
96 | fi |
---|
97 | |
---|
98 | # Create the info files |
---|
99 | for cpu in $cpus |
---|
100 | do |
---|
101 | { |
---|
102 | echo "$date" |
---|
103 | echo "Test run on: `uname -n`" |
---|
104 | echo "Host Information:" |
---|
105 | echo `uname -a` |
---|
106 | echo |
---|
107 | |
---|
108 | cat ${logdir}/${tname}_${cpu} |
---|
109 | |
---|
110 | if [ "$ran_too_long" = "yes" ] |
---|
111 | then |
---|
112 | echo "Test did NOT finish normally; killed after $max_run_time seconds" |
---|
113 | fi |
---|
114 | |
---|
115 | echo |
---|
116 | date; |
---|
117 | } > ${logdir}/${tname}_${cpu}.info |
---|
118 | done |
---|
119 | |
---|
120 | if [ "$cpus" = "1" ] |
---|
121 | then |
---|
122 | mv ${infofile} $logdir/${tname}.info |
---|
123 | mv ${logfile} $logdir/${tname} |
---|
124 | fi |
---|
125 | |
---|
126 | done |
---|
127 | |
---|
128 | echo "Tests completed at " `date` |
---|
129 | test_exit 0 |
---|
130 | |
---|
131 | # Local Variables: *** |
---|
132 | # mode:ksh *** |
---|
133 | # End: *** |
---|
134 | |
---|