1 #include "mem_config.h"
2 #include "test/lib/env.hpp"
3 #include "test/lib/random.hpp"
12 static void sigchld(int, siginfo_t
*si
, void *) {
13 switch (si
->si_code
) {
18 if (si
->si_status
== SIGKILL
) {
24 std::cerr
<< "Server{pid="
25 << std::to_string(si
->si_pid
)
27 << strsignal(si
->si_status
)
33 static inline void setup_signals() {
34 cout
<< " - Setting up signals ... ";
37 memset(&sa
, 0, sizeof(sa
));
38 sa
.sa_flags
= SA_NOCLDSTOP
| SA_RESTART
| SA_SIGINFO
| SA_NODEFER
;
40 sa
.sa_sigaction
= sigchld
;
41 if (0 > sigaction(SIGCHLD
, &sa
, nullptr)) {
42 perror("sigaction(CHLD)");
49 // this has to be a macro for putenv() to work
50 # define ASAN_OPTIONS \
51 "check_initialization_order=1," \
54 "detect_stack_use_after_return=1," \
55 "alloc_dealloc_mismatch=1," \
56 "new_delete_type_mismatch=1," \
57 "detect_odr_violation=2," \
59 "verify_asan_link_order=1," \
62 static inline void setup_asan(char **argv
) {
63 const auto set
= getenv("ASAN_OPTIONS");
65 cout
<< " - Setting up ASAN ... ";
68 SET_ENV_EX(asan
, "ASAN_OPTIONS", ASAN_OPTIONS
, 0);
70 execvp(argv
[0], argv
);
76 # define setup_asan(a) (void) a
79 #if LIBMEMCACHED_WITH_SASL_SUPPORT
80 static inline void setup_sasl() {
81 cout
<< " - Setting up SASL ... ";
83 SET_ENV_EX(sasl_pwdb
, "MEMCACHED_SASL_PWDB", LIBMEMCACHED_WITH_SASL_PWDB
, 0);
84 SET_ENV_EX(sasl_conf
, "SASL_CONF_PATH", LIBMEMCACHED_WITH_SASL_CONF
, 0);
92 static inline void setup_random() {
93 cout
<< " - Setting up RNG ... ";
100 int setup(int &, char ***argv
) {
101 cout
<< "Starting " << **argv
<< " (pid=" << getpid() << ") ... \n";