1 #include "mem_config.h"
3 #include "test/lib/env.hpp"
4 #include "test/lib/random.hpp"
13 static void sigchld(int, siginfo_t
*si
, void *) {
14 switch (si
->si_code
) {
19 if (si
->si_status
== SIGKILL
) {
25 std::cerr
<< "Server{pid="
26 << std::to_string(si
->si_pid
)
28 << strsignal(si
->si_status
)
34 static inline void setup_signals() {
36 memset(&sa
, 0, sizeof(sa
));
37 sa
.sa_flags
= SA_NOCLDSTOP
| SA_RESTART
| SA_SIGINFO
| SA_NODEFER
;
39 sa
.sa_sigaction
= sigchld
;
40 if (0 > sigaction(SIGCHLD
, &sa
, nullptr)) {
41 perror("sigaction(CHLD)");
46 // this has to be a macro for putenv() to work
47 # define ASAN_OPTIONS \
48 "check_initialization_order=1," \
51 "detect_stack_use_after_return=1," \
52 "alloc_dealloc_mismatch=1," \
53 "new_delete_type_mismatch=1," \
54 "detect_odr_violation=2," \
56 "verify_asan_link_order=1," \
59 # define LSAN_OPTIONS \
60 "suppressions=" SOURCES_ROOT "/test/LeakSanitizer.suppressions," \
63 static inline void setup_asan(char **argv
) {
64 const auto set
= getenv("ASAN_OPTIONS");
67 SET_ENV_EX(asan
, "ASAN_OPTIONS", ASAN_OPTIONS
, 0);
68 execvp(argv
[0], argv
);
72 static inline void setup_lsan(char **argv
) {
73 const auto set
= getenv("LSAN_OPTIONS");
76 SET_ENV_EX(lsan
, "LSAN_OPTIONS", LSAN_OPTIONS
, 0);
77 execvp(argv
[0], argv
);
82 # define setup_asan(a) (void) a
83 # define setup_lsan(a) (void) a
87 # define TSAN_OPTIONS \
91 static inline void setup_tsan(char **argv
) {
92 const auto set
= getenv("TSAN_OPTIONS");
95 SET_ENV_EX(tsan
, "TSAN_OPTIONS", TSAN_OPTIONS
, 0);
96 execvp(argv
[0], argv
);
101 # define setup_tsan(a) (void) a
104 #if LIBMEMCACHED_WITH_SASL_SUPPORT
105 static inline void setup_sasl() {
106 SET_ENV_EX(sasl_pwdb
, "MEMCACHED_SASL_PWDB", LIBMEMCACHED_WITH_SASL_PWDB
, 0);
107 SET_ENV_EX(sasl_conf
, "SASL_CONF_PATH", LIBMEMCACHED_WITH_SASL_CONF
, 0);
110 # define setup_sasl()
113 static inline void setup_random() {
117 int setup(int &, char ***argv
) {