[systemd-devel] strv tests

Lennart Poettering lennart at poettering.net
Wed Feb 13 10:29:13 PST 2013


On Wed, 13.02.13 18:29, Thomas H.P. Andersen (phomes at gmail.com) wrote:

> 
> On Wed, Feb 13, 2013 at 1:25 AM, Lennart Poettering
> <lennart at poettering.net> wrote:
> > On Mon, 11.02.13 22:39, Daniel Buch (boogiewasthere at gmail.com) wrote:
> >
> >> And now with patch files.
> >
> > Looks pretty OK.
> >
> > But two points:
> >
> > Could you please use assert_se() rather than assert() for these tests?
> > They both have pretty much the same function but the latter becomes a
> > NOP if -DNDEBUG is defined, which can be used by people who want to
> > optimize a few checks away. However, these are unit tests, so optimizing
> > the assertions away defeats their entire point...
> >
> > Also, we generally always check for Out of Memory (OOM) situations. Of
> > course, this doesn't really matter too much as this is unit tests, but
> > it would still be nice to check with assert_cc() if the allocations
> > worked.
> >
> > Or in other words: strv_new() and friends can fail due to lack of
> > memory, you really should add an explicit "assert_cc" after that before
> > just using the returned object...
> 
> None of the other tests do this. Did you mean assert_se instead of
> assert_cc here?

Oops, sorry. Yes, assert_se().

And yes, not all tests use this, but they should....

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list