2016-11-13 12:37:22 +00:00
|
|
|
#!/bin/sh
|
2016-11-26 10:23:25 +00:00
|
|
|
method=$1
|
2016-11-13 12:37:22 +00:00
|
|
|
img=$2
|
|
|
|
timeout=$3
|
2016-11-29 19:59:43 +00:00
|
|
|
timeoutprog=$4
|
2016-11-13 12:37:22 +00:00
|
|
|
|
2016-11-29 19:59:43 +00:00
|
|
|
set -e
|
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-29 19:59:43 +00:00
|
|
|
errcho() {
|
|
|
|
>&2 echo "$*"
|
|
|
|
}
|
|
|
|
|
|
|
|
get_test_output() {
|
|
|
|
case $method in
|
|
|
|
qemu-system-*)
|
|
|
|
if ! command -v $method >/dev/null 2>&1 ; then
|
|
|
|
errcho "Warning: $method not installed, skipping test"
|
2016-12-01 23:00:31 +00:00
|
|
|
echo "@@SKIPPED"
|
2016-11-29 19:59:43 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
case $method in
|
|
|
|
qemu-system-i386) img="-drive file=$img,if=floppy,format=raw" ;;
|
|
|
|
qemu-system-ppc) img="-kernel $img" ;;
|
|
|
|
esac
|
|
|
|
|
2016-12-06 21:05:14 +00:00
|
|
|
$timeoutprog -t $timeout -- $method -nographic $img > $result 2>&1
|
2016-11-29 19:59:43 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
qemu-*)
|
|
|
|
if ! command -v $method >/dev/null 2>&1 ; then
|
|
|
|
errcho "Warning: $method not installed, skipping test"
|
2016-12-01 23:00:31 +00:00
|
|
|
echo "@@SKIPPED"
|
2016-11-29 19:59:43 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2016-12-06 21:05:14 +00:00
|
|
|
$method $img > $result 2>&1
|
2016-11-29 19:59:43 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
errcho "Error: $method not known by testdriver"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2016-12-01 22:03:30 +00:00
|
|
|
get_test_output
|
2016-12-01 22:14:29 +00:00
|
|
|
( grep -q '@@FAIL\|@@SKIPPED' $result || ! grep -q @@FINISHED $result ) && cat $result && exit 1
|
2016-11-26 11:53:36 +00:00
|
|
|
exit 0
|