source: rtems/c/src/lib/libbsp/m68k/mcf5206elite/tools/runtest @ e56c3546

4.104.114.84.95
Last change on this file since e56c3546 was e56c3546, checked in by Joel Sherrill <joel.sherrill@…>, on Oct 26, 2001 at 7:30:11 PM

2001-10-26 Victor V. Vengerov <vvv@…>

  • New BSP for MCF5206eLITE evaluation board BSP.
  • ChangeLog?, README, bsp_specs, configure.ac, console/console.c, console/.cvsignore, i2c/i2c.c, i2c/i2cdrv.c, i2c/.cvsignore, include/bsp.h, include/bspopts.h.in, include/coverhd.h, include/ds1307.h, include/i2c.h, include/i2cdrv.h, include/nvram.h, include/.cvsignore, nvram/nvram.c, nvram/.cvsignore, start/start.S, start/.cvsignore, startup/bspclean.c, startup/bspstart.c, startup/gdbinit, startup/init5206e.c, startup/linkcmds, startup/linkcmds.flash, startup/.cvsignore, times, tod/ds1307.c, tod/todcfg.c, tod/.cvsignore, tools/.cvsignore, tools/configure.ac, tools/runtest, tools/changes, wrapup/.cvsignore, .cvsignore: New files.
  • Property mode set to 100644
