[systemd-devel] strv tests
Thomas H.P. Andersen
phomes at gmail.com
Wed Feb 13 09:29:08 PST 2013
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?
More information about the systemd-devel
mailing list