diff options
author | Alex Auvolat <alex@adnab.me> | 2016-07-13 22:31:46 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2016-07-13 22:31:46 +0200 |
commit | 360da84db0d7165c84d160b518f39cd16006c758 (patch) | |
tree | a6fea5da753ec4ac5a37237cefda52801f9647ac /src/tests/ktests/run_qemu_test.sh | |
parent | 27a6934ea3073c3eaf782cc7615ce4ed0dbf4a18 (diff) | |
download | kogata-360da84db0d7165c84d160b518f39cd16006c758.tar.gz kogata-360da84db0d7165c84d160b518f39cd16006c758.zip |
Migrate to BAM build tool
Diffstat (limited to 'src/tests/ktests/run_qemu_test.sh')
-rwxr-xr-x | src/tests/ktests/run_qemu_test.sh | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/tests/ktests/run_qemu_test.sh b/src/tests/ktests/run_qemu_test.sh index 5f7df83..92cf10a 100755 --- a/src/tests/ktests/run_qemu_test.sh +++ b/src/tests/ktests/run_qemu_test.sh @@ -1,12 +1,26 @@ #!/bin/bash -(qemu-system-i386 -kernel test_kernel.bin -initrd ../../../kernel/kernel.map -serial stdio -m 16 -display none & echo $! >pid) \ - | tee >(grep -m 1 "TEST-" >result; kill -INT `cat pid`) \ +BINFILE=$1 +LOGFILE=$2 +MAPFILE=$3 -RESULT=`cat result` +RESULTFILE=`mktemp` +PIDFILE=`mktemp` -rm result -rm pid +(timeout 10s qemu-system-i386 -kernel $BINFILE -initrd $MAPFILE -serial stdio -m 16 -display none 2>/dev/null \ + & echo $! >$PIDFILE) \ + | tee >(grep -m 1 "TEST-" >$RESULTFILE; kill -INT `cat $PIDFILE`) > $LOGFILE -if [ $RESULT != '(TEST-OK)' ]; then exit 1; fi +RESULT=`cat $RESULTFILE` + +rm $RESULTFILE +rm $PIDFILE + +if [ "$RESULT" != '(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 |