Message ID | 20240602132502.4186771-1-usama.anjum@collabora.com |
---|---|
State | Accepted |
Commit | 9de9c4cc03add590f99aa5fabbe8f5850e34837c |
Headers | show |
Series | [1/2] selftests: arm64: tags_test: conform test to TAP output | expand |
Kind reminder. This two patch series is removing a script which was marking test pass/fail by adding pass/fail logic inside the test itself. On 7/1/24 1:40 PM, Muhammad Usama Anjum wrote: > Soft reminder > > On 6/2/24 6:24 PM, Muhammad Usama Anjum wrote: >> Conform the layout, informational and status messages to TAP. No >> functional change is intended other than the layout of output messages. >> >> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com> >> --- >> tools/testing/selftests/arm64/tags/tags_test.c | 10 ++++++---- >> 1 file changed, 6 insertions(+), 4 deletions(-) >> >> diff --git a/tools/testing/selftests/arm64/tags/tags_test.c b/tools/testing/selftests/arm64/tags/tags_test.c >> index 955f87c1170d7..8ae26e496c89c 100644 >> --- a/tools/testing/selftests/arm64/tags/tags_test.c >> +++ b/tools/testing/selftests/arm64/tags/tags_test.c >> @@ -17,19 +17,21 @@ int main(void) >> static int tbi_enabled = 0; >> unsigned long tag = 0; >> struct utsname *ptr; >> - int err; >> + >> + ksft_print_header(); >> + ksft_set_plan(1); >> >> if (prctl(PR_SET_TAGGED_ADDR_CTRL, PR_TAGGED_ADDR_ENABLE, 0, 0, 0) == 0) >> tbi_enabled = 1; >> ptr = (struct utsname *)malloc(sizeof(*ptr)); >> if (!ptr) >> - ksft_exit_fail_msg("Failed to allocate utsname buffer\n"); >> + ksft_exit_fail_perror("Failed to allocate utsname buffer"); >> >> if (tbi_enabled) >> tag = 0x42; >> ptr = (struct utsname *)SET_TAG(ptr, tag); >> - err = uname(ptr); >> + ksft_test_result(!uname(ptr), "Syscall successful with tagged address\n"); >> free(ptr); >> >> - return err; >> + ksft_finished(); >> } >
On Sun, Jun 02, 2024 at 06:24:59PM +0500, Muhammad Usama Anjum wrote: > Conform the layout, informational and status messages to TAP. No > functional change is intended other than the layout of output messages. > > Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com> > --- > tools/testing/selftests/arm64/tags/tags_test.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/tools/testing/selftests/arm64/tags/tags_test.c b/tools/testing/selftests/arm64/tags/tags_test.c > index 955f87c1170d7..8ae26e496c89c 100644 > --- a/tools/testing/selftests/arm64/tags/tags_test.c > +++ b/tools/testing/selftests/arm64/tags/tags_test.c > @@ -17,19 +17,21 @@ int main(void) > static int tbi_enabled = 0; > unsigned long tag = 0; > struct utsname *ptr; > - int err; > + > + ksft_print_header(); > + ksft_set_plan(1); > > if (prctl(PR_SET_TAGGED_ADDR_CTRL, PR_TAGGED_ADDR_ENABLE, 0, 0, 0) == 0) > tbi_enabled = 1; > ptr = (struct utsname *)malloc(sizeof(*ptr)); > if (!ptr) > - ksft_exit_fail_msg("Failed to allocate utsname buffer\n"); > + ksft_exit_fail_perror("Failed to allocate utsname buffer"); > > if (tbi_enabled) > tag = 0x42; > ptr = (struct utsname *)SET_TAG(ptr, tag); > - err = uname(ptr); > + ksft_test_result(!uname(ptr), "Syscall successful with tagged address\n"); > free(ptr); > > - return err; > + ksft_finished(); > } Sorry, these patches slipped through the cracks. We seem to be pretty inconsistent with using ksft_exit_fail_perror() and ksft_finished(). Is there some plan to update the rest or is it only this location that you came across? Adding Mark Brown as well to this thread, he's been contributing quite a lot recently to the arm64 kselftests.
On Wed, Jul 10, 2024 at 12:31:21PM +0100, Catalin Marinas wrote: > Sorry, these patches slipped through the cracks. We seem to be pretty > inconsistent with using ksft_exit_fail_perror() and ksft_finished(). Is > there some plan to update the rest or is it only this location that you > came across? Any ksft_exit_*() should implicitly do a ksft_finished(), the _exit_ will just exit the test program immediately. ksft_finished() is for normal exit from the test program after running everything.
diff --git a/tools/testing/selftests/arm64/tags/tags_test.c b/tools/testing/selftests/arm64/tags/tags_test.c index 955f87c1170d7..8ae26e496c89c 100644 --- a/tools/testing/selftests/arm64/tags/tags_test.c +++ b/tools/testing/selftests/arm64/tags/tags_test.c @@ -17,19 +17,21 @@ int main(void) static int tbi_enabled = 0; unsigned long tag = 0; struct utsname *ptr; - int err; + + ksft_print_header(); + ksft_set_plan(1); if (prctl(PR_SET_TAGGED_ADDR_CTRL, PR_TAGGED_ADDR_ENABLE, 0, 0, 0) == 0) tbi_enabled = 1; ptr = (struct utsname *)malloc(sizeof(*ptr)); if (!ptr) - ksft_exit_fail_msg("Failed to allocate utsname buffer\n"); + ksft_exit_fail_perror("Failed to allocate utsname buffer"); if (tbi_enabled) tag = 0x42; ptr = (struct utsname *)SET_TAG(ptr, tag); - err = uname(ptr); + ksft_test_result(!uname(ptr), "Syscall successful with tagged address\n"); free(ptr); - return err; + ksft_finished(); }
Conform the layout, informational and status messages to TAP. No functional change is intended other than the layout of output messages. Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com> --- tools/testing/selftests/arm64/tags/tags_test.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)