QEMU main repository: Please see https://www.qemu.org/docs/master/devel/submitting-a-patch.html for how to submit changes to QEMU. Pull Requests are ignored. Please only use release tarballs from the QEMU website. http://www.qemu.org
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
651 B
36 lines
651 B
#!/usr/bin/env bash
|
|
|
|
# This script runs a given executable using qemu, and compare its standard
|
|
# output with an expected plugin output.
|
|
# Each line of output is searched (as a regexp) in the expected plugin output.
|
|
|
|
set -euo pipefail
|
|
|
|
die()
|
|
{
|
|
echo "$@" 1>&2
|
|
exit 1
|
|
}
|
|
|
|
check()
|
|
{
|
|
file=$1
|
|
pattern=$2
|
|
grep "$pattern" "$file" > /dev/null || die "\"$pattern\" not found in $file"
|
|
}
|
|
|
|
[ $# -eq 3 ] || die "usage: qemu_bin exe plugin_out_file"
|
|
|
|
qemu_bin=$1; shift
|
|
exe=$1;shift
|
|
plugin_out=$1; shift
|
|
|
|
expected()
|
|
{
|
|
$qemu_bin $exe ||
|
|
die "running $exe failed"
|
|
}
|
|
|
|
expected | while read line; do
|
|
check "$plugin_out" "$line"
|
|
done
|
|
|