Use MALLOC_CONF rather than malloc_conf for tests.
malloc_conf does not reliably work with MSVC, which complains of "inconsistent dll linkage", i.e. its inability to support the application overriding malloc_conf when dynamically linking/loading. Work around this limitation by adding test harness support for per test shell script sourcing, and converting all tests to use MALLOC_CONF instead of malloc_conf.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
#define ARENA_RESET_PROF_C_
|
||||
|
||||
const char *malloc_conf = "prof:true,lg_prof_sample:0";
|
||||
#include "arena_reset.c"
|
||||
|
3
test/unit/arena_reset_prof.sh
Normal file
3
test/unit/arena_reset_prof.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
export MALLOC_CONF="prof:true,lg_prof_sample:0"
|
@@ -1,11 +1,5 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
const char *malloc_conf = "decay_time:1"
|
||||
#ifdef JEMALLOC_TCACHE
|
||||
",lg_tcache_max:0"
|
||||
#endif
|
||||
;
|
||||
|
||||
static nstime_monotonic_t *nstime_monotonic_orig;
|
||||
static nstime_update_t *nstime_update_orig;
|
||||
|
||||
|
6
test/unit/decay.sh
Normal file
6
test/unit/decay.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
export MALLOC_CONF="decay_time:1"
|
||||
if [ "x${enable_tcache}" = "x1" ] ; then
|
||||
export MALLOC_CONF="${MALLOC_CONF},lg_tcache_max:0"
|
||||
fi
|
@@ -1,13 +1,5 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#ifdef JEMALLOC_FILL
|
||||
# ifndef JEMALLOC_TEST_JUNK_OPT
|
||||
# define JEMALLOC_TEST_JUNK_OPT "junk:true"
|
||||
# endif
|
||||
const char *malloc_conf =
|
||||
"abort:false,zero:false," JEMALLOC_TEST_JUNK_OPT;
|
||||
#endif
|
||||
|
||||
static arena_dalloc_junk_small_t *arena_dalloc_junk_small_orig;
|
||||
static large_dalloc_junk_t *large_dalloc_junk_orig;
|
||||
static large_dalloc_maybe_junk_t *large_dalloc_maybe_junk_orig;
|
||||
|
5
test/unit/junk.sh
Normal file
5
test/unit/junk.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x${enable_fill}" = "x1" ] ; then
|
||||
export MALLOC_CONF="abort:false,zero:false,junk:true"
|
||||
fi
|
@@ -1,3 +1 @@
|
||||
#define JEMALLOC_TEST_JUNK_OPT "junk:alloc"
|
||||
#include "junk.c"
|
||||
#undef JEMALLOC_TEST_JUNK_OPT
|
||||
|
5
test/unit/junk_alloc.sh
Normal file
5
test/unit/junk_alloc.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x${enable_fill}" = "x1" ] ; then
|
||||
export MALLOC_CONF="abort:false,zero:false,junk:alloc"
|
||||
fi
|
@@ -1,3 +1 @@
|
||||
#define JEMALLOC_TEST_JUNK_OPT "junk:free"
|
||||
#include "junk.c"
|
||||
#undef JEMALLOC_TEST_JUNK_OPT
|
||||
|
5
test/unit/junk_free.sh
Normal file
5
test/unit/junk_free.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x${enable_fill}" = "x1" ] ; then
|
||||
export MALLOC_CONF="abort:false,zero:false,junk:free"
|
||||
fi
|
@@ -1,8 +1,5 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
/* Immediately purge to minimize fragmentation. */
|
||||
const char *malloc_conf = "decay_time:-1";
|
||||
|
||||
/*
|
||||
* Size class that is a divisor of the page size, ideally 4+ regions per run.
|
||||
*/
|
||||
|
4
test/unit/pack.sh
Normal file
4
test/unit/pack.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Immediately purge to minimize fragmentation.
|
||||
export MALLOC_CONF="decay_time:-1"
|
@@ -5,11 +5,6 @@
|
||||
#define DUMP_INTERVAL 1
|
||||
#define BT_COUNT_CHECK_INTERVAL 5
|
||||
|
||||
#ifdef JEMALLOC_PROF
|
||||
const char *malloc_conf =
|
||||
"prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0";
|
||||
#endif
|
||||
|
||||
static int
|
||||
prof_dump_open_intercept(bool propagate_err, const char *filename) {
|
||||
int fd;
|
||||
|
5
test/unit/prof_accum.sh
Normal file
5
test/unit/prof_accum.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x${enable_prof}" = "x1" ] ; then
|
||||
export MALLOC_CONF="prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0"
|
||||
fi
|
@@ -1,10 +1,5 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#ifdef JEMALLOC_PROF
|
||||
const char *malloc_conf =
|
||||
"prof:true,prof_thread_active_init:false,lg_prof_sample:0";
|
||||
#endif
|
||||
|
||||
static void
|
||||
mallctl_bool_get(const char *name, bool expected, const char *func, int line) {
|
||||
bool old;
|
||||
|
5
test/unit/prof_active.sh
Normal file
5
test/unit/prof_active.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x${enable_prof}" = "x1" ] ; then
|
||||
export MALLOC_CONF="prof:true,prof_thread_active_init:false,lg_prof_sample:0"
|
||||
fi
|
@@ -1,9 +1,5 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#ifdef JEMALLOC_PROF
|
||||
const char *malloc_conf = "prof:true,prof_active:false,prof_gdump:true";
|
||||
#endif
|
||||
|
||||
static bool did_prof_dump_open;
|
||||
|
||||
static int
|
||||
|
6
test/unit/prof_gdump.sh
Normal file
6
test/unit/prof_gdump.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x${enable_prof}" = "x1" ] ; then
|
||||
export MALLOC_CONF="prof:true,prof_active:false,prof_gdump:true"
|
||||
fi
|
||||
|
@@ -1,18 +1,5 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
const char *malloc_conf = ""
|
||||
#ifdef JEMALLOC_PROF
|
||||
"prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0"
|
||||
",lg_prof_interval:0"
|
||||
# ifdef JEMALLOC_TCACHE
|
||||
","
|
||||
# endif
|
||||
#endif
|
||||
#ifdef JEMALLOC_TCACHE
|
||||
"tcache:false"
|
||||
#endif
|
||||
;
|
||||
|
||||
static bool did_prof_dump_open;
|
||||
|
||||
static int
|
||||
|
12
test/unit/prof_idump.sh
Normal file
12
test/unit/prof_idump.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x${enable_prof}" = "x1" ] ; then
|
||||
export MALLOC_CONF="prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0,lg_prof_interval:0"
|
||||
if [ "x${enable_tcache}" = "x1" ] ; then
|
||||
export MALLOC_CONF="${MALLOC_CONF},tcache:false"
|
||||
fi
|
||||
elif [ "x${enable_tcache}" = "x1" ] ; then
|
||||
export MALLOC_CONF="tcache:false"
|
||||
fi
|
||||
|
||||
|
@@ -1,10 +1,5 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#ifdef JEMALLOC_PROF
|
||||
const char *malloc_conf =
|
||||
"prof:true,prof_active:false,lg_prof_sample:0";
|
||||
#endif
|
||||
|
||||
static int
|
||||
prof_dump_open_intercept(bool propagate_err, const char *filename) {
|
||||
int fd;
|
||||
|
5
test/unit/prof_reset.sh
Normal file
5
test/unit/prof_reset.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x${enable_prof}" = "x1" ] ; then
|
||||
export MALLOC_CONF="prof:true,prof_active:false,lg_prof_sample:0"
|
||||
fi
|
@@ -1,9 +1,5 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#ifdef JEMALLOC_PROF
|
||||
const char *malloc_conf = "prof:true,lg_prof_sample:0";
|
||||
#endif
|
||||
|
||||
TEST_BEGIN(test_prof_realloc) {
|
||||
tsdn_t *tsdn;
|
||||
int flags;
|
||||
|
5
test/unit/prof_tctx.sh
Normal file
5
test/unit/prof_tctx.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x${enable_prof}" = "x1" ] ; then
|
||||
export MALLOC_CONF="prof:true,lg_prof_sample:0"
|
||||
fi
|
@@ -1,9 +1,5 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#ifdef JEMALLOC_PROF
|
||||
const char *malloc_conf = "prof:true,prof_active:false";
|
||||
#endif
|
||||
|
||||
static void
|
||||
mallctl_thread_name_get_impl(const char *thread_name_expected, const char *func,
|
||||
int line) {
|
||||
|
5
test/unit/prof_thread_name.sh
Normal file
5
test/unit/prof_thread_name.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x${enable_prof}" = "x1" ] ; then
|
||||
export MALLOC_CONF="prof:true,prof_active:false"
|
||||
fi
|
@@ -1,10 +1,5 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#ifdef JEMALLOC_FILL
|
||||
const char *malloc_conf =
|
||||
"abort:false,junk:false,zero:true";
|
||||
#endif
|
||||
|
||||
static void
|
||||
test_zero(size_t sz_min, size_t sz_max) {
|
||||
uint8_t *s;
|
||||
|
5
test/unit/zero.sh
Normal file
5
test/unit/zero.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x${enable_fill}" = "x1" ] ; then
|
||||
export MALLOC_CONF="abort:false,junk:false,zero:true"
|
||||
fi
|
Reference in New Issue
Block a user