public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 1/2] clock_getres01: drop case which is passing NULL res parameter
@ 2019-08-09 14:31 Jan Stancek
  2019-08-09 14:31 ` [LTP] [PATCH v2 2/2] clock_getres01: add test variants Jan Stancek
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Jan Stancek @ 2019-08-09 14:31 UTC (permalink / raw)
  To: ltp

Since commit a9446a906f52 ("lib/vdso/32: Remove inconsistent NULL pointer checks")
VDSO treats NULL parameter differently than in syscall.

Drop NULL parameter, subsequent patch will add test variants that test NULL
res parameter using syscall.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/syscalls/clock_getres/clock_getres01.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/testcases/kernel/syscalls/clock_getres/clock_getres01.c b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
index 15f32310839a..df3e84271ad9 100644
--- a/testcases/kernel/syscalls/clock_getres/clock_getres01.c
+++ b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
@@ -28,7 +28,6 @@ static struct test_case {
 	{"MONOTONIC", CLOCK_MONOTONIC, &res, 0, 0},
 	{"PROCESS_CPUTIME_ID", CLOCK_PROCESS_CPUTIME_ID, &res, 0, 0},
 	{"THREAD_CPUTIME_ID", CLOCK_THREAD_CPUTIME_ID, &res, 0, 0},
-	{"REALTIME", CLOCK_REALTIME, NULL, 0, 0},
 	{"CLOCK_MONOTONIC_RAW", CLOCK_MONOTONIC_RAW, &res, 0, 0,},
 	{"CLOCK_REALTIME_COARSE", CLOCK_REALTIME_COARSE, &res, 0, 0,},
 	{"CLOCK_MONOTONIC_COARSE", CLOCK_MONOTONIC_COARSE, &res, 0, 0,},
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [LTP] [PATCH v2 2/2] clock_getres01: add test variants
  2019-08-09 14:31 [LTP] [PATCH v2 1/2] clock_getres01: drop case which is passing NULL res parameter Jan Stancek
@ 2019-08-09 14:31 ` Jan Stancek
  2019-08-12  4:52   ` Li Wang
  2019-08-13 12:13   ` Cyril Hrubis
  2019-08-12  4:52 ` [LTP] [PATCH v2 1/2] clock_getres01: drop case which is passing NULL res parameter Li Wang
  2019-08-13 12:12 ` Cyril Hrubis
  2 siblings, 2 replies; 9+ messages in thread
From: Jan Stancek @ 2019-08-09 14:31 UTC (permalink / raw)
  To: ltp

0 - default, could be either VDSO or syscall
1 - syscall with valid res parameter
2 - syscall with NULL res parameter

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/syscalls/clock_getres/clock_getres01.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/clock_getres/clock_getres01.c b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
index df3e84271ad9..a4134bc1d3c2 100644
--- a/testcases/kernel/syscalls/clock_getres/clock_getres01.c
+++ b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
@@ -13,6 +13,7 @@
 #include <errno.h>
 
 #include "tst_test.h"
+#include "lapi/syscalls.h"
 #include "lapi/posix_clocks.h"
 
 static struct timespec res;
