Instead of executing test, just read it's output from a file. This allows to standardize how to call check plugins scripts.
Signed-off-by: Pierrick Bouvier <[email protected]> --- tests/tcg/multiarch/Makefile.target | 3 +-- .../multiarch/plugin/check-plugin-output.sh | 22 ++++++------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target index 508149d57bd..f46983cc76e 100644 --- a/tests/tcg/multiarch/Makefile.target +++ b/tests/tcg/multiarch/Makefile.target @@ -211,8 +211,7 @@ run-plugin-test-plugin-mem-access-with-libmem.so: \ PLUGIN_ARGS=$(COMMA)print-accesses=true run-plugin-test-plugin-mem-access-with-libmem.so: \ CHECK_PLUGIN_OUTPUT_COMMAND= \ - $(SRC_PATH)/tests/tcg/multiarch/plugin/check-plugin-output.sh \ - $(QEMU) $< + $(SRC_PATH)/tests/tcg/multiarch/plugin/check-plugin-output.sh [email protected] run-plugin-test-plugin-syscall-filter-with-libsyscall.so: run-plugin-test-plugin-set-pc-with-libsetpc.so: diff --git a/tests/tcg/multiarch/plugin/check-plugin-output.sh b/tests/tcg/multiarch/plugin/check-plugin-output.sh index 80607f04b5d..338c9ced23e 100755 --- a/tests/tcg/multiarch/plugin/check-plugin-output.sh +++ b/tests/tcg/multiarch/plugin/check-plugin-output.sh @@ -1,8 +1,7 @@ #!/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. +# This script checks that plugin_output contains line from test_output. +# Each line of output is searched (as a regexp) in plugin_output. set -euo pipefail @@ -19,18 +18,11 @@ check() grep "$pattern" "$file" > /dev/null || die "\"$pattern\" not found in $file" } -[ $# -eq 3 ] || die "usage: qemu_bin exe plugin_out_file" +[ $# -eq 2 ] || die "usage: test_output plugin_out" -qemu_bin=$1; shift -exe=$1;shift -plugin_out=$1; shift +test_output=$1;shift +plugin_output=$1;shift -expected() -{ - $qemu_bin $exe || - die "running $exe failed" -} - -expected | while read line; do - check "$plugin_out" "$line" +cat $test_output | while read line; do + check "$plugin_output" "$line" done -- 2.43.0
