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," \
62 static inline void setup_asan(char **argv
) {
63 const auto set
= getenv("ASAN_OPTIONS");
66 SET_ENV_EX(asan
, "ASAN_OPTIONS", ASAN_OPTIONS
, 0);
67 execvp(argv
[0], argv
);
71 static inline void setup_lsan(char **argv
) {
72 const auto set
= getenv("LSAN_OPTIONS");
75 SET_ENV_EX(lsan
, "LSAN_OPTIONS", LSAN_OPTIONS
, 0);
76 execvp(argv
[0], argv
);
81 # define setup_asan(a) (void) a
82 # define setup_lsan(a) (void) a
85 #if LIBMEMCACHED_WITH_SASL_SUPPORT
86 static inline void setup_sasl() {
87 SET_ENV_EX(sasl_pwdb
, "MEMCACHED_SASL_PWDB", LIBMEMCACHED_WITH_SASL_PWDB
, 0);
88 SET_ENV_EX(sasl_conf
, "SASL_CONF_PATH", LIBMEMCACHED_WITH_SASL_CONF
, 0);
94 static inline void setup_random() {
98 int setup(int &, char ***argv
) {