Files
QEMU-S5L8950X/tests/tcg/multiarch/plugin/check-plugin-output.sh
T
Yaya48 cf256aa081 Import QEMU upstream snapshot d2e570c
Upstream: https://gitlab.com/qemu-project/qemu.git

Upstream-Commit: d2e570cc0f97b936902a5b1b86b73c0f5998b475
2026-08-31 02:15:30 +02:00

37 lines
651 B
Bash
Executable File

#!/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