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

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Fri Mar 14 19:56:02 PDT 2014


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.

Zbyszek


More information about the systemd-devel mailing list