2016-11-13 12:37:22 +00:00
|
|
|
#!/bin/sh
|
|
|
|
qemu=$1
|
|
|
|
img=$2
|
|
|
|
timeout=$3
|
|
|
|
|
2016-11-16 19:50:14 +00:00
|
|
|
pipe=/tmp/$$.testdriver.pipe
|
2016-11-13 12:37:22 +00:00
|
|
|
mknod $pipe p
|
2016-11-16 19:50:14 +00:00
|
|
|
trap "rm -f $pipe" EXIT
|
2016-11-13 12:37:22 +00:00
|
|
|
|
2016-11-16 19:50:14 +00:00
|
|
|
result=/tmp/$$.testdriver.result
|
|
|
|
trap "rm -f $result" EXIT
|
2016-11-13 12:37:22 +00:00
|
|
|
|
2016-11-16 19:50:14 +00:00
|
|
|
pidfile=/tmp/$$.testdriver.pid
|
|
|
|
trap "rm -f $pidfile" EXIT
|
2016-11-13 12:37:22 +00:00
|
|
|
|
2016-11-16 19:50:14 +00:00
|
|
|
($qemu -nographic -kernel $img 2>&1 & echo $! > $pidfile ) | tee $result | \
|
|
|
|
grep -l @@FINISHED | (read dummy && kill $(cat $pidfile))
|
2016-11-13 12:37:22 +00:00
|
|
|
|
2016-11-16 19:50:14 +00:00
|
|
|
grep @@FAIL $result && cat $result && exit 1
|
|
|
|
exit 0
|