[systemd-devel] strv tests

Lennart Poettering lennart at poettering.net
Tue Feb 12 16:25:32 PST 2013


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...

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list