Re: [RFC v5 4/5] tests/qtest: Add qtest-attrs-test for memory access attrs

Tao Tang <[email protected]>
Newsgroups org.nongnu.qemu-arm,org.nongnu.qemu-devel
Message-ID <[email protected]>
Hi Fabiano,

On 2026/8/19 22:14, Fabiano Rosas wrote:
> Tao Tang <[email protected]> writes:
>
>> Add qtest-attrs-test to exercise qtest memory access commands with attrs
>> on both aarch64 and x86.
>>
>> The test covers:
>> - Arm virt,secure=on: scalar and bulk accesses across non-secure,
>>    secure, and root spaces, plus negative coverage for realm and for
>>    non-secure accesses into secure-only RAM
>> - x86 q35: normal accesses
>> - libqtest-single *_attrs shortcut wrappers
>>
>> Add reusable response assertion helpers and structured attrs failure
>> helpers to libqtest.
> Can't you re-order patch 3/5 before 2/5 and put these generic changes in
> 2/5 as well?

Yes, that makes sense. I'll reorder them in V6.


>
>> Use the structured APIs for negative memory access
>> tests, while retaining raw protocol commands for malformed command
>> shapes that the typed APIs cannot express.
>>
>> On Arm, the test targets the virt machine's secure-only RAM window so
>> that the requested attrs must select the correct address space.
>>
>> Also wire qtest-attrs-test into the aarch64 and i386/x86_64 qtest
>> builds.
>>
>> Signed-off-by: Tao Tang <[email protected]>
>> ---
>>   tests/qtest/libqtest.c         | 156 +++++++++++++++++
>>   tests/qtest/libqtest.h         | 111 ++++++++++++
>>   tests/qtest/meson.build        |   7 +-
>>   tests/qtest/qtest-attrs-test.c | 305 +++++++++++++++++++++++++++++++++
>>   4 files changed, 577 insertions(+), 2 deletions(-)
>>   create mode 100644 tests/qtest/qtest-attrs-test.c
>>
>> diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
>> index 37aa69e1297..533b6f34599 100644
>> --- a/tests/qtest/libqtest.c
>> +++ b/tests/qtest/libqtest.c
> The repetition introduced in this part is annoying, but let's not suffer
> because of it, we can clean it up later. We could probably unify the
> attrs and non-attrs versions using variadic functions as with the qmp
> helpers.

Agreed. I'll leave the cleanup for a follow-up and keep this version 
focused on the attrs support.

Thanks for the review!

Tao

>
> For libqtest:
> Reviewed-by: Fabiano Rosas <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.