source: rtems/c/src/lib/libbsp/sparc/erc32/tools/runtest.in @ b3a6713

Last change on this file since b3a6713 was b3a6713, checked in by Joel Sherrill <joel.sherrill@…>, on 08/16/01 at 21:36:15

2001-08-16 Joel Sherrill <joel@…>

  • src/mqueuesendsupp.c: Account for possibly blocking during the core send operation.

2001-08-16 Joel Sherrill <joel@…>

  • src/msgqsubmit.c: Add a comment indicating that we do not have to account for possibly blocking during the core send operation because Classic API message queue send is always non-blocking.

2001-08-16 Joel Sherrill <joel@…>

  • include/rtems/score/coremsg.h, src/coremsgsubmit.c: Add a new return status to account for blocking sends. Otherwise, the caller will think that the returned message status will have the ultimate results of the operation. If the send times out, the final status will be in the return_code of the thread.

2001-08-16 Joel Sherrill <joel@…>

  • src/coremutexsurrender.c: Use holder thread not executing thread because even though they may and often are the same it is not guaranteed unless the proper attribute is set.

2001-08-16 Joel Sherrill <joel@…>

  • startup/linkcmds: Modified to work better with gcc 2.8.1 and gnat 3.13p.

2001-08-16 Joel Sherrill <joel@…>

  • tools/runtest.in: Recognize debug variant of monitor test.

2001-08-16 Joel Sherrill <joel@…>

  • sp13/sp13.scn: Id in screen had wrong class field value.
  • sp13/system.h: Account for message buffer memory.
  • sp13/task2.c: Remove unnecessary check for failure.

2001-08-16 Joel Sherrill <joel@…>

  • sp20/system.h: Account for extra task stacks properly.

2001-08-16 Joel Sherrill <joel@…>

  • include/tmacros.h: Attempt to print errno as further information.
  • Property mode set to 100644
