diff mbox series

[2/5] kselftest: Fix vdso_test_time to pass on skips

Message ID 20220126102723.23300-3-cristian.marussi@arm.com
State New
Headers show
Series kselftest: Fix vdso_test_abi return status | expand

Commit Message

Cristian Marussi Jan. 26, 2022, 10:27 a.m. UTC
When a vDSO symbol is not found, all the testcases in vdso_test_abi usually
report a SKIP, which, in turn, is reported back to Kselftest as a PASS.

Testcase vdso_test_time, instead, reporting a SKIP, causes the whole set of
tests within vdso_test_abi to be considered FAIL when symbol is not found.

Fix it reporting a PASS when vdso_test_time cannot find the vdso symbol.

Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
Seen as a failure on both a JUNO and a Dragonboard on both recent and old
kernels/testruns:

root@deb-buster-arm64:~# /opt/ksft/vDSO/vdso_test_abi
[vDSO kselftest] VDSO_VERSION: LINUX_2.6.39
The time is 1637922136.675304
The time is 1637922136.675361000
The resolution is 0 1
clock_id: CLOCK_REALTIME [PASS]
The time is 1927.760604900
The resolution is 0 1
clock_id: CLOCK_BOOTTIME [PASS]
The time is 1637922136.675649700
The resolution is 0 1
clock_id: CLOCK_TAI [PASS]
The time is 1637922136.672000000
The resolution is 0 4000000
clock_id: CLOCK_REALTIME_COARSE [PASS]
The time is 1927.761005600
The resolution is 0 1
clock_id: CLOCK_MONOTONIC [PASS]
The time is 1927.761132780
The resolution is 0 1
clock_id: CLOCK_MONOTONIC_RAW [PASS]
The time is 1927.757093740
The resolution is 0 4000000
clock_id: CLOCK_MONOTONIC_COARSE [PASS]
Could not find __kernel_time              <<< This caused a FAIL as a whole
root@deb-buster-arm64:~# echo $?
1

e.g.: https://lkft.validation.linaro.org/scheduler/job/2192570#L27778
---
 tools/testing/selftests/vDSO/vdso_test_abi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Vincenzo Frascino Jan. 26, 2022, 12:22 p.m. UTC | #1
Hi Cristian,

On 1/26/22 10:27 AM, Cristian Marussi wrote:
> When a vDSO symbol is not found, all the testcases in vdso_test_abi usually
> report a SKIP, which, in turn, is reported back to Kselftest as a PASS.
> 
> Testcase vdso_test_time, instead, reporting a SKIP, causes the whole set of
> tests within vdso_test_abi to be considered FAIL when symbol is not found.
> 
> Fix it reporting a PASS when vdso_test_time cannot find the vdso symbol.
> 
> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> ---
> Seen as a failure on both a JUNO and a Dragonboard on both recent and old
> kernels/testruns:
> 
> root@deb-buster-arm64:~# /opt/ksft/vDSO/vdso_test_abi
> [vDSO kselftest] VDSO_VERSION: LINUX_2.6.39
> The time is 1637922136.675304
> The time is 1637922136.675361000
> The resolution is 0 1
> clock_id: CLOCK_REALTIME [PASS]
> The time is 1927.760604900
> The resolution is 0 1
> clock_id: CLOCK_BOOTTIME [PASS]
> The time is 1637922136.675649700
> The resolution is 0 1
> clock_id: CLOCK_TAI [PASS]
> The time is 1637922136.672000000
> The resolution is 0 4000000
> clock_id: CLOCK_REALTIME_COARSE [PASS]
> The time is 1927.761005600
> The resolution is 0 1
> clock_id: CLOCK_MONOTONIC [PASS]
> The time is 1927.761132780
> The resolution is 0 1
> clock_id: CLOCK_MONOTONIC_RAW [PASS]
> The time is 1927.757093740
> The resolution is 0 4000000
> clock_id: CLOCK_MONOTONIC_COARSE [PASS]
> Could not find __kernel_time              <<< This caused a FAIL as a whole
> root@deb-buster-arm64:~# echo $?
> 1
> 
> e.g.: https://lkft.validation.linaro.org/scheduler/job/2192570#L27778
> ---
>  tools/testing/selftests/vDSO/vdso_test_abi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/vDSO/vdso_test_abi.c b/tools/testing/selftests/vDSO/vdso_test_abi.c
> index 3d603f1394af..7dcc66d1cecf 100644
> --- a/tools/testing/selftests/vDSO/vdso_test_abi.c
> +++ b/tools/testing/selftests/vDSO/vdso_test_abi.c
> @@ -90,8 +90,9 @@ static int vdso_test_time(void)
>  		(vdso_time_t)vdso_sym(version, name[2]);
>  
>  	if (!vdso_time) {
> +		/* Skip if symbol not found: consider skipped tests as passed */
>  		printf("Could not find %s\n", name[2]);
> -		return KSFT_SKIP;
> +		return KSFT_PASS;

My preference would be to keep "KSFT_SKIP" here and verify separately the return
status of each test. This would maintain compliance with the kselftest API.
Could you please test the patch in-reply-to this one (will be sent shortly) and
let me know if it works for you?

If it does feel free to fold it in the next version of your series with your
"Tested-by:" otherwise let me know.

Thanks!

>  	}
>  
>  	long ret = vdso_time(NULL);
>
Cristian Marussi Jan. 26, 2022, 12:34 p.m. UTC | #2
On Wed, Jan 26, 2022 at 12:22:45PM +0000, Vincenzo Frascino wrote:
> Hi Cristian,
> 

