1 #include "mem_config.h"
3 #include "test/lib/env.hpp"
4 #include "test/lib/random.hpp"
15 static void sigchld(int, siginfo_t
*si
, void *) {
16 switch (si
->si_code
) {
21 if (si
->si_status
== SIGKILL
) {
27 std::cerr
<< "Server{pid="
28 << std::to_string(si
->si_pid
)
30 << strsignal(si
->si_status
)
36 static inline void setup_signals() {
38 memset(&sa
, 0, sizeof(sa
));
39 sa
.sa_flags
= SA_NOCLDSTOP
| SA_RESTART
| SA_SIGINFO
| SA_NODEFER
;
41 sa
.sa_sigaction
= sigchld
;
42 if (0 > sigaction(SIGCHLD
, &sa
, nullptr)) {
43 perror("sigaction(CHLD)");
48 // this has to be a macro for putenv() to work
49 # define ASAN_OPTIONS \
50 "check_initialization_order=1," \
53 "detect_stack_use_after_return=1," \
54 "alloc_dealloc_mismatch=1," \
55 "new_delete_type_mismatch=1," \
56 "detect_odr_violation=2," \
58 "verify_asan_link_order=1," \
61 # define LSAN_OPTIONS \
62 "suppressions=" SOURCES_ROOT "/test/LeakSanitizer.suppressions," \
65 static inline void setup_asan(char **argv
) {
66 const auto set
= getenv("ASAN_OPTIONS");
69 SET_ENV_EX(asan
, "ASAN_OPTIONS", ASAN_OPTIONS
, 0);
70 execvp(argv
[0], argv
);
74 static inline void setup_lsan(char **argv
) {
75 const auto set
= getenv("LSAN_OPTIONS");
78 SET_ENV_EX(lsan
, "LSAN_OPTIONS", LSAN_OPTIONS
, 0);
79 execvp(argv
[0], argv
);
84 # define setup_asan(a) (void) a
85 # define setup_lsan(a) (void) a
89 # define TSAN_OPTIONS \
93 static inline void setup_tsan(char **argv
) {
94 const auto set
= getenv("TSAN_OPTIONS");
97 SET_ENV_EX(tsan
, "TSAN_OPTIONS", TSAN_OPTIONS
, 0);
98 execvp(argv
[0], argv
);
103 # define setup_tsan(a) (void) a
106 #if LIBMEMCACHED_WITH_SASL_SUPPORT
107 static inline void setup_sasl() {
108 SET_ENV_EX(sasl_pwdb
, "MEMCACHED_SASL_PWDB", LIBMEMCACHED_WITH_SASL_PWDB
, 0);
109 SET_ENV_EX(sasl_conf
, "SASL_CONF_PATH", LIBMEMCACHED_WITH_SASL_CONF
, 0);
112 # define setup_sasl()
115 static inline void setup_random() {
119 int setup(int &, char ***argv
) {