aboutsummaryrefslogtreecommitdiff
path: root/src/tests/utests/run_qemu_test.sh
blob: 68cf49844a3f2bd36fab702511fbc2f647eb0066 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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