Hi Vincenzo,

thanks for the feedback.

> On 1/26/22 10:27 AM, Cristian Marussi wrote:
> > When a vDSO symbol is not found, all the testcases in vdso_test_abi usually
> > report a SKIP, which, in turn, is reported back to Kselftest as a PASS.
> > 
> > Testcase vdso_test_time, instead, reporting a SKIP, causes the whole set of
> > tests within vdso_test_abi to be considered FAIL when symbol is not found.
> > 
> > Fix it reporting a PASS when vdso_test_time cannot find the vdso symbol.
> > 
> > Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
> > Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> > ---
> > Seen as a failure on both a JUNO and a Dragonboard on both recent and old
> > kernels/testruns:
> > 
> > root@deb-buster-arm64:~# /opt/ksft/vDSO/vdso_test_abi
> > [vDSO kselftest] VDSO_VERSION: LINUX_2.6.39
> > The time is 1637922136.675304
> > The time is 1637922136.675361000
> > The resolution is 0 1
> > clock_id: CLOCK_REALTIME [PASS]
> > The time is 1927.760604900
> > The resolution is 0 1
> > clock_id: CLOCK_BOOTTIME [PASS]
> > The time is 1637922136.675649700
> > The resolution is 0 1
> > clock_id: CLOCK_TAI [PASS]
> > The time is 1637922136.672000000
> > The resolution is 0 4000000
> > clock_id: CLOCK_REALTIME_COARSE [PASS]
> > The time is 1927.761005600
> > The resolution is 0 1
> > clock_id: CLOCK_MONOTONIC [PASS]
> > The time is 1927.761132780
> > The resolution is 0 1
> > clock_id: CLOCK_MONOTONIC_RAW [PASS]
> > The time is 1927.757093740
> > The resolution is 0 4000000
> > clock_id: CLOCK_MONOTONIC_COARSE [PASS]
> > Could not find __kernel_time              <<< This caused a FAIL as a whole
> > root@deb-buster-arm64:~# echo $?
> > 1
> > 
> > e.g.: https://lkft.validation.linaro.org/scheduler/job/2192570#L27778
> > ---
> >  tools/testing/selftests/vDSO/vdso_test_abi.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/testing/selftests/vDSO/vdso_test_abi.c b/tools/testing/selftests/vDSO/vdso_test_abi.c
> > index 3d603f1394af..7dcc66d1cecf 100644
> > --- a/tools/testing/selftests/vDSO/vdso_test_abi.c
> > +++ b/tools/testing/selftests/vDSO/vdso_test_abi.c
> > @@ -90,8 +90,9 @@ static int vdso_test_time(void)
> >  		(vdso_time_t)vdso_sym(version, name[2]);
> >  
> >  	if (!vdso_time) {
> > +		/* Skip if symbol not found: consider skipped tests as passed */
> >  		printf("Could not find %s\n", name[2]);
> > -		return KSFT_SKIP;
> > +		return KSFT_PASS;
> 
> My preference would be to keep "KSFT_SKIP" here and verify separately the return
> status of each test. This would maintain compliance with the kselftest API.
> Could you please test the patch in-reply-to this one (will be sent shortly) and
> let me know if it works for you?
> 
Sure, I was indeed not sure my solution was what you wanted.

> If it does feel free to fold it in the next version of your series with your
> "Tested-by:" otherwise let me know.

Sure, I'll do and keep you on CC.

Thanks,
Cristian
Vincenzo Frascino Jan. 26, 2022, 3:26 p.m. UTC | #3
Hi Cristian,

On 1/26/22 12:34 PM, Cristian Marussi wrote:
> Sure, I was indeed not sure my solution was what you wanted.
> 

Not a problem and more then anything thank you for reporting the issue.

>> If it does feel free to fold it in the next version of your series with your
>> "Tested-by:" otherwise let me know.
> Sure, I'll do and keep you on CC.

Thanks!
Shuah Khan Jan. 27, 2022, 11:02 p.m. UTC | #4
On 1/26/22 3:27 AM, Cristian Marussi wrote:
> When a vDSO symbol is not found, all the testcases in vdso_test_abi usually
> report a SKIP, which, in turn, is reported back to Kselftest as a PASS.
> 
> Testcase vdso_test_time, instead, reporting a SKIP, causes the whole set of
> tests within vdso_test_abi to be considered FAIL when symbol is not found.
> 
> Fix it reporting a PASS when vdso_test_time cannot find the vdso symbol.
> 
> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> ---
> Seen as a failure on both a JUNO and a Dragonboard on both recent and old
> kernels/testruns:
> 
> root@deb-buster-arm64:~# /opt/ksft/vDSO/vdso_test_abi
> [vDSO kselftest] VDSO_VERSION: LINUX_2.6.39
> The time is 1637922136.675304
> The time is 1637922136.675361000
> The resolution is 0 1
> clock_id: CLOCK_REALTIME [PASS]
> The time is 1927.760604900
> The resolution is 0 1
> clock_id: CLOCK_BOOTTIME [PASS]
> The time is 1637922136.675649700
> The resolution is 0 1
> clock_id: CLOCK_TAI [PASS]
> The time is 1637922136.672000000
> The resolution is 0 4000000
> clock_id: CLOCK_REALTIME_COARSE [PASS]
> The time is 1927.761005600
> The resolution is 0 1
> clock_id: CLOCK_MONOTONIC [PASS]
> The time is 1927.761132780
> The resolution is 0 1
> clock_id: CLOCK_MONOTONIC_RAW [PASS]
> The time is 1927.757093740
> The resolution is 0 4000000
> clock_id: CLOCK_MONOTONIC_COARSE [PASS]
> Could not find __kernel_time              <<< This caused a FAIL as a whole
> root@deb-buster-arm64:~# echo $?
> 1
> 
> e.g.: https://lkft.validation.linaro.org/scheduler/job/2192570#L27778
> ---
>   tools/testing/selftests/vDSO/vdso_test_abi.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/vDSO/vdso_test_abi.c b/tools/testing/selftests/vDSO/vdso_test_abi.c
> index 3d603f1394af..7dcc66d1cecf 100644
> --- a/tools/testing/selftests/vDSO/vdso_test_abi.c
> +++ b/tools/testing/selftests/vDSO/vdso_test_abi.c
> @@ -90,8 +90,9 @@ static int vdso_test_time(void)
>   		(vdso_time_t)vdso_sym(version, name[2]);
>   
>   	if (!vdso_time) {
> +		/* Skip if symbol not found: consider skipped tests as passed */
>   		printf("Could not find %s\n", name[2]);
> -		return KSFT_SKIP;
> +		return KSFT_PASS;

Skip is a the right option here. Pass indicates that the functionality
has been tested and it passed. There is a clear message that says that
the symbol isn't found

thanks,
-- Shuah
diff mbox series

Patch

diff --git a/tools/testing/selftests/vDSO/vdso_test_abi.c b/tools/testing/selftests/vDSO/vdso_test_abi.c
index 3d603f1394af..7dcc66d1cecf 100644
--- a/tools/testing/selftests/vDSO/vdso_test_abi.c
+++ b/tools/testing/selftests/vDSO/vdso_test_abi.c
@@ -90,8 +90,9 @@  static int vdso_test_time(void)
 		(vdso_time_t)vdso_sym(version, name[2]);
 
 	if (!vdso_time) {
+		/* Skip if symbol not found: consider skipped tests as passed */
 		printf("Could not find %s\n", name[2]);
-		return KSFT_SKIP;
+		return KSFT_PASS;
 	}
 
 	long ret = vdso_time(NULL);