aboutsummaryrefslogtreecommitdiff
path: root/src/tests/utests/run_qemu_test.sh
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2016-07-13 22:31:46 +0200
committerAlex Auvolat <alex@adnab.me>2016-07-13 22:31:46 +0200
commit360da84db0d7165c84d160b518f39cd16006c758 (patch)
treea6fea5da753ec4ac5a37237cefda52801f9647ac /src/tests/utests/run_qemu_test.sh
parent27a6934ea3073c3eaf782cc7615ce4ed0dbf4a18 (diff)
downloadkogata-360da84db0d7165c84d160b518f39cd16006c758.tar.gz
kogata-360da84db0d7165c84d160b518f39cd16006c758.zip
Migrate to BAM build tool
Diffstat (limited to 'src/tests/utests/run_qemu_test.sh')
-rwxr-xr-xsrc/tests/utests/run_qemu_test.sh36
1 files changed, 20 insertions, 16 deletions
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