[systemd-devel] [PATCH 2/4] libsystemd-network: Add hangcheck timer for DHCP client test

Patrik Flykt Patrik.Flykt at linux.intel.com
Mon Mar 17 06:47:19 PDT 2014


	Hi,

On Sat, 2014-03-15 at 03:56 +0100, Zbigniew Jędrzejewski-Szmek wrote:
> On Fri, Mar 14, 2014 at 08:05:10PM +0100, Tom Gundersen wrote:
> > On Thu, Mar 13, 2014 at 12:01 PM, Patrik Flykt
> > <patrik.flykt at linux.intel.com> wrote:
> > > ---
> > >  src/libsystemd-network/test-dhcp-client.c | 16 ++++++++++++++++
> > >  1 file changed, 16 insertions(+)
> > >
> > > diff --git a/src/libsystemd-network/test-dhcp-client.c b/src/libsystemd-network/test-dhcp-client.c
> > > index cfc75ae..9509eec 100644
> > > --- a/src/libsystemd-network/test-dhcp-client.c
> > > +++ b/src/libsystemd-network/test-dhcp-client.c
> > > @@ -44,6 +44,15 @@ static bool verbose = false;
> > >  static int test_fd[2];
> > >  static test_callback_recv_t callback_recv;
> > >  static be32_t xid;
> > > +static sd_event_source *test_hangcheck;
> > > +
> > > +static int test_dhcp_hangcheck(sd_event_source *s, uint64_t usec,
> > > +                               void *userdata)
> > > +{
> > > +        assert(false);
> > 
> > I guess this should be assert_se() ?
> Yeah, assert_se is slightly better, because of the strange way that we define those
> macros. Strictly speaking, since"false" has no side effects, it doesn't seem right
> to use it in assert_se. But either of those is not verbose enough: if it is ever
> triggered some better message should be shown. Maybe assert_not_reached()
> with some suitable message what was expected in what time and did not happen.

I updated said assert to:

assert_not_reached("Test case should have completed in 2 seconds");

For now there is just one test case that can for some reason get stuck,
when more cases are added I'll fix the message to point out who is
stuck.

Cheers,

	Patrik




More information about the systemd-devel mailing list