All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Borkmann <dborkman@redhat.com>
To: Alexandru Copot <alex.mihai.c@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, willemb@google.com,
	edumazet@google.com, Daniel Baluta <dbaluta@ixiacom.com>
Subject: Re: [PATCH 1/3 net-next RFC] selftest: add abstractions for net selftests
Date: Tue, 09 Apr 2013 13:32:07 +0200	[thread overview]
Message-ID: <5163FC37.4090202@redhat.com> (raw)
In-Reply-To: <CAHG7+CBWF-gLcNfvnP2NQjkAwgtv+k6=0DndN1Mu2b+1acHj-w@mail.gmail.com>

On 04/09/2013 01:24 PM, Alexandru Copot wrote:
> On Tue, Apr 9, 2013 at 2:13 PM, Daniel Borkmann <dborkman@redhat.com> wrote:

>>> +#define CHECK(cond,fmt,...)                            \
>>> +       do {                                            \
>>> +               if (!(cond)) {                          \
>>> +                       fprintf(stderr, "(%s, %d): " fmt,       \
>>> +                                       __FILE__, __LINE__,
>>> ##__VA_ARGS__); \
>>> +                       perror("");                     \
>>> +                       return 1;                       \
>>> +               }                                       \
>>> +       } while (0)
>>
>>
>> Isn't it a bit error-prone if in the middle of somewhere this check fails
>> and the function suddenly returns 1?
>>
>> What if this is called from a function that was declared as void or to
>> return a pointer to a struct etc.?
>
> Well, I tought of using this only in your high-level testcase methods
> (test->run()).
> It is also easier to see what is actually being tested.
>
> For anything else the user is free to use any other functions or
> return conventions
> as the test requires.

Hm, then, still not convinced about the CHECK macro. In worst case this at
least needs a comment, so that people will not misuse that, but with your
two statements above, it seems likely that people could also start using it
in "any other functions or return conventions as the test requires". ;-)

  reply	other threads:[~2013-04-09 11:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-09 10:30 [PATCH 0/3 net-next RFC] selftest: Introduce test abstraction for net Alexandru Copot
2013-04-09 10:30 ` [PATCH 1/3 net-next RFC] selftest: add abstractions for net selftests Alexandru Copot
2013-04-09 11:13   ` Daniel Borkmann
2013-04-09 11:24     ` Alexandru Copot
2013-04-09 11:32       ` Daniel Borkmann [this message]
2013-04-09 13:39   ` Sergei Shtylyov
2013-04-09 13:54     ` Daniel Borkmann
2013-04-09 10:31 ` [PATCH 2/3 net-next RFC] selftest: Adapt socket test to new testing framework Alexandru Copot
2013-04-09 10:31 ` [PATCH net-next RFC] selftests: add socket options test with IPv6 testcases Alexandru Copot
2013-04-09 11:22 ` [PATCH 0/3 net-next RFC] selftest: Introduce test abstraction for net Daniel Borkmann

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=5163FC37.4090202@redhat.com \
    --to=dborkman@redhat.com \
    --cc=alex.mihai.c@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dbaluta@ixiacom.com \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=willemb@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.