960584c0f3
tool in C; much more robust and easier to understand, as well as avoiding the dependency on timeout (which isn't Posix).
51 lines
1.1 KiB
Bash
Executable file
51 lines
1.1 KiB
Bash
Executable file
#!/bin/sh
|
|
method=$1
|
|
img=$2
|
|
timeout=$3
|
|
timeoutprog=$4
|
|
|
|
set -e
|
|
|
|
result=/tmp/$$.testdriver.result
|
|
trap "rm -f $result" EXIT
|
|
|
|
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"
|
|
exit 0
|
|
fi
|
|
|
|
case $method in
|
|
qemu-system-i386) img="-drive file=$img,if=floppy,format=raw" ;;
|
|
qemu-system-ppc) img="-kernel $img" ;;
|
|
esac
|
|
|
|
$timeoutprog -t $timeout -- $method -nographic $img > $result
|
|
;;
|
|
|
|
qemu-*)
|
|
if ! command -v $method >/dev/null 2>&1 ; then
|
|
errcho "Warning: $method not installed, skipping test"
|
|
exit 0
|
|
fi
|
|
|
|
$method $img > $result
|
|
;;
|
|
|
|
*)
|
|
errcho "Error: $method not known by testdriver"
|
|
exit 1
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_test_output > $result
|
|
( grep -q @@FAIL $result || ! grep -q @@FINISHED $result ) && cat $result && exit 1
|
|
exit 0
|