Files
qemu-reims-vgpu/tests/tcg/scripts/check_plugin_output.sh
T
Pierrick Bouvier cda0540c10 tests/tcg/meson.build: add wrapper check_plugin_output
This wrapper runs a qemu command, record command output and plugin
output, and forward both to a check script.
We use this pattern in several plugin tests (for instance, with
validate-memory-counts.py).

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Tested-by: Aniket Sahu <asahu1x@linux.ibm.com>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20260827221506.91574-21-pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2026-09-04 15:06:02 +01:00

26 lines
500 B
Bash
Executable File

#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-2.0-or-later
set -euo pipefail
if [ $# -lt 3 ]; then
echo "check_plugin_output: check_cmd qemu_bin [args]..." 1>&2
exit 1
fi
check_cmd="$1"; shift
check_cmd_args=""
while [[ "$1" == "-"* ]]; do
check_cmd_args="$check_cmd_args $1"
shift
done
qemu="$1"; shift
tmp=$(mktemp -d)
trap "rm -rf $tmp" EXIT
set -x
$qemu -d plugin -D $tmp/plugin "$@" |& tee $tmp/output
cat $tmp/plugin
$check_cmd $check_cmd_args $tmp/output $tmp/plugin