From cb1b40603797dd722ec9b7e469de7a2ee8d4d4f3 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 5 Jan 2009 19:48:15 +0000 Subject: 2009-01-05 Joel Sherrill * psim-shared: Add catching a hardware exception and assertion as reasons to kill simulator. --- c/src/lib/libbsp/powerpc/psim/tools/ChangeLog | 5 +++++ c/src/lib/libbsp/powerpc/psim/tools/psim-shared | 20 +++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) (limited to 'c') diff --git a/c/src/lib/libbsp/powerpc/psim/tools/ChangeLog b/c/src/lib/libbsp/powerpc/psim/tools/ChangeLog index 93c3c01530..d90a1dc0ab 100644 --- a/c/src/lib/libbsp/powerpc/psim/tools/ChangeLog +++ b/c/src/lib/libbsp/powerpc/psim/tools/ChangeLog @@ -1,3 +1,8 @@ +2009-01-05 Joel Sherrill + + * psim-shared: Add catching a hardware exception and assertion as + reasons to kill simulator. + 2008-12-05 Joel Sherrill * psim-shared, runtest-bottom: Tidy up more bugs. diff --git a/c/src/lib/libbsp/powerpc/psim/tools/psim-shared b/c/src/lib/libbsp/powerpc/psim/tools/psim-shared index 63c507d551..c90fb52666 100755 --- a/c/src/lib/libbsp/powerpc/psim/tools/psim-shared +++ b/c/src/lib/libbsp/powerpc/psim/tools/psim-shared @@ -18,7 +18,7 @@ gen_device_tree() value=-1 # for now assume we are slave in this mode else case ${1} in - *mp*) + *node*) enable_sysv_devices="yes" case ${1} in *node1*) value=1 ;; @@ -88,15 +88,16 @@ runone() #echo run ${testname} forever ${RUN} -f ${treefile} ${RUN_DEBUG} ${testname} else + log=`echo ${testname} | sed -e 's/.exe$/.log/' -e 's/.ralf$/.log/'` #echo run ${testname} for maximum ${max_run_time} seconds - ${RUN} -f ${treefile} ${RUN_DEBUG} ${testname} & + ${RUN} -f ${treefile} ${RUN_DEBUG} ${testname} >${log} 2>&1 & pid=$! # Make sure it won't run forever... time_run=0 while [ $time_run -lt $max_run_time ] do - # sleep 5s at a time waiting for job to finish or timer to expire + # sleep 1s at a time waiting for job to finish or timer to expire # if job has exited, then we exit, too. sleep 1 kill -0 $pid 2> /dev/null @@ -108,11 +109,24 @@ runone() ran_too_long="yes" echo "${testname} killed after running ${max_run_time} seconds" fi + grep "Suspending faulting task" ${log} >/dev/null 2>&1 + Fault=$? + grep "assertion failed" ${log} >/dev/null 2>&1 + Assert=$? + if [ $Fault -eq 0 -o $Assert -eq 0 ] ; then + kill -9 $pid 2> /dev/null + echo "${testname} failed after ${max_run_time} seconds" + ran_too_long="no" + break + fi else ran_too_long="no" break fi done + cat ${log} + rm -f ${log} fi + } -- cgit v1.2.3