DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: <dev@dpdk.org>, Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: Re: [PATCH 1/4] test: update alarm test
Date: Fri, 19 Jul 2024 10:09:59 -0700	[thread overview]
Message-ID: <20240719101000.187e76b6@hermes.local> (raw)
In-Reply-To: <Zpo9R-ZQJr47-rvC@bricha3-mobl1.ger.corp.intel.com>

On Fri, 19 Jul 2024 11:17:43 +0100
Bruce Richardson <bruce.richardson@intel.com> wrote:

> On Thu, Jul 18, 2024 at 12:07:12PM -0700, Stephen Hemminger wrote:
> > This test should be using the TEST_ASSERT macros, and can be
> > run as part of the fast test suite now.
> > 
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
> >  app/test/test_alarm.c | 53 ++++++++++++++++---------------------------
> >  1 file changed, 20 insertions(+), 33 deletions(-)
> > 
> > diff --git a/app/test/test_alarm.c b/app/test/test_alarm.c
> > index 70e97a3109..4ba8aa1af2 100644
> > --- a/app/test/test_alarm.c
> > +++ b/app/test/test_alarm.c
> > @@ -10,7 +10,8 @@
> >  
> >  #include "test.h"
> >  
> > -#ifndef RTE_EXEC_ENV_WINDOWS
> > +#define US_PER_SEC 1000000
> > +
> >  static volatile int flag;
> >  
> >  static void
> > @@ -19,46 +20,32 @@ test_alarm_callback(void *cb_arg)
> >  	flag = 1;
> >  	printf("Callback setting flag - OK. [cb_arg = %p]\n", cb_arg);
> >  }
> > -#endif
> >  
> >  static int
> >  test_alarm(void)
> >  {
> > -#ifdef RTE_EXEC_ENV_FREEBSD
> > -	printf("The alarm API is not supported on FreeBSD\n");
> > -	return 0;
> > -#endif
> > +	int ret;
> > +
> > +	ret = rte_eal_alarm_set(0, test_alarm_callback, NULL);
> > +	TEST_ASSERT_FAIL(ret, "should not be succeed with 0 us value");
> > +
> > +	ret = rte_eal_alarm_set(UINT64_MAX - 1, test_alarm_callback, NULL);
> > +	TEST_ASSERT_FAIL(ret, "should not be succeed with (UINT64_MAX-1) us value");
> > +
> > +	ret = rte_eal_alarm_set(10, NULL, NULL);
> > +	TEST_ASSERT_FAIL(ret, "should not succeed with null callback parameter");
> >    
> 
> +1 to use of TEST_ASSERT_FAIL, the test is a lot cleaner now.
> However, I think we still need the #ifdefs in it if some of it doesn't work
> on Windows/BSD.
> 
> /Bruce

It looks like alarm API's exist on Windows (see lib/eal/windows/eal_alarm.c)
therefore should be tested but aren't being now.

  reply	other threads:[~2024-07-19 17:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-18 19:07 [PATCH 0/4] Enable more unit tests Stephen Hemminger
2024-07-18 19:07 ` [PATCH 1/4] test: update alarm test Stephen Hemminger
2024-07-19 10:17   ` Bruce Richardson
2024-07-19 17:09     ` Stephen Hemminger [this message]
2024-08-06 12:45   ` David Marchand
2024-08-07 22:24     ` Stephen Hemminger
2024-08-08 18:52     ` Stephen Hemminger
2024-07-18 19:07 ` [PATCH 2/4] test: run cksum tests as part of perf test suite Stephen Hemminger
2024-07-19  8:45   ` Bruce Richardson
2024-07-18 19:07 ` [PATCH 3/4] test: make red test part of fast suite Stephen Hemminger
2024-07-19  9:14   ` Bruce Richardson
2024-08-06 12:28   ` David Marchand
2024-08-06 12:49     ` Bruce Richardson
2024-08-08 16:12     ` Stephen Hemminger
2024-10-04 12:17       ` David Marchand
2024-07-18 19:07 ` [PATCH 4/4] test: run timer secondary tests as " Stephen Hemminger
2024-07-19  9:27   ` Bruce Richardson
2024-10-04 12:20   ` David Marchand
2024-10-04 12:51 ` [PATCH 0/4] Enable more unit tests David Marchand

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=20240719101000.187e76b6@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=roretzla@linux.microsoft.com \
    /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;
as well as URLs for NNTP newsgroup(s).