Filipe Brandenburger
2014-08-26 05:05:01 UTC
I bumped into these when building systemd with CPPFLAGS='-DNDEBUG' (which is
the default for one of my build environments) which ends up optimizing out the
assert() statements. It turns out that they were being used in some places in
test cases where there was a side effect, so optimizing them out would cause
the tests to crash.
More to the point, maybe it would make sense to have *all* the assertions in
tests be assert_se. Maybe a global search/replace?
Not sure if this issue is not present elsewhere in systemd either... Not sure
if it's really worth supporting -DNDEBUG. Considering systemd is already
redefining assert(), maybe make it unconditional?
Cheers,
Filipe
Filipe Brandenburger (3):
test-compress: make sure asserts with side effects use assert_se()
test-path-util: use assert_se in all assertions
test-util: use assert_se() for call to safe_mkdir with side effect
src/journal/test-compress.c | 4 ++--
src/test/test-path-util.c | 30 +++++++++++++++---------------
src/test/test-util.c | 2 +-
3 files changed, 18 insertions(+), 18 deletions(-)
the default for one of my build environments) which ends up optimizing out the
assert() statements. It turns out that they were being used in some places in
test cases where there was a side effect, so optimizing them out would cause
the tests to crash.
More to the point, maybe it would make sense to have *all* the assertions in
tests be assert_se. Maybe a global search/replace?
Not sure if this issue is not present elsewhere in systemd either... Not sure
if it's really worth supporting -DNDEBUG. Considering systemd is already
redefining assert(), maybe make it unconditional?
Cheers,
Filipe
Filipe Brandenburger (3):
test-compress: make sure asserts with side effects use assert_se()
test-path-util: use assert_se in all assertions
test-util: use assert_se() for call to safe_mkdir with side effect
src/journal/test-compress.c | 4 ++--
src/test/test-path-util.c | 30 +++++++++++++++---------------
src/test/test-util.c | 2 +-
3 files changed, 18 insertions(+), 18 deletions(-)
--
1.9.3
1.9.3