All of lore.kernel.org
 help / color / mirror / Atom feed
From: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>,
	kvm@vger.kernel.org,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	David Hildenbrand <david@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH 1/4] KVM: s390: selftests: Use TAP interface in the memop test
Date: Wed, 20 Apr 2022 12:55:03 +0200	[thread overview]
Message-ID: <2eb0545c-7ffd-fe3a-b6ad-d30ba7bd9177@linux.ibm.com> (raw)
In-Reply-To: <07903c7d-5afc-ce95-0f51-3c643eab8b37@redhat.com>

On 4/19/22 19:40, Thomas Huth wrote:
> On 14/04/2022 14.48, Janis Schoetterl-Glausch wrote:
>> On 4/14/22 12:53, Thomas Huth wrote:
>>> The memop test currently does not have any output (unless one of the
>>> TEST_ASSERT statement fails), so it's hard to say for a user whether
>>> a certain new sub-test has been included in the binary or not. Let's
>>> make this a little bit more user-friendly and include some TAP output
>>> via the kselftests.h interface.
>>>
>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>> ---
>>>   tools/testing/selftests/kvm/s390x/memop.c | 90 ++++++++++++++++++-----
>>>   1 file changed, 73 insertions(+), 17 deletions(-)
>>>
>>> diff --git a/tools/testing/selftests/kvm/s390x/memop.c b/tools/testing/selftests/kvm/s390x/memop.c
>>> index b04c2c1b3c30..a2783d9afcac 100644
>>> --- a/tools/testing/selftests/kvm/s390x/memop.c
>>> +++ b/tools/testing/selftests/kvm/s390x/memop.c
>>> @@ -12,6 +12,7 @@
>>>     #include "test_util.h"
>>>   #include "kvm_util.h"
>>> +#include "kselftest.h"
>>>     enum mop_target {
>>>       LOGICAL,
>>> @@ -648,33 +649,88 @@ static void test_errors(void)
>>>       kvm_vm_free(t.kvm_vm);
>>>   }
>>>   +struct testdef {
>>> +    const char *name;
>>> +    void (*test)(void);
>>> +    bool needs_extension;
>>
>> Please make this numeric. You could also rename it to required_extension or similar.
> [...]
>>> +
>>> +    for (idx = 0; idx < ARRAY_SIZE(testlist); idx++) {
>>> +        if (!testlist[idx].needs_extension || extension_cap) {
>>
>> Then check here that extension_cap >= the required extension.
>> This way the test can easily be adapted in case of future extensions.
> 
> Not sure whether a ">=" will really be safe, since a future extension does not necessarily assert that previous extensions are available at the same time.

Hmm, I intend for that to hold. In any case, for the existing extension we have committed to it, e.g.
the documentation says:

Absolute accesses are permitted for the VM ioctl if KVM_CAP_S390_MEM_OP_EXTENSION
is > 0.

So, if we introduce an extension and allow for it to be removed with a higher extension number,
when we add testing support for that extension we'd have to change the capability check,
but the existing test case would not break.

I guess the most flexible way would be to initialize the array in the middle of main, then
you could do .skip = !extension_cap and in the future whatever expression makes sense, but
it's kinda ugly and should not be necessary anyway.
> 
> But I can still turn the bool into a numeric to make it a little bit more flexible for future use.
> 
>  Thomas
> 


  reply	other threads:[~2022-04-20 10:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-14 10:53 [PATCH 0/4] KVM: s390: selftests: Provide TAP output in tests Thomas Huth
2022-04-14 10:53 ` [PATCH 1/4] KVM: s390: selftests: Use TAP interface in the memop test Thomas Huth
2022-04-14 12:48   ` Janis Schoetterl-Glausch
2022-04-19 17:40     ` Thomas Huth
2022-04-20 10:55       ` Janis Schoetterl-Glausch [this message]
2022-04-14 10:53 ` [PATCH 2/4] KVM: s390: selftests: Use TAP interface in the sync_regs test Thomas Huth
2022-04-14 11:39   ` Claudio Imbrenda
2022-04-14 12:02     ` Thomas Huth
2022-04-14 10:53 ` [PATCH 3/4] KVM: s390: selftests: Use TAP interface in the tprot test Thomas Huth
2022-04-14 11:51   ` Claudio Imbrenda
2022-04-14 12:08     ` Thomas Huth
2022-04-14 12:33       ` Janis Schoetterl-Glausch
2022-04-19 17:45         ` Thomas Huth
2022-04-14 10:53 ` [PATCH 4/4] KVM: s390: selftests: Use TAP interface in the reset test Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2eb0545c-7ffd-fe3a-b6ad-d30ba7bd9177@linux.ibm.com \
    --to=scgl@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=shuah@kernel.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.