2008-08-11 Joel Sherrill <joel.sherrill@OARcorp.com>

* runtest: Major update. Now more likely not to run away.
This commit is contained in:
Joel Sherrill
2008-08-12 13:05:08 +00:00
parent 77c5e9120d
commit 3c5939074c
2 changed files with 45 additions and 27 deletions

View File

@@ -1,3 +1,7 @@
2008-08-11 Joel Sherrill <joel.sherrill@OARcorp.com>
* runtest: Major update. Now more likely not to run away.
2007-09-04 Joel Sherrill <joel.sherrill@OARcorp.com> 2007-09-04 Joel Sherrill <joel.sherrill@OARcorp.com>
* runtest: Add capture to list of interative tests to skip in batch * runtest: Add capture to list of interative tests to skip in batch

View File

@@ -85,7 +85,7 @@ logdir=log
update_on_tick="no" update_on_tick="no"
max_run_time=$((5 * 60)) max_run_time=$((5 * 60))
using_print_buffer="yes" using_print_buffer="yes"
simulator=mipstx39-rtems4.8-run simulator=mipstx39-rtems4.9-run
while getopts vdl:o:s: OPT while getopts vdl:o:s: OPT
do do
@@ -142,6 +142,7 @@ for tfile in $tests
do do
tname=`basename $tfile .exe` tname=`basename $tfile .exe`
tname=`basename $tname .ralf`
cpus="1" cpus="1"
TEST_TYPE="single" TEST_TYPE="single"
@@ -163,7 +164,7 @@ do
tname=`echo $tname | sed 's/-node.*//'` tname=`echo $tname | sed 's/-node.*//'`
TEST_TYPE="mp" TEST_TYPE="mp"
;; ;;
minimum*|stackchk*|spfatal*|termio*) minimum*|stackchk*|*fatal*|termio*)
continue continue
;; ;;
esac esac
@@ -214,32 +215,45 @@ do
fatal "Cannot currently generate device files" fatal "Cannot currently generate device files"
fi fi
# Spin off the simulator in the background # Spin off the simulator in the background
${simulator} --board=jmr3904 $tfile | \ ${simulator} --board=jmr3904 $tfile | \
sed -e 's/ sed -e 's/
//' -e '/^$/d' > ${logfile} 2>&1 & //' -e '/^$/d' > ${logfile} 2>&1 &
pid=$! pid=$!
# Make sure it won't run forever... # Make sure it won't run forever...
time_run=0 millilimit=`expr ${max_run_time} \* 1000`
while [ $time_run -lt $max_run_time ] milliseconds=0
do while :
# sleep 5s at a time waiting for job to finish or timer to expire do
# if job has exited, then we exit, too. # sleep 10ms at a time waiting for job to finish or timer to expire
sleep 5 # if job has exited, then we exit, too.
kill -0 $pid 2> /dev/null usleep 10000 # ten milliseconds
running=$? milliseconds=`expr ${milliseconds} + 10`
if [ $running -eq 0 ] kill -0 $pid 2> /dev/null
then running=$?
time_run=$((time_run + 5)) if [ $running -eq 0 ] ; then
if [ $time_run -ge $max_run_time ] if [ ${milliseconds} -ge ${millilimit} ]; then
then kill -9 $pid 2> /dev/null
kill -9 $pid 2> /dev/null cat ${logfile}
ran_too_long="yes" echo "${testname} killed after running ${max_run_time} seconds"
fi break
else fi
ran_too_long="no" grep "^Unhandled exception" ${logfile} >/dev/null
exceptionExit=$?
grep "^mips-core: " ${logfile} >/dev/null
badAccessExit=$?
if [ $badAccessExit -eq 0 -o $exceptionExit -eq 0 ] ; then
kill -9 ${pid} >/dev/null 2>&1
cat ${logfile}
echo Ran in ${milliseconds} milliseconds
fi
else
# done normally
cat ${logfile}
echo "${testname} ran in ${milliseconds} milliseconds"
break break
fi fi
done done