X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=test%2Fsetup.cpp;h=a0325af52530637fb1b95058e7e6e3e41d72d862;hb=f2ab0a0c16503c35c23c6ad1ba11913d054ccdad;hp=1f4c9a477d12b96ad48b6965d6e8ff8462ad3dcd;hpb=4d48a64682e4921bda97f1e5ae30321f0cb2b15b;p=awesomized%2Flibmemcached diff --git a/test/setup.cpp b/test/setup.cpp index 1f4c9a47..a0325af5 100644 --- a/test/setup.cpp +++ b/test/setup.cpp @@ -1,4 +1,6 @@ #include "mem_config.h" +#include "test/lib/env.hpp" +#include "test/lib/random.hpp" #include #include #include @@ -7,12 +9,6 @@ #include #include -#if HAVE_SETENV -# define SET_ENV(n, k, v) setenv(k, v, 0) -#else // !HAVE_SETENV -# define SET_ENV(n, k, v) static char n ## _env[] = k "=" v; putenv(n ## _env) -#endif - static void sigchld(int, siginfo_t *si, void *) { switch (si->si_code) { case CLD_EXITED: @@ -64,25 +60,27 @@ static inline void setup_asan(char **argv) { const auto set = getenv("ASAN_OPTIONS"); if (!set || !*set) { - SET_ENV(asan, "ASAN_OPTIONS", ASAN_OPTIONS); + SET_ENV_EX(asan, "ASAN_OPTIONS", ASAN_OPTIONS, 0); execvp(argv[0], argv); perror("exec()"); } } #else -# define setup_asan(a) +# define setup_asan(a) (void) a #endif #if LIBMEMCACHED_WITH_SASL_SUPPORT static inline void setup_sasl() { - SET_ENV(sasl_pwdb, "MEMCACHED_SASL_PWDB", LIBMEMCACHED_WITH_SASL_PWDB); - SET_ENV(sasl_conf, "SASL_CONF_PATH", LIBMEMCACHED_WITH_SASL_CONF); + 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); } #else # define setup_sasl() #endif int setup(int &, char ***argv) { + random_setup(); + setup_signals(); setup_asan(*argv); setup_sasl();