1 #include "mem_config.h"
2 #include "test/lib/env.hpp"
10 static void sigchld(int, siginfo_t
*si
, void *) {
11 switch (si
->si_code
) {
16 if (si
->si_status
== SIGKILL
) {
22 std::cerr
<< "Server{pid="
23 << std::to_string(si
->si_pid
)
25 << strsignal(si
->si_status
)
31 static inline void setup_signals() {
34 memset(&sa
, 0, sizeof(sa
));
35 sa
.sa_flags
= SA_NOCLDSTOP
| SA_RESTART
| SA_SIGINFO
| SA_NODEFER
;
37 sa
.sa_sigaction
= sigchld
;
38 if (0 > sigaction(SIGCHLD
, &sa
, nullptr)) {
39 perror("sigaction(CHLD)");
44 // this has to be a macro for putenv() to work
45 # define ASAN_OPTIONS \
46 "check_initialization_order=1," \
49 "detect_stack_use_after_return=1," \
50 "alloc_dealloc_mismatch=1," \
51 "new_delete_type_mismatch=1," \
52 "detect_odr_violation=2," \
54 "verify_asan_link_order=1," \
57 static inline void setup_asan(char **argv
) {
58 const auto set
= getenv("ASAN_OPTIONS");
61 SET_ENV_EX(asan
, "ASAN_OPTIONS", ASAN_OPTIONS
, 0);
62 execvp(argv
[0], argv
);
67 # define setup_asan(a) (void) a
70 #if LIBMEMCACHED_WITH_SASL_SUPPORT
71 static inline void setup_sasl() {
72 SET_ENV_EX(sasl_pwdb
, "MEMCACHED_SASL_PWDB", LIBMEMCACHED_WITH_SASL_PWDB
, 0);
73 SET_ENV_EX(sasl_conf
, "SASL_CONF_PATH", LIBMEMCACHED_WITH_SASL_CONF
, 0);
79 int setup(int &, char ***argv
) {