[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <07576ae9-9798-316f-d33e-10c91faeebfb@linux.ibm.com>
Date: Tue, 14 Jun 2022 12:38:37 +0200
From: Janis Schoetterl-Glausch <scgl@...ux.ibm.com>
To: Thomas Huth <thuth@...hat.com>, kvm@...r.kernel.org,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Janosch Frank <frankja@...ux.ibm.com>,
Claudio Imbrenda <imbrenda@...ux.ibm.com>
Cc: linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
David Hildenbrand <david@...hat.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Shuah Khan <shuah@...nel.org>, linux-s390@...r.kernel.org
Subject: Re: [PATCH v4 1/4] KVM: s390: selftests: Use TAP interface in the
memop test
On 5/31/22 12:15, 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.
>
> Reviewed-by: Janosch Frank <frankja@...ux.ibm.com>
> Signed-off-by: Thomas Huth <thuth@...hat.com>
> ---
> tools/testing/selftests/kvm/s390x/memop.c | 95 ++++++++++++++++++-----
> 1 file changed, 77 insertions(+), 18 deletions(-)
>
> diff --git a/tools/testing/selftests/kvm/s390x/memop.c b/tools/testing/selftests/kvm/s390x/memop.c
> index 49f26f544127..e704c6fa5758 100644
> --- a/tools/testing/selftests/kvm/s390x/memop.c
> +++ b/tools/testing/selftests/kvm/s390x/memop.c
> @@ -14,6 +14,7 @@
>
[...]
> int main(int argc, char *argv[])
> {
> - int memop_cap, extension_cap;
> + int memop_cap, extension_cap, idx;
>
> setbuf(stdout, NULL); /* Tell stdout not to buffer its content */
>
> + ksft_print_header();
> +
> memop_cap = kvm_check_cap(KVM_CAP_S390_MEM_OP);
> extension_cap = kvm_check_cap(KVM_CAP_S390_MEM_OP_EXTENSION);
> if (!memop_cap) {
> - print_skip("CAP_S390_MEM_OP not supported");
> - exit(KSFT_SKIP);
> + ksft_exit_skip("CAP_S390_MEM_OP not supported.\n");
> }
>
> - test_copy();
> - if (extension_cap > 0) {
> - test_copy_key();
> - test_copy_key_storage_prot_override();
> - test_copy_key_fetch_prot();
> - test_copy_key_fetch_prot_override();
> - test_errors_key();
> - test_termination();
> - test_errors_key_storage_prot_override();
> - test_errors_key_fetch_prot_override_not_enabled();
> - test_errors_key_fetch_prot_override_enabled();
> - } else {
> - print_skip("storage key memop extension not supported");
> + ksft_set_plan(ARRAY_SIZE(testlist));
> +
> + for (idx = 0; idx < ARRAY_SIZE(testlist); idx++) {
> + if (testlist[idx].extension >= extension_cap) {
This is reversed, should be
if (testlist[idx].extension <= extension_cap) {
or
if (extension_cap >= testlist[idx].extension) {
I'd prefer the latter.
> + testlist[idx].test();
> + ksft_test_result_pass("%s\n", testlist[idx].name);
> + } else {
> + ksft_test_result_skip("%s - extension level %d not supported\n",
> + testlist[idx].name,
> + testlist[idx].extension);
> + }
> }
> - test_errors();
>
> - return 0;
> + ksft_finished(); /* Print results and exit() accordingly */
> }
Powered by blists - more mailing lists