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
|
|
|
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
|
|
|
|
|
2017-11-08 19:08:43 +00:00
|
|
|
$timeoutprog -t $timeout -- $method -nographic $img 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
|
|
|
|
|
2017-11-08 19:08:43 +00:00
|
|
|
$method $img 2>&1
|
2016-11-29 19:59:43 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
errcho "Error: $method not known by testdriver"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2017-11-08 19:08:43 +00:00
|
|
|
# Hide output if the test passed.
|
|
|
|
# Show output if it failed, skipped, or timed out.
|
|
|
|
get_test_output | awk '
|
|
|
|
{ lines[count++] = $0 }
|
|
|
|
/@@FAIL|@@SKIPPED|@@TIMEDOUT/ { bad = 1 }
|
|
|
|
/@@FINISHED/ { finished = 1 }
|
|
|
|
END {
|
|
|
|
if (finished && !bad) exit 0
|
|
|
|
for (i = 0; i < count; i++) print lines[i]
|
|
|
|
if (!bad) print "@@FAIL by testdriver.sh"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
'
|