1 #include "mem_config.h"
2 #include "test/lib/env.hpp"
11 static void sigchld(int, siginfo_t
*si
, void *) {
12 switch (si
->si_code
) {
17 if (si
->si_status
== SIGKILL
) {
23 std::cerr
<< "Server{pid="
24 << std::to_string(si
->si_pid
)
26 << strsignal(si
->si_status
)
32 static inline void setup_signals() {
35 memset(&sa
, 0, sizeof(sa
));
36 sa
.sa_flags
= SA_NOCLDSTOP
| SA_RESTART
| SA_SIGINFO
| SA_NODEFER
;
38 sa
.sa_sigaction
= sigchld
;
39 if (0 > sigaction(SIGCHLD
, &sa
, nullptr)) {
40 perror("sigaction(CHLD)");
45 // this has to be a macro for putenv() to work
46 # define ASAN_OPTIONS \
47 "check_initialization_order=1," \
50 "detect_stack_use_after_return=1," \
51 "alloc_dealloc_mismatch=1," \
52 "new_delete_type_mismatch=1," \
53 "detect_odr_violation=2," \
55 "verify_asan_link_order=1," \
58 static inline void setup_asan(char **argv
) {
59 const auto set
= getenv("ASAN_OPTIONS");
62 SET_ENV_EX(asan
, "ASAN_OPTIONS", ASAN_OPTIONS
, 0);
63 execvp(argv
[0], argv
);
68 # define setup_asan(a) (void) a
71 #if LIBMEMCACHED_WITH_SASL_SUPPORT
72 static inline void setup_sasl() {
73 SET_ENV_EX(sasl_pwdb
, "MEMCACHED_SASL_PWDB", LIBMEMCACHED_WITH_SASL_PWDB
, 0);
74 SET_ENV_EX(sasl_conf
, "SASL_CONF_PATH", LIBMEMCACHED_WITH_SASL_CONF
, 0);
80 int setup(int &, char ***argv
) {