Skip to content

Commit 8b7b59f

Browse files
jktjktmichalvasko
authored andcommitted
tests: skip the SIGEV_THREAD code path in test_privcand under TSAN
This particular check leads to a code path in netopeer2-server which starts a background thread via the C library, and that causes a segfault in TSAN's internals. Yay. Fixes: #1810 Bug: google/sanitizers#1612
1 parent 56c0351 commit 8b7b59f

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/test_privcand.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@
3131
#include "np2_test.h"
3232
#include "np2_test_config.h"
3333

34+
#if defined (__has_feature)
35+
# if __has_feature(thread_sanitizer)
36+
# define NP2_TSAN
37+
# endif
38+
#elif defined (__SANITIZE_THREAD__)
39+
# define NP2_TSAN
40+
#endif
41+
3442
#define UPDATE_RPC(RES_MODE) \
3543
" <update xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-private-candidate\">\n" \
3644
" <resolution-mode>"RES_MODE"</resolution-mode>\n" \
@@ -408,6 +416,9 @@ test_pc_basic_commit(void **state)
408416
FREE_TEST_VARS(st);
409417
}
410418

419+
#ifndef NP2_TSAN
420+
// This test a path in netopeer2 which starts a timer via the C library, and that makes TSAN segfault:
421+
// https://github.com/google/sanitizers/issues/1612
411422
static void
412423
test_pc_commit_timeout_runout(void **state)
413424
{
@@ -478,6 +489,8 @@ test_pc_commit_timeout_runout(void **state)
478489
ASSERT_NO_NOTIF(st);
479490
}
480491

492+
#endif
493+
481494
static void
482495
test_pc_timeout_confirm(void **state)
483496
{
@@ -929,7 +942,9 @@ main(int argc, char **argv)
929942
cmocka_unit_test(test_pc_lock_unlock),
930943

931944
cmocka_unit_test_setup_teardown(test_pc_basic_commit, setup_common, teardown_common),
945+
#ifndef NP2_TSAN
932946
cmocka_unit_test_setup_teardown(test_pc_commit_timeout_runout, setup_common, teardown_common),
947+
#endif
933948
cmocka_unit_test_setup_teardown(test_pc_timeout_confirm, setup_common, teardown_common),
934949
cmocka_unit_test_setup_teardown(test_pc_timeout_confirm_modify, setup_common, teardown_common),
935950

0 commit comments

Comments
 (0)