aboutsummaryrefslogtreecommitdiff
path: root/src/tests/utests/run_qemu_test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/utests/run_qemu_test.sh')
-rwxr-xr-xsrc/tests/utests/run_qemu_test.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tests/utests/run_qemu_test.sh b/src/tests/utests/run_qemu_test.sh
new file mode 100755
index 0000000..68cf498
--- /dev/null
+++ b/src/tests/utests/run_qemu_test.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+if [ $1 = 'watchdog' ]; then
+ sleep 10 &
+ PID=$!
+ echo $PID > pid2
+ wait $PID
+ if [ $? -eq 0 ]; then echo "(TEST-FAIL)"; fi
+ exit 0
+fi
+
+(qemu-system-i386 -kernel ../../../kernel/kernel.bin -initrd init.bin -serial stdio -m 16 -display none & echo $! >pid &
+ $0 watchdog) \
+ | tee >(grep -m 1 "TEST-" >result; kill -INT `cat pid`; kill -TERM `cat pid2`) \
+
+RESULT=`cat result`
+
+rm result
+rm pid
+rm pid2
+
+if [ $RESULT != '(TEST-OK)' ]; then exit 1; fi
+