Alex Bennée <alex.ben...@linaro.org> writes:

> Pierrick Bouvier <pierrick.bouv...@linaro.org> writes:
>
>> 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.f...@fujitsu.com>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouv...@linaro.org>
>> ---
>>  tests/tcg/multiarch/test-plugin-mem-access.c  | 175 ++++++++++++++++++
>>  tests/tcg/multiarch/Makefile.target           |   7 +
>>  .../tcg/multiarch/check-plugin-mem-access.sh  |  30 +++
>>  3 files changed, 212 insertions(+)
>>  create mode 100644 tests/tcg/multiarch/test-plugin-mem-access.c
>>  create mode 100755 tests/tcg/multiarch/check-plugin-mem-access.sh
>>
>> diff --git a/tests/tcg/multiarch/test-plugin-mem-access.c 
>> b/tests/tcg/multiarch/test-plugin-mem-access.c
>> new file mode 100644
>> index 00000000000..09d1fa22e35
> <snip>
>> diff --git a/tests/tcg/multiarch/Makefile.target 
>> b/tests/tcg/multiarch/Makefile.target
>> index 5e3391ec9d2..d90cbd3e521 100644
>> --- a/tests/tcg/multiarch/Makefile.target
>> +++ b/tests/tcg/multiarch/Makefile.target
>> @@ -170,5 +170,12 @@ run-plugin-semiconsole-with-%:
>>  TESTS += semihosting semiconsole
>>  endif
>>
>
> Also you need:
>
> test-plugin-mem-access: CFLAGS+=-pthread
> test-plugin-mem-access: LDFLAGS+=-pthread
>
> So less tolerant gcc's include pthread (otherwise the alpha-linux-user
> fails), with that fix I get:
>
>    TEST    check plugin libmem.so output with test-plugin-mem-access
>   ",store_u8,.*,8,store,0xf1" not found in 
> test-plugin-mem-access-with-libmem.so.pout
>   make[1]: *** [Makefile:181: 
> run-plugin-test-plugin-mem-access-with-libmem.so] Error 1
>   make: *** [/home/alex/lsrc/qemu.git/tests/Makefile.include:56: 
> run-tcg-tests-alpha-linux-user] Error 2

And ensure we enable BWX for alpha so it emits bytes stores instead of
faking it with masking:

modified   tests/tcg/alpha/Makefile.target
@@ -13,3 +13,5 @@ test-cmov: test-cond.c
        $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
 
 run-test-cmov: test-cmov
+
+test-plugin-mem-access: CFLAGS+=-mbwx

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro

Reply via email to