File size: 8.3 KB
Line 
1#! /bin/sh -p
2#
3# Run rtems tests on the Motorola MCF5206eLITE Coldfire Evaluation board
4# using gdb configured with P&E Micro Background Debug Mode debugging
5# interface.
6#
7# This program generates a gdb script to run each test, intercept
8# serial port output and put log into output file.
9#
10# Author: Victor V. Vengerov <vvv@oktet.ru>
11# Copyright (C) 2000 OKTET Ltd., St.-Petersburg, Russia
12#
13# Partially based on runtest script for powerpc psim.
14#
15#  COPYRIGHT (c) 1989-1999.
16#  On-Line Applications Research Corporation (OAR).
17#
18#  The license and distribution terms for this file may be
19#  found in found in the file LICENSE in this distribution or at
20#  http://www.OARcorp.com/rtems/license.html.
21#
22#  @(#) $Id$
23#
24
25# progname=`basename $0`
26progname=${0##*/}        # fast basename hack for ksh, bash
27
28USAGE=\
29"usage: $progname [ -opts ] test [ test ... ]
30        -s ttydevice -- specify serial device to be used to capture test
31                        output
32        -r baud      -- set serial port baud rate (19200 by default)
33        -b bdmdevice -- specify BDM device to be used to control the target
34        -g gdbname   -- specify name of gdb program to be used
35        -v           -- verbose output
36        -d           -- don't remove temporary files (for debugging only)
37        -i           -- use interrupt driven console I/O when test is running
38                        (many tests failed when interrupt driven console
39                        input/output is used due undetermenistic tests
40                        behaviour)
41        -p           -- use termios poll console I/O
42        -l logdir    -- specify log directory (default is 'logdir')
43
44  Specify test as 'test' or 'test.exe'.
45  All multiprocessing tests *must* be specified simply as 'mp01', etc.
46"
47
48# export everything
49set -a
50
51#   log an error to stderr
52prerr()
53{
54    echo "$*" >&2
55}
56
57fatal() {
58    [ "$1" ] && prerr $*
59    prerr "$USAGE"
60    exit 1
61}
62
63warn() {
64    [ "$1" ] && prerr $*
65}
66
67# run at normal and signalled exit
68test_exit()
69{
70    exit_code=$1
71
72    rm -f ${logfile}.tmp*
73    [ "$gdb_pid" ] && kill -9 $gdb_pid
74    [ "$serial_pid" ] && kill -9 $serial_pid
75
76    exit $exit_code
77}
78
79#
80# process the options
81#
82# defaults for getopt vars
83#
84# max_run_time is defaulted to 5 minutes
85#
86
87verbose=""
88serial_device=/dev/ttyS0
89bdm_device=/dev/bdmcf0
90gdbprog=true
91for i in rtems bdm-rtems bdm bdm-elf bdm-coff ; do
92    if m68k-$i-gdb --version > /dev/null 2>&1 ; then
93        gdbprog=m68k-$i-gdb ;
94        break ;
95    fi
96done
97logdir=log
98max_run_time=$((5 * 60))
99sizeof_ram=$((1 * 1024 * 1024))
100debugging="no"
101baudrate="19200"
102console_mode=0
103
104while getopts vdips:r:b:l: OPT
105do
106    case "$OPT" in
107        v)
108            verbose="yes";;
109        d)
110            debugging="yes";;
111        s)
112            serial_device="$OPTARG";;
113        r)
114            baudrate="$OPTARG";;
115        b)
116            bdm_device="$OPTARG";;
117        l)
118            logdir="$OPTARG";;
119        s)
120            gdbprog="$OPTARG";;
121        p)
122            console_mode=1;;
123        i)
124            console_mode=2;;
125        *)
126            fatal;;
127    esac
128done
129
130let $((shiftcount = $OPTIND - 1))
131shift $shiftcount
132
133args=$*
134
135#
136# Run the tests
137#
138
139tests="$args"
140if [ ! "$tests" ]
141then
142     set -- `echo *.exe`
143     tests="$*"
144fi
145
146[ -d $logdir ] ||
147  mkdir $logdir || fatal "could not create log directory ($logdir)"
148
149# where the tmp files go
150trap "test_exit" 1 2 3 13 14 15
151
152for tfile in $tests
153do
154
155   tname=`basename $tfile .exe`
156   cpus="1"
157   TEST_TYPE="single"
158
159   case "$tname" in
160       # size is no longer interactive.
161       monitor* | termios*)
162            warn "Skipping $tname; it is interactive"
163            continue
164            ;;
165       *-node2*)
166           warn "Skipping $tname; 'runtest' runs both nodes when for *-node1"
167           continue
168           ;;
169       *-node1*)
170           warn "Running both nodes associated with $tname"
171           tname=`echo $tname | sed 's/-node.*//'`
172           TEST_TYPE="mp"
173           ;;
174       minimum*|stackchk*|spfatal*|malloctest*)
175           continue
176           ;;
177   esac
178
179   if [ "$TEST_TYPE" = "mp" ] ; then
180       fatal "MP tests not supported for this board"
181   fi
182
183   if [ $TEST_TYPE = "single" ] ; then
184     logfile=$logdir/${tname}
185     infofile=${logfile}.info
186     scriptfile=${logfile}.ss
187     gdblogfile=${logfile}.gdb
188
189     rm -f ${logfile}.tmp*
190
191     date=`date`
192     echo "Starting $tname at $date"
193
194     # Set serial port parameters
195     if ! stty -F ${serial_device} raw cs8 -cstopb cread crtscts \
196                    ispeed ${baudrate} ospeed ${baudrate} \
197                    > /dev/null 2> /dev/null ; then
198         fatal "Serial port couldn't be configured"
199     fi
200
201     # Flush serial port
202     cat ${serial_device} > /dev/null &
203     serial_pid=$!
204     sleep 1s
205     kill ${serial_pid}
206
207     # Capture serial port
208     cat ${serial_device} > $logfile &
209     serial_pid=$!
210
211     cat > "${scriptfile}" <<EOF
212target bdm $bdm_device
213set \$mbar  = 0x10000001
214set \$csar0 = \$mbar - 1 + 0x064
215set \$csmr0 = \$mbar - 1 + 0x068
216set \$cscr0 = \$mbar - 1 + 0x06E
217set \$csar1 = \$mbar - 1 + 0x070
218set \$csmr1 = \$mbar - 1 + 0x074
219set \$cscr1 = \$mbar - 1 + 0x07A
220set \$csar2 = \$mbar - 1 + 0x07C
221set \$csmr2 = \$mbar - 1 + 0x080
222set \$cscr2 = \$mbar - 1 + 0x086
223set \$csar3 = \$mbar - 1 + 0x088
224set \$csmr3 = \$mbar - 1 + 0x08C
225set \$cscr3 = \$mbar - 1 + 0x092
226set \$csar4 = \$mbar - 1 + 0x094
227set \$csmr4 = \$mbar - 1 + 0x098
228set \$cscr4 = \$mbar - 1 + 0x09E
229set \$csar5 = \$mbar - 1 + 0x0A0
230set \$csmr5 = \$mbar - 1 + 0x0A4
231set \$cscr5 = \$mbar - 1 + 0x0AA
232set \$csar6 = \$mbar - 1 + 0x0AC
233set \$csmr6 = \$mbar - 1 + 0x0B0
234set \$cscr6 = \$mbar - 1 + 0x0B6
235set \$csar7 = \$mbar - 1 + 0x0B8
236set \$csmr7 = \$mbar - 1 + 0x0BC
237set \$cscr7 = \$mbar - 1 + 0x0C2
238
239set *((short*) \$csar0) = 0xffe0
240set *((int*)   \$csmr0) = 0x000f0000
241set *((short*) \$cscr0) = 0x1da3
242set *((short*) \$csar1) = 0x5000
243set *((int*)   \$csmr1) = 0x00000000
244set *((short*) \$cscr1) = 0x3d43
245set *((short*) \$csar2) = 0x3000
246set *((int*)   \$csmr2) = 0x000f0000
247set *((short*) \$cscr2) = 0x1903
248set *((short*) \$csar3) = 0x4000
249set *((int*)   \$csmr3) = 0x000f0000
250set *((short*) \$cscr3) = 0x0083
251#
252load
253# Many tests not working properly when interrupt driven console I/O is used.
254set console_mode=$console_mode
255set \$pc=start
256set \$sp=0x20001ffc
257#
258break bsp_cleanup
259commands
260shell kill $serial_pid
261quit
262end
263#
264break _stop
265commands
266shell kill $serial_pid
267quit 1
268end
269#
270continue
271quit 2
272EOF
273     ${gdbprog} -x "${scriptfile}" "${tfile}" > "${gdblogfile}"  2>&1 &
274     gdb_pid=$!
275     {
276         time_run=0
277         while [ $time_run -lt $max_run_time ] ; do
278             sleep 10s
279             if kill -0 $gdb_pid 2> /dev/null ; then
280                 time_run=$((time_run+10)) ;
281             else
282                 exit 0
283             fi
284         done
285         kill -2 $serial_pid 2> /dev/null
286         kill -2 $gdb_pid 2> /dev/null
287         {
288             sleep 5s ;
289             if kill -0 $gdb_pid 2> /dev/null ; then
290                 kill -9 $gdb_pid 2> /dev/null ;
291             fi
292             if kill -0 $serial_pid 2> /dev/null ; then
293                 kill -9 $serial_pid 2> /dev/null ;
294             fi
295         } &
296     } &
297     wait $gdb_pid
298     gdb_status=$?
299     {
300         if kill -0 $serial_pid 2> /dev/null ; then
301             kill $serial_pid 2> /dev/null ;
302         fi
303         sleep 5s ;
304         if kill -0 $serial_pid 2> /dev/null ; then
305             kill -9 $serial_pid 2> /dev/null ;
306         fi
307     } &
308     if [ $gdb_status -ge 128 ] ; then
309         ran_too_long="yes" ;
310     else
311         ran_too_long="no"
312     fi
313     if [ $gdb_status -ne 0 ] ; then
314         test_failed="yes" ;
315     else
316         test_failed="no"
317     fi
318     gdb_pid=""
319     serial_pid=""
320   fi
321
322   # Create the info files
323   {
324       echo "$date"
325       echo "Test run on: `uname -n`"
326       echo "Host Information:"
327       echo `uname -a`
328       echo
329       echo "Serial port: ${serial_device}"
330       echo "Baud rate:   ${baudrate}"
331       echo "BDM port:    ${bdm_device}"
332       echo "gdb:         `type -path ${gdbprog}`"
333
334       cat ${logfile}
335
336       if [ "$test_failed" = "yes" ] ; then
337           echo -e "\\n\\nTest did not finish normally"
338           if [ "$ran_too_long" = "yes" ] ; then
339               echo "Test killed after $max_run_time seconds"
340           fi
341       fi
342
343       echo
344       date;
345   } > ${infofile}
346   if [ "${debugging}" = "no" ] ; then
347       rm -f ${scriptfile}
348       rm -f ${gdblogfile}
349   fi
350done
351
352echo "Tests completed at " `date`
353test_exit 0
Note: See TracBrowser for help on using the repository browser.