X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=test%2Fsetup.cpp;h=8ee8bda09a6ec9a1f9167dd207d644f8b3f3c5bc;hb=92d18858b417309f6bdee6bce464a4f3d6a375fd;hp=9e23ce2be14cb242cc9b36f3fd091df670b755e2;hpb=8af5cd68ad8a83f52ae65fa36bf1dbcf85a64ef9;p=awesomized%2Flibmemcached diff --git a/test/setup.cpp b/test/setup.cpp index 9e23ce2b..8ee8bda0 100644 --- a/test/setup.cpp +++ b/test/setup.cpp @@ -1,4 +1,5 @@ #include "mem_config.h" +#include "test/conf.h" #include "test/lib/env.hpp" #include "test/lib/random.hpp" #include @@ -7,7 +8,9 @@ #include #include #include -#include +#if HAVE_UNISTD_H +# include +#endif static void sigchld(int, siginfo_t *si, void *) { switch (si->si_code) { @@ -31,8 +34,6 @@ static void sigchld(int, siginfo_t *si, void *) { } static inline void setup_signals() { - cout << " - Setting up signals ... "; - struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_flags = SA_NOCLDSTOP | SA_RESTART | SA_SIGINFO | SA_NODEFER; @@ -40,8 +41,6 @@ static inline void setup_signals() { sa.sa_sigaction = sigchld; if (0 > sigaction(SIGCHLD, &sa, nullptr)) { perror("sigaction(CHLD)"); - } else { - cout << "done\n"; } } @@ -59,50 +58,70 @@ static inline void setup_signals() { "verify_asan_link_order=1," \ "abort_on_error=0," \ "" +# define LSAN_OPTIONS \ + "suppressions=" SOURCES_ROOT "/test/LeakSanitizer.suppressions," \ + "" + static inline void setup_asan(char **argv) { const auto set = getenv("ASAN_OPTIONS"); - cout << " - Setting up ASAN ... "; - if (!set || !*set) { SET_ENV_EX(asan, "ASAN_OPTIONS", ASAN_OPTIONS, 0); - cout << "re-exec\n"; execvp(argv[0], argv); perror("exec()"); } - cout << "done\n"; +} +static inline void setup_lsan(char **argv) { + const auto set = getenv("LSAN_OPTIONS"); + + if (!set || !*set) { + SET_ENV_EX(lsan, "LSAN_OPTIONS", LSAN_OPTIONS, 0); + execvp(argv[0], argv); + perror("exec()"); + } } #else # define setup_asan(a) (void) a +# define setup_lsan(a) (void) a +#endif + +#if HAVE_TSAN +# define TSAN_OPTIONS \ + "abort_on_error=0," \ + "halt_on_error=0" \ + "" +static inline void setup_tsan(char **argv) { + const auto set = getenv("TSAN_OPTIONS"); + + if (!set || !*set) { + SET_ENV_EX(tsan, "TSAN_OPTIONS", TSAN_OPTIONS, 0); + execvp(argv[0], argv); + perror("exec()"); + } +} +#else +# define setup_tsan(a) (void) a #endif #if LIBMEMCACHED_WITH_SASL_SUPPORT static inline void setup_sasl() { - cout << " - Setting up SASL ... "; - SET_ENV_EX(sasl_pwdb, "MEMCACHED_SASL_PWDB", LIBMEMCACHED_WITH_SASL_PWDB, 0); SET_ENV_EX(sasl_conf, "SASL_CONF_PATH", LIBMEMCACHED_WITH_SASL_CONF, 0); - - cout << "done\n"; } #else # define setup_sasl() #endif static inline void setup_random() { - cout << " - Setting up RNG ... "; - random_setup(); - - cout << "done\n"; } int setup(int &, char ***argv) { - cout << "Starting " << **argv << " (pid=" << getpid() << ") ... \n"; - setup_signals(); setup_random(); setup_asan(*argv); + setup_lsan(*argv); + setup_tsan(*argv); setup_sasl(); return 0;