* [PATCH 1/2] selftests: arm64: tags_test: conform test to TAP output
@ 2024-06-02 13:24 Muhammad Usama Anjum
2024-06-02 13:25 ` [PATCH 2/2] selftests: arm64: tags: remove the result script Muhammad Usama Anjum
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Muhammad Usama Anjum @ 2024-06-02 13:24 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon, Shuah Khan, Muhammad Usama Anjum,
Kunwu Chan
Cc: kernel, linux-arm-kernel, linux-kselftest, linux-kernel
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();
}
--
2.39.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] selftests: arm64: tags: remove the result script
2024-06-02 13:24 [PATCH 1/2] selftests: arm64: tags_test: conform test to TAP output Muhammad Usama Anjum
@ 2024-06-02 13:25 ` Muhammad Usama Anjum
2024-07-01 8:40 ` [PATCH 1/2] selftests: arm64: tags_test: conform test to TAP output Muhammad Usama Anjum
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Muhammad Usama Anjum @ 2024-06-02 13:25 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon, Shuah Khan, Muhammad Usama Anjum
Cc: kernel, linux-kernel, linux-arm-kernel, linux-kselftest
The run_tags_test.sh script is used to run tags_test and print out if
the test succeeded or failed. As tags_test has been TAP conformed, this
script is unneeded and hence can be removed.
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
make run_tests TARGETS="arm64/tags"
Before:
➜ selftests make run_tests TARGETS="arm64/tags"
TAP version 13
1..2
# timeout set to 45
# selftests: arm64/tags: tags_test
# TAP version 13
# 1..1
# ok 1 Syscall successful
# # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
ok 1 selftests: arm64/tags: tags_test
# timeout set to 45
# selftests: arm64/tags: run_tags_test.sh
# --------------------
# running tags test
# --------------------
# TAP version 13
# 1..1
# ok 1 Syscall successful
# # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
# [PASS]
ok 2 selftests: arm64/tags: run_tags_test.sh
After:
➜ selftests make run_tests TARGETS="arm64/tags"
TAP version 13
1..1
# timeout set to 45
# selftests: arm64/tags: tags_test
# TAP version 13
# 1..1
# ok 1 Syscall successful
# # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
ok 1 selftests: arm64/tags: tags_test
make[1]: Leaving directory '/home/ubuntu/repos/kernel/linux_mainline/tools/testing/selftests/arm64/tags'
---
tools/testing/selftests/arm64/tags/Makefile | 1 -
tools/testing/selftests/arm64/tags/run_tags_test.sh | 12 ------------
2 files changed, 13 deletions(-)
delete mode 100755 tools/testing/selftests/arm64/tags/run_tags_test.sh
diff --git a/tools/testing/selftests/arm64/tags/Makefile b/tools/testing/selftests/arm64/tags/Makefile
index 6d29cfde43a21..0a77f35295fb6 100644
--- a/tools/testing/selftests/arm64/tags/Makefile
+++ b/tools/testing/selftests/arm64/tags/Makefile
@@ -2,6 +2,5 @@
CFLAGS += $(KHDR_INCLUDES)
TEST_GEN_PROGS := tags_test
-TEST_PROGS := run_tags_test.sh
include ../../lib.mk
diff --git a/tools/testing/selftests/arm64/tags/run_tags_test.sh b/tools/testing/selftests/arm64/tags/run_tags_test.sh
deleted file mode 100755
index 745f113799303..0000000000000
--- a/tools/testing/selftests/arm64/tags/run_tags_test.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0
-
-echo "--------------------"
-echo "running tags test"
-echo "--------------------"
-./tags_test
-if [ $? -ne 0 ]; then
- echo "[FAIL]"
-else
- echo "[PASS]"
-fi
--
2.39.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] selftests: arm64: tags_test: conform test to TAP output
2024-06-02 13:24 [PATCH 1/2] selftests: arm64: tags_test: conform test to TAP output Muhammad Usama Anjum
2024-06-02 13:25 ` [PATCH 2/2] selftests: arm64: tags: remove the result script Muhammad Usama Anjum
@ 2024-07-01 8:40 ` Muhammad Usama Anjum
2024-07-10 9:35 ` Muhammad Usama Anjum
2024-07-10 11:31 ` Catalin Marinas
2024-07-11 18:48 ` Catalin Marinas
3 siblings, 1 reply; 8+ messages in thread
From: Muhammad Usama Anjum @ 2024-07-01 8:40 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon, Shuah Khan, Kunwu Chan, Mark Brown
Cc: Muhammad Usama Anjum, kernel, linux-arm-kernel, linux-kselftest,
linux-kernel
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();
> }
--
BR,
Muhammad Usama Anjum
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] selftests: arm64: tags_test: conform test to TAP output
2024-07-01 8:40 ` [PATCH 1/2] selftests: arm64: tags_test: conform test to TAP output Muhammad Usama Anjum
@ 2024-07-10 9:35 ` Muhammad Usama Anjum
0 siblings, 0 replies; 8+ messages in thread
From: Muhammad Usama Anjum @ 2024-07-10 9:35 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon, Kunwu Chan, Mark Brown
Cc: Muhammad Usama Anjum, kernel, linux-arm-kernel, linux-kselftest,
linux-kernel, Shuah Khan
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();
>> }
>
--
BR,
Muhammad Usama Anjum
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] selftests: arm64: tags_test: conform test to TAP output
2024-06-02 13:24 [PATCH 1/2] selftests: arm64: tags_test: conform test to TAP output Muhammad Usama Anjum
2024-06-02 13:25 ` [PATCH 2/2] selftests: arm64: tags: remove the result script Muhammad Usama Anjum
2024-07-01 8:40 ` [PATCH 1/2] selftests: arm64: tags_test: conform test to TAP output Muhammad Usama Anjum
@ 2024-07-10 11:31 ` Catalin Marinas
2024-07-10 13:10 ` Mark Brown
2024-07-11 6:13 ` Muhammad Usama Anjum
2024-07-11 18:48 ` Catalin Marinas
3 siblings, 2 replies; 8+ messages in thread
From: Catalin Marinas @ 2024-07-10 11:31 UTC (permalink / raw)
To: Muhammad Usama Anjum
Cc: Will Deacon, Shuah Khan, Kunwu Chan, kernel, linux-arm-kernel,
linux-kselftest, linux-kernel, Mark Brown
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.
--
Catalin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] selftests: arm64: tags_test: conform test to TAP output
2024-07-10 11:31 ` Catalin Marinas
@ 2024-07-10 13:10 ` Mark Brown
2024-07-11 6:13 ` Muhammad Usama Anjum
1 sibling, 0 replies; 8+ messages in thread
From: Mark Brown @ 2024-07-10 13:10 UTC (permalink / raw)
To: Catalin Marinas
Cc: Muhammad Usama Anjum, Will Deacon, Shuah Khan, Kunwu Chan, kernel,
linux-arm-kernel, linux-kselftest, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 500 bytes --]
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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] selftests: arm64: tags_test: conform test to TAP output
2024-07-10 11:31 ` Catalin Marinas
2024-07-10 13:10 ` Mark Brown
@ 2024-07-11 6:13 ` Muhammad Usama Anjum
1 sibling, 0 replies; 8+ messages in thread
From: Muhammad Usama Anjum @ 2024-07-11 6:13 UTC (permalink / raw)
To: Catalin Marinas
Cc: Muhammad Usama Anjum, Will Deacon, Shuah Khan, Kunwu Chan, kernel,
linux-arm-kernel, linux-kselftest, linux-kernel, Mark Brown
On 7/10/24 4:31 PM, Catalin Marinas wrote:
> 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?
Ideally we would want that all the test are updated to output better logs
than what they have currently. We may update some more tests. This is
something we want the maintainers to get aware of that kselftest.h wrapper
provide helper function to better write the tests and then all contributors
start using it in new tests and older tests may also get updated in the
process.
>
> Adding Mark Brown as well to this thread, he's been contributing quite a
> lot recently to the arm64 kselftests.
>
--
BR,
Muhammad Usama Anjum
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] selftests: arm64: tags_test: conform test to TAP output
2024-06-02 13:24 [PATCH 1/2] selftests: arm64: tags_test: conform test to TAP output Muhammad Usama Anjum
` (2 preceding siblings ...)
2024-07-10 11:31 ` Catalin Marinas
@ 2024-07-11 18:48 ` Catalin Marinas
3 siblings, 0 replies; 8+ messages in thread
From: Catalin Marinas @ 2024-07-11 18:48 UTC (permalink / raw)
To: Will Deacon, Shuah Khan, Kunwu Chan, Muhammad Usama Anjum
Cc: kernel, linux-arm-kernel, linux-kselftest, linux-kernel
On Sun, 02 Jun 2024 18:24:59 +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.
>
>
Applied to arm64 (for-next/kselftest), thanks!
[1/2] selftests: arm64: tags_test: conform test to TAP output
https://git.kernel.org/arm64/c/9de9c4cc03ad
[2/2] selftests: arm64: tags: remove the result script
https://git.kernel.org/arm64/c/6e3bc73be02b
--
Catalin
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-07-11 18:48 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-02 13:24 [PATCH 1/2] selftests: arm64: tags_test: conform test to TAP output Muhammad Usama Anjum
2024-06-02 13:25 ` [PATCH 2/2] selftests: arm64: tags: remove the result script Muhammad Usama Anjum
2024-07-01 8:40 ` [PATCH 1/2] selftests: arm64: tags_test: conform test to TAP output Muhammad Usama Anjum
2024-07-10 9:35 ` Muhammad Usama Anjum
2024-07-10 11:31 ` Catalin Marinas
2024-07-10 13:10 ` Mark Brown
2024-07-11 6:13 ` Muhammad Usama Anjum
2024-07-11 18:48 ` Catalin Marinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox