diff options
author | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-19 19:23:34 +0100 |
---|---|---|
committer | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-19 19:23:34 +0100 |
commit | 7b27ab493b56f9e77d805c4f44a1717f3a79231e (patch) | |
tree | a3037447f4e3d428a61a5c3cfb4e2a98ea5981e4 /src/tests/utests/run_qemu_test.sh | |
parent | 62e5a35940198f0f8fbabdf31c80455647420c4e (diff) | |
download | kogata-7b27ab493b56f9e77d805c4f44a1717f3a79231e.tar.gz kogata-7b27ab493b56f9e77d805c4f44a1717f3a79231e.zip |
Userland test infrastructure
Diffstat (limited to 'src/tests/utests/run_qemu_test.sh')
-rwxr-xr-x | src/tests/utests/run_qemu_test.sh | 23 |
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 + |