On 6/10/2026 12:30 AM, Manos Pitsidianakis wrote:
> On Wed, 10 Jun 2026 00:47, Pierrick Bouvier
> <[email protected]> wrote:
>> 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).
>>
>> Signed-off-by: Pierrick Bouvier <[email protected]>
>> ---
>> tests/tcg/meson.build                    |  1 +
>> tests/tcg/scripts/check_plugin_output.sh | 19 +++++++++++++++++++
>> 2 files changed, 20 insertions(+)
>> create mode 100755 tests/tcg/scripts/check_plugin_output.sh
>>
>> diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
>> index f0efd46ee3e..6e46c121fda 100644
>> --- a/tests/tcg/meson.build
>> +++ b/tests/tcg/meson.build
>> @@ -6,6 +6,7 @@ if config_host.has_key('GDB')
>>   gdb_progs = [config_host['GDB'], gdb_progs]
>> endif
>> gdb = find_program(gdb_progs, required: false)
>> +prog_check_plugin_output = find_program('./scripts/
>> check_plugin_output.sh')
>> prog_gdb_test = find_program('../guest-debug/run-test.py')
>> prog_record_replay = find_program('./scripts/record_replay.sh')
>> prog_run_and_diff = find_program('./scripts/run_and_diff.sh')
>> diff --git a/tests/tcg/scripts/check_plugin_output.sh b/tests/tcg/
>> scripts/check_plugin_output.sh
>> new file mode 100755
>> index 00000000000..4d12e23ad60
>> --- /dev/null
>> +++ b/tests/tcg/scripts/check_plugin_output.sh
>> @@ -0,0 +1,19 @@
>> +#!/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
>> +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 $tmp/output $tmp/plugin
>> -- 
> 
> Could we write a single python script for all the shell script wrappers
> and use a different kind of wrapper depending on its command line flags/
> subcommand we invoke it with?
> Maybe this could be better? WDYT?

We could do that for sure. Better or not? Not sure, but I don't have
strong opinion.
I just picked bash because it's more concise than python for this.
Before putting too much effort into the wrapper part, I'll wait to see
if the rest is working for maintainers.

Regards,
Pierrick

Reply via email to