File size: 6.4 KB
Line 
1#!@KSH@ -p
2#
3#  $Id$
4#
5# Run rtems tests on the hppa simulator
6# This program generates a simulator script to run each test
7# Typically the test is then run, although it can be generated
8# and left as a file using -s
9#
10
11# progname=`basename $0`
12progname=${0##*/}        # fast basename hack for ksh, bash
13
14USAGE=\
15"usage: $progname [ -opts ] test [ test ... ]
16        -o options  -- specify options to be passed to simulator
17        -v          -- verbose
18        -s          -- generate script file (as 'test'.ss) and exit
19        -l logdir   -- specify log directory (default is 'logdir')
20
21  Specify test as 'test' or 'test.exe'.
22  All multiprocessing tests *must* be specified simply as 'mp01', etc.
23"
24
25# export everything
26set -a
27
28#   log an error to stderr
29prerr()
30{
31    echo "$*" >&2
32}
33
34fatal() {
35    [ "$1" ] && prerr $*
36    prerr "$USAGE"
37    exit 1
38}
39
40warn() {
41    [ "$1" ] && prerr $*
42}
43
44# print args, 1 per line
45ml_echo()
46{
47    for l
48    do
49       echo "$l"
50    done
51}
52
53# run at normal and signalled exit
54test_exit()
55{
56    exit_code=$1
57
58    rm -f ${statfile}* ${scriptfile}* ${logfile}.tmp*
59    [ "$sim_pid" ] && kill -9 $sim_pid
60
61    exit $exit_code
62}
63
64#
65# process the options
66#
67# defaults for getopt vars
68#
69# max_run_time is defaulted to 5 minutes
70#
71
72verbose=""
73extra_options=""
74script_and_exit=""
75stdio_setup="yes"
76run_to_completion="yes"
77logdir=log
78update_on_tick="no"
79max_run_time=$((5 * 60))
80using_print_buffer="yes"
81
82while getopts vhr12o:c:sl:t OPT
83do
84    case "$OPT" in
85        v)
86            verbose="yes";;
87        s)
88            script_and_exit="yes"
89            run_to_completion="no"
90            stdio_setup="no";;
91        l)
92            logdir="$OPTARG";;
93        o)
94            extra_options="$OPTARG";;
95        *)
96            fatal;;
97    esac
98done
99
100let $((shiftcount = $OPTIND - 1))
101shift $shiftcount
102
103args=$*
104
105#
106# Run the tests
107#
108
109tests="$args"
110if [ ! "$tests" ]
111then
112     set -- `echo *.exe`
113     tests="$*"
114fi
115
116[ -d $logdir ] ||
117  mkdir $logdir || fatal "could not create log directory ($logdir)"
118
119cpus=1
120
121# where the tmp files go
122statfile=/tmp/stats$$
123scriptfile=/tmp/script$$
124
125trap "test_exit" 1 2 3 13 14 15
126
127for tfile in $tests
128do
129
130   tname=`basename $tfile .exe`
131   TEST_TYPE="single"
132
133   case $tname in
134       monitor*)
135           if [ $run_to_completion = "yes" ]
136           then
137                warn "Skipping $tname; it is interactive"
138                continue
139           fi
140           ;;
141       *-node2*)
142           fatal "MP tests not supported"
143           warn "Skipping $tname; 'runtest' runs both nodes when for *-node1"
144           continue;;
145      *-node1*)
146           warn "Running both nodes associated with $tname"
147           variant=`echo $tname | sed 's/.*-node[12]//' | sed 's/\.exe//'`
148           tname=`echo $tname | sed 's/-node.*//'`
149           TEST_TYPE="mp"
150           ;;
151       minimum*|stackchk*|spfatal*|termio*)
152           warn "Skipping $tname; it locks up or takes a VERY long time to run"
153           continue
154           ;;
155   esac
156
157   # Change the title bar to indicate which test we are running
158   # The simulator screen doesn't provide any indication
159
160   logfile=$logdir/$tname
161   infofile=$logfile.info
162
163   rm -f ${statfile}* ${scriptfile}* ${logfile}.tmp*
164
165   date=`date`
166   echo "Starting $tname at $date"
167
168   # Generate a script file to get the work done.
169   # The script file must do the following:
170   #
171   #       load the program (programs if MP test)
172   #       arrange for capture of output
173   #       run the program
174   #       produce statistics
175
176   {
177       case $TEST_TYPE in
178           "mp")
179               fatal "MP tests not supported"
180               ;;
181
182           # All other tests (single-processor)
183           *)
184               echo "load $tfile"
185               echo "go 0x02000000"
186               echo ""
187               echo "perf"
188               echo "quit"
189               ;;
190       esac
191
192   } > ${scriptfile}
193
194   if [ "$script_and_exit" = "yes" ]
195   then
196        mv ${scriptfile} $tname.ss
197        warn "script left in $tname.ss"
198        test_exit 0
199   fi
200
201   # Spin off the simulator in the background
202   sparc-rtems-sis $extra_options -c ${scriptfile} >${logfile}.tmp &
203   sim_pid=$!
204
205   # Make sure it won't run forever...
206   {
207       time_run=0
208       while [ $time_run -lt $max_run_time ]
209       do
210           # sleep 10s at a time waiting for job to finish or timer to expire
211           # if job has exited, then we exit, too.
212           sleep 10
213           if kill -0 $sim_pid 2>/dev/null
214           then
215                time_run=$((time_run + 10))
216           else
217                exit 0
218           fi
219       done
220
221       kill -2 $sim_pid 2>/dev/null
222       { sleep 5; kill -9 $sim_pid 2>/dev/null; } &
223   } &
224
225   wait $sim_pid
226   status=$?
227   if [ $status -ne 0 ]
228   then
229       ran_too_long="yes"
230   else
231       ran_too_long="no"
232   fi
233
234   sim_pid=""
235
236   # fix up the printf output from the test
237   case $TEST_TYPE in
238       mp)
239           fatal "MP not supported"
240           ;;
241       *)
242           output_it=1
243           sed -e '1,9d' \
244               -e 's/ //' -e '/^$/d' < ${logfile}.tmp |
245             while read line
246              do
247                if [ $output_it -eq 1 ] ; then
248                   if [ "$line" = "sis> perf" ] ; then
249                     output_it=0
250                   elif [ "$line" = "sis> quit" ] ; then
251                     output_it=0
252                   elif [ "$line" = "sis>" ] ; then
253                     output_it=0
254                   else
255                     echo "$line"
256                   fi   
257                 fi 
258               done > ${logfile}_1
259           ;;
260   esac
261
262   # Create the info files
263   for cpu in $cpus
264   do
265   {
266       echo "$date"
267       echo "Test run on: `uname -n`    ( `uname -a` )"
268
269       output_it=0
270       sed -e 's/ //' < ${logfile}.tmp |
271         while read line
272         do
273           if [ $output_it -eq 1 ] ; then
274              if [ "$line" = "sis> quit" ] ; then
275                output_it=0
276              else
277                echo "$line"
278              fi
279            else
280              if [ "$line" = "sis> perf" ] ; then
281                output_it=1
282              fi
283            fi
284          done
285
286
287       if [ "$ran_too_long" = "yes" ]
288       then
289           echo "Test did NOT finish normally; killed after $max_run_time seconds"
290       fi
291
292       echo
293       date;
294   } > ${infofile}_$cpu
295   done
296
297   rm -f ${logfile}.tmp*
298
299   if [ "$cpus" = "1" ]
300   then
301        mv ${infofile}_1 ${infofile}
302        mv ${logfile}_1  ${logfile}
303   fi
304
305done
306
307test_exit 0
308
309# Local Variables: ***
310# mode:ksh ***
311# End: ***
312
Note: See TracBrowser for help on using the repository browser.