aboutsummaryrefslogtreecommitdiff
path: root/src/tests/utests/run_qemu_test.sh
blob: 4d8bc6bb68ceb8349943a31f66961c436200a616 (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 3 &
	PID=$!
	echo $PID > pid2
	wait $PID
	if [ $? -eq 0 ]; then echo "(TEST-FAIL)"; fi
	exit 0
fi

(qemu-system-i386 -kernel ../../../kernel/kernel.bin  -append 'init=io:/mod/init.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