From 360da84db0d7165c84d160b518f39cd16006c758 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 13 Jul 2016 22:31:46 +0200 Subject: Migrate to BAM build tool --- src/tests/utests/run_qemu_test.sh | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'src/tests/utests/run_qemu_test.sh') diff --git a/src/tests/utests/run_qemu_test.sh b/src/tests/utests/run_qemu_test.sh index c168e8c..eb535ac 100755 --- a/src/tests/utests/run_qemu_test.sh +++ b/src/tests/utests/run_qemu_test.sh @@ -1,23 +1,27 @@ #!/bin/bash -if [ "$1" = "watchdog" ]; then - sleep 3 & - PID=$! - echo $PID > pid2 - wait $PID - if [ $? -eq 0 ]; then echo "(TEST-FAIL)"; fi - exit 0 -fi +BINFILE=$1 +LOGFILE=$2 +MAPFILE=$3 + +RESULTFILE=`mktemp` +PIDFILE=`mktemp` -(qemu-system-i386 -kernel ../../../kernel/kernel.bin -append 'init=io:/mod/init.bin' -initrd 'init.bin,../../../kernel/kernel.map' -serial stdio -m 16 -display none & echo $! >pid & - $0 watchdog) \ - | tee >(grep -m 1 "TEST-" >result; kill -INT `cat pid`; kill -TERM `cat pid2`) \ +(timeout 10s qemu-system-i386 -kernel build/kernel.bin -append "init=io:/mod/`basename $BINFILE`" \ + -initrd "$BINFILE,$MAPFILE" -serial stdio -m 16 -display none 2>/dev/null \ + & echo $! >$PIDFILE) \ + | tee >(grep -m 1 "TEST-" >$RESULTFILE; kill -INT `cat $PIDFILE`) >$LOGFILE -RESULT=`cat result` +RESULT=`cat $RESULTFILE` -rm result -rm pid -rm pid2 +rm $RESULTFILE +rm $PIDFILE -if [ $RESULT != '(TEST-OK)' ]; then exit 1; fi +if [ "$RESULT" != '[1] (TEST-OK)' ]; then + echo -e "\033[0;31m$BINFILE $RESULT\033[0m" + cp $LOGFILE $LOGFILE.err + exit 1; +else + echo -e "\033[0;32m$BINFILE $RESULT\033[0m" +fi -- cgit v1.2.3