@@ -39,7 +40,18 @@ static struct test_case {
 
 static void do_test(unsigned int i)
 {
-	TEST(clock_getres(tcase[i].clk_id, tcase[i].res));
+	switch (tst_variant) {
+	case 0:
+		TEST(clock_getres(tcase[i].clk_id, tcase[i].res));
+		break;
+	case 1:
+		TEST(tst_syscall(__NR_clock_getres, tcase[i].clk_id,
+			tcase[i].res));
+		break;
+	case 2:
+		TEST(tst_syscall(__NR_clock_getres, tcase[i].clk_id, NULL));
+		break;
+	}
 
 	if (TST_RET != tcase[i].ret) {
 		if (TST_ERR == EINVAL) {
@@ -64,4 +76,5 @@ static void do_test(unsigned int i)
 static struct tst_test test = {
 	.test = do_test,
 	.tcnt = ARRAY_SIZE(tcase),
+	.test_variants = 3,
 };
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [LTP] [PATCH v2 1/2] clock_getres01: drop case which is passing NULL res parameter
  2019-08-09 14:31 [LTP] [PATCH v2 1/2] clock_getres01: drop case which is passing NULL res parameter Jan Stancek
  2019-08-09 14:31 ` [LTP] [PATCH v2 2/2] clock_getres01: add test variants Jan Stancek
@ 2019-08-12  4:52 ` Li Wang
  2019-08-13 12:12 ` Cyril Hrubis
  2 siblings, 0 replies; 9+ messages in thread
From: Li Wang @ 2019-08-12  4:52 UTC (permalink / raw)
  To: ltp

On Fri, Aug 9, 2019 at 10:32 PM Jan Stancek <jstancek@redhat.com> wrote:
>
> Since commit a9446a906f52 ("lib/vdso/32: Remove inconsistent NULL pointer checks")
> VDSO treats NULL parameter differently than in syscall.
>
> Drop NULL parameter, subsequent patch will add test variants that test NULL
> res parameter using syscall.
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Li Wang <liwang@redhat.com>

-- 
Regards,
Li Wang

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH v2 2/2] clock_getres01: add test variants
  2019-08-09 14:31 ` [LTP] [PATCH v2 2/2] clock_getres01: add test variants Jan Stancek
@ 2019-08-12  4:52   ` Li Wang
  2019-08-13 12:13   ` Cyril Hrubis
  1 sibling, 0 replies; 9+ messages in thread
From: Li Wang @ 2019-08-12  4:52 UTC (permalink / raw)
  To: ltp

On Fri, Aug 9, 2019 at 10:32 PM Jan Stancek <jstancek@redhat.com> wrote:
>
> 0 - default, could be either VDSO or syscall
> 1 - syscall with valid res parameter
> 2 - syscall with NULL res parameter
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Li Wang <liwang@redhat.com>

-- 
Regards,
Li Wang

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH v2 1/2] clock_getres01: drop case which is passing NULL res parameter
  2019-08-09 14:31 [LTP] [PATCH v2 1/2] clock_getres01: drop case which is passing NULL res parameter Jan Stancek
  2019-08-09 14:31 ` [LTP] [PATCH v2 2/2] clock_getres01: add test variants Jan Stancek
  2019-08-12  4:52 ` [LTP] [PATCH v2 1/2] clock_getres01: drop case which is passing NULL res parameter Li Wang
@ 2019-08-13 12:12 ` Cyril Hrubis
  2019-08-13 12:26   ` Jan Stancek
  2 siblings, 1 reply; 9+ messages in thread
From: Cyril Hrubis @ 2019-08-13 12:12 UTC (permalink / raw)
  To: ltp

Hi!
> Since commit a9446a906f52 ("lib/vdso/32: Remove inconsistent NULL pointer checks")
> VDSO treats NULL parameter differently than in syscall.
> 
> Drop NULL parameter, subsequent patch will add test variants that test NULL
> res parameter using syscall.
> 
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
>  testcases/kernel/syscalls/clock_getres/clock_getres01.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/testcases/kernel/syscalls/clock_getres/clock_getres01.c b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
> index 15f32310839a..df3e84271ad9 100644
> --- a/testcases/kernel/syscalls/clock_getres/clock_getres01.c
> +++ b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
> @@ -28,7 +28,6 @@ static struct test_case {
>  	{"MONOTONIC", CLOCK_MONOTONIC, &res, 0, 0},
>  	{"PROCESS_CPUTIME_ID", CLOCK_PROCESS_CPUTIME_ID, &res, 0, 0},
>  	{"THREAD_CPUTIME_ID", CLOCK_THREAD_CPUTIME_ID, &res, 0, 0},
> -	{"REALTIME", CLOCK_REALTIME, NULL, 0, 0},

Shouldn't we keep the REALTIME clock here and pass the &res here
instead?

>  	{"CLOCK_MONOTONIC_RAW", CLOCK_MONOTONIC_RAW, &res, 0, 0,},
>  	{"CLOCK_REALTIME_COARSE", CLOCK_REALTIME_COARSE, &res, 0, 0,},
>  	{"CLOCK_MONOTONIC_COARSE", CLOCK_MONOTONIC_COARSE, &res, 0, 0,},
> -- 
> 1.8.3.1
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH v2 2/2] clock_getres01: add test variants
  2019-08-09 14:31 ` [LTP] [PATCH v2 2/2] clock_getres01: add test variants Jan Stancek
  2019-08-12  4:52   ` Li Wang
@ 2019-08-13 12:13   ` Cyril Hrubis
  1 sibling, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2019-08-13 12:13 UTC (permalink / raw)
  To: ltp

Hi!
> 0 - default, could be either VDSO or syscall
> 1 - syscall with valid res parameter
> 2 - syscall with NULL res parameter
> 
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
>  testcases/kernel/syscalls/clock_getres/clock_getres01.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/testcases/kernel/syscalls/clock_getres/clock_getres01.c b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
> index df3e84271ad9..a4134bc1d3c2 100644
> --- a/testcases/kernel/syscalls/clock_getres/clock_getres01.c
> +++ b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
> @@ -13,6 +13,7 @@
>  #include <errno.h>
>  
>  #include "tst_test.h"
> +#include "lapi/syscalls.h"
>  #include "lapi/posix_clocks.h"
>  
>  static struct timespec res;
> @@ -39,7 +40,18 @@ static struct test_case {
>  
>  static void do_test(unsigned int i)
>  {
> -	TEST(clock_getres(tcase[i].clk_id, tcase[i].res));
> +	switch (tst_variant) {
> +	case 0:
> +		TEST(clock_getres(tcase[i].clk_id, tcase[i].res));
> +		break;
> +	case 1:
> +		TEST(tst_syscall(__NR_clock_getres, tcase[i].clk_id,
> +			tcase[i].res));
> +		break;
> +	case 2:
> +		TEST(tst_syscall(__NR_clock_getres, tcase[i].clk_id, NULL));
> +		break;
> +	}
>  
>  	if (TST_RET != tcase[i].ret) {
>  		if (TST_ERR == EINVAL) {
> @@ -64,4 +76,5 @@ static void do_test(unsigned int i)
>  static struct tst_test test = {
>  	.test = do_test,
>  	.tcnt = ARRAY_SIZE(tcase),
> +	.test_variants = 3,
>  };

Can we please print which variant we are about to test from the test
setup() as well?

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH v2 1/2] clock_getres01: drop case which is passing NULL res parameter
  2019-08-13 12:12 ` Cyril Hrubis
@ 2019-08-13 12:26   ` Jan Stancek
  2019-08-13 13:13     ` Cyril Hrubis
  0 siblings, 1 reply; 9+ messages in thread
From: Jan Stancek @ 2019-08-13 12:26 UTC (permalink / raw)
  To: ltp


----- Original Message -----
> Hi!
> > Since commit a9446a906f52 ("lib/vdso/32: Remove inconsistent NULL pointer
> > checks")
> > VDSO treats NULL parameter differently than in syscall.
> > 
> > Drop NULL parameter, subsequent patch will add test variants that test NULL
> > res parameter using syscall.
> > 
> > Signed-off-by: Jan Stancek <jstancek@redhat.com>
> > ---
> >  testcases/kernel/syscalls/clock_getres/clock_getres01.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/testcases/kernel/syscalls/clock_getres/clock_getres01.c
> > b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
> > index 15f32310839a..df3e84271ad9 100644
> > --- a/testcases/kernel/syscalls/clock_getres/clock_getres01.c
> > +++ b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
> > @@ -28,7 +28,6 @@ static struct test_case {
> >  	{"MONOTONIC", CLOCK_MONOTONIC, &res, 0, 0},
> >  	{"PROCESS_CPUTIME_ID", CLOCK_PROCESS_CPUTIME_ID, &res, 0, 0},
> >  	{"THREAD_CPUTIME_ID", CLOCK_THREAD_CPUTIME_ID, &res, 0, 0},
> > -	{"REALTIME", CLOCK_REALTIME, NULL, 0, 0},
> 
> Shouldn't we keep the REALTIME clock here and pass the &res here
> instead?

Test already has that as 1st entry in tcase array:
   {"REALTIME", CLOCK_REALTIME, &res, 0, 0},

> Can we please print which variant we are about to test from the test
> setup() as well?

Sure, I'll add that.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH v2 1/2] clock_getres01: drop case which is passing NULL res parameter
  2019-08-13 12:26   ` Jan Stancek
@ 2019-08-13 13:13     ` Cyril Hrubis
  2019-08-13 13:39       ` Jan Stancek
  0 siblings, 1 reply; 9+ messages in thread
From: Cyril Hrubis @ 2019-08-13 13:13 UTC (permalink / raw)
  To: ltp

Hi!
> > Shouldn't we keep the REALTIME clock here and pass the &res here
> > instead?
> 
> Test already has that as 1st entry in tcase array:
>    {"REALTIME", CLOCK_REALTIME, &res, 0, 0},

Missed that, sorry.

> > Can we please print which variant we are about to test from the test
> > setup() as well?
> 
> Sure, I'll add that.

Consider the patch acked then.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH v2 1/2] clock_getres01: drop case which is passing NULL res parameter
  2019-08-13 13:13     ` Cyril Hrubis
@ 2019-08-13 13:39       ` Jan Stancek
  0 siblings, 0 replies; 9+ messages in thread
From: Jan Stancek @ 2019-08-13 13:39 UTC (permalink / raw)
  To: ltp



----- Original Message -----
> Hi!
> > > Shouldn't we keep the REALTIME clock here and pass the &res here
> > > instead?
> > 
> > Test already has that as 1st entry in tcase array:
> >    {"REALTIME", CLOCK_REALTIME, &res, 0, 0},
> 
> Missed that, sorry.

Me as well in v1 :-)

> 
> > > Can we please print which variant we are about to test from the test
> > > setup() as well?
> > 
> > Sure, I'll add that.
> 
> Consider the patch acked then.

Both pushed.

> 
> --
> Cyril Hrubis
> chrubis@suse.cz
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-08-13 13:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-09 14:31 [LTP] [PATCH v2 1/2] clock_getres01: drop case which is passing NULL res parameter Jan Stancek
2019-08-09 14:31 ` [LTP] [PATCH v2 2/2] clock_getres01: add test variants Jan Stancek
2019-08-12  4:52   ` Li Wang
2019-08-13 12:13   ` Cyril Hrubis
2019-08-12  4:52 ` [LTP] [PATCH v2 1/2] clock_getres01: drop case which is passing NULL res parameter Li Wang
2019-08-13 12:12 ` Cyril Hrubis
2019-08-13 12:26   ` Jan Stancek
2019-08-13 13:13     ` Cyril Hrubis
2019-08-13 13:39       ` Jan Stancek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox