mirror of
https://github.com/qemu/qemu.git
synced 2024-11-27 13:53:45 +08:00
354b5c19b3
Add an explicit test to check expected memory values are read/written. 8,16,32 load/store are tested for all arch. 64,128 load/store are tested for aarch64/x64. atomic operations (8,16,32,64) are tested for x64 only. By default, atomic accesses are non atomic if a single cpu is running, so we force creation of a second one by creating a new thread first. load/store helpers code path can't be triggered easily in user mode (no softmmu), so we can't test it here. Output of test-plugin-mem-access.c is the list of expected patterns in plugin output. By reading stdout, we can compare to plugins output and have a multiarch test. Can be run with: make -C build/tests/tcg/$ARCH-linux-user run-plugin-test-plugin-mem-access-with-libmem.so Tested-by: Xingtao Yao <yaoxt.fnst@fujitsu.com> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240910172033.1427812-7-pierrick.bouvier@linaro.org> Message-Id: <20240916085400.1046925-10-alex.bennee@linaro.org>
37 lines
651 B
Bash
Executable File
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
|