public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/1] C API: Turn .test_variants into array of description
Date: Tue, 19 May 2020 16:07:04 +0200	[thread overview]
Message-ID: <20200519140704.GE16008@yuki.lan> (raw)
In-Reply-To: <20200519120725.25750-1-pvorel@suse.cz>

Hi!
> diff --git a/testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c b/testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c
> index 061b2bb22..40dae4b24 100644
> --- a/testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c
> +++ b/testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c
> @@ -107,14 +107,12 @@ struct test_case tc[] = {
>  static struct test_variants {
>  	int (*clock_adjtime)(clockid_t clk_id, void *timex);
>  	enum tst_timex_type type;
> -	char *desc;
>  } variants[] = {
>  #if (__NR_clock_adjtime != __LTP__NR_INVALID_SYSCALL)
> -	{.clock_adjtime = sys_clock_adjtime, .type = TST_KERN_OLD_TIMEX, .desc = "syscall with old kernel spec"},
> +	{.clock_adjtime = sys_clock_adjtime, .type = TST_KERN_OLD_TIMEX},
>  #endif
> -
>  #if (__NR_clock_adjtime64 != __LTP__NR_INVALID_SYSCALL)
> -	{.clock_adjtime = sys_clock_adjtime64, .type = TST_KERN_TIMEX, .desc = "syscall time64 with kernel spec"},
> +	{.clock_adjtime = sys_clock_adjtime64, .type = TST_KERN_TIMEX},
>  #endif
>  };
>  
> @@ -188,8 +186,6 @@ static void setup(void)
>  	size_t i;
>  	int rval;
>  
> -	tst_res(TINFO, "Testing variant: %s", tv->desc);
> -
>  	saved.type = tv->type;
>  	rval = tv->clock_adjtime(CLOCK_REALTIME, tst_timex_get(&saved));
>  	if (rval < 0) {
> @@ -257,7 +253,15 @@ static struct tst_test test = {
>  	.setup = setup,
>  	.cleanup = cleanup,
>  	.tcnt = ARRAY_SIZE(tc),
> -	.test_variants = ARRAY_SIZE(variants),
> +	.test_variants = (const char *[]) {
> +#if (__NR_clock_adjtime != __LTP__NR_INVALID_SYSCALL)
> +		"syscall with old kernel spec",
> +#endif
> +#if (__NR_clock_adjtime64 != __LTP__NR_INVALID_SYSCALL)
> +		"syscall time64 with kernel spec",
> +#endif
> +		NULL
> +	},

I do not think that having more ifdefs and splitting the test variant
structure helps to make things simple in the case of timer testcases.

What exact problem are you trying to solve?

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2020-05-19 14:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 12:07 [LTP] [PATCH 1/1] C API: Turn .test_variants into array of description Petr Vorel
2020-05-19 14:07 ` Cyril Hrubis [this message]
2020-05-19 14:35   ` Petr Vorel
2020-05-20  4:40   ` Viresh Kumar
2020-05-20  5:48     ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200519140704.GE16008@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox