selinux/libsepol/tests
Nicolas Iooss 120681c1a3 libsepol, libsemanage: add a macro to silence static analyzer warnings in tests
Several static analyzers (clang's one, Facebook Infer, etc.) warn about
NULL pointer dereferences after a call to CU_ASSERT_PTR_NOT_NULL_FATAL()
in the test code written using CUnit framework. This is because this
CUnit macro is too complex for them to understand that the pointer
cannot be NULL: it is translated to a call to CU_assertImplementation()
with an argument as TRUE in order to mean that the call is fatal if the
asserted condition failed (cf.
http://cunit.sourceforge.net/doxdocs/group__Framework.html).

A possible solution could consist in replacing the
CU_ASSERT_..._FATAL() calls by assert() ones, as most static analyzers
know about assert(). Nevertheless this seems to go against CUnit's API.

An alternative solution consists in overriding CU_ASSERT_..._FATAL()
macros in order to expand to assert() after a call to the matching
CU_ASSERT_...() non-fatal macro. This appears to work fine and to remove
many false-positive warnings from various static analyzers.

As this substitution should only occur when using static analyzer, put
it under #ifdef __CHECKER__, which is the macro used by sparse when
analyzing the Linux kernel.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2019-09-30 08:43:41 -04:00
..
policies Fix many misspellings 2019-09-18 22:47:35 +02:00
.gitignore Update .gitignore files 2016-05-09 08:14:54 -04:00
debug.c initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
debug.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
helpers.c libsepol/tests: fix -Wwrite-strings warnings 2017-02-06 11:06:04 -05:00
helpers.h libsepol, libsemanage: add a macro to silence static analyzer warnings in tests 2019-09-30 08:43:41 -04:00
libsepol-tests.c libsepol: make "make test" fails when a CUnit test fails 2016-09-06 10:49:56 -04:00
Makefile libsepol/tests: override CPPFLAGS too 2017-06-30 08:56:43 -04:00
test-common.c libsepol, libsemanage: add a macro to silence static analyzer warnings in tests 2019-09-30 08:43:41 -04:00
test-common.h libsepol/tests: fix -Wwrite-strings warnings 2017-02-06 11:06:04 -05:00
test-cond.c initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
test-cond.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
test-deps.c libsepol, libsemanage: add a macro to silence static analyzer warnings in tests 2019-09-30 08:43:41 -04:00
test-deps.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
test-downgrade.c Fix many misspellings 2019-09-18 22:47:35 +02:00
test-downgrade.h Fix many misspellings 2019-09-18 22:47:35 +02:00
test-expander-attr-map.c libsepol, libsemanage: add a macro to silence static analyzer warnings in tests 2019-09-30 08:43:41 -04:00
test-expander-attr-map.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
test-expander-roles.c libsepol, libsemanage: add a macro to silence static analyzer warnings in tests 2019-09-30 08:43:41 -04:00
test-expander-roles.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
test-expander-users.c libsepol, libsemanage: add a macro to silence static analyzer warnings in tests 2019-09-30 08:43:41 -04:00
test-expander-users.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
test-expander.c libsepol/tests: fix -Wwrite-strings warnings 2017-02-06 11:06:04 -05:00
test-expander.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
test-linker-cond-map.c Fix many misspellings 2019-09-18 22:47:35 +02:00
test-linker-cond-map.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
test-linker-roles.c libsepol: add ebitmap_for_each_set_bit macro 2019-05-20 14:00:32 -04:00
test-linker-roles.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
test-linker-types.c libsepol/tests: fix -Wwrite-strings warnings 2017-02-06 11:06:04 -05:00
test-linker-types.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
test-linker.c initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
test-linker.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00