mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-24 01:27:19 +03:00
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:
parent
3ecc3c8486
commit
e85e588e45
38 changed files with 129 additions and 87 deletions
|
|
@ -1,9 +1,5 @@
|
|||
#include "test/jemalloc_test.h"
|
||||
|
||||
#ifdef JEMALLOC_PROF
|
||||
const char *malloc_conf = "prof:true,lg_prof_sample:0";
|
||||
#endif
|
||||
|
||||
static unsigned
|
||||
get_nsizes_impl(const char *cmd)
|
||||
{
|
||||
|
|
|
|||
5
test/unit/arena_reset.sh
Normal file
5
test/unit/arena_reset.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,7 +1,5 @@
|
|||
#include "test/jemalloc_test.h"
|
||||
|
||||
const char *malloc_conf = "purge:decay,decay_time:1";
|
||||
|
||||
static nstime_monotonic_t *nstime_monotonic_orig;
|
||||
static nstime_update_t *nstime_update_orig;
|
||||
|
||||
|
|
|
|||
3
test/unit/decay.sh
Normal file
3
test/unit/decay.sh
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
export MALLOC_CONF="purge:decay,decay_time:1"
|
||||
|
|
@ -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,redzone:true,quarantine:0," JEMALLOC_TEST_JUNK_OPT;
|
||||
#endif
|
||||
|
||||
static arena_dalloc_junk_small_t *arena_dalloc_junk_small_orig;
|
||||
static arena_dalloc_junk_large_t *arena_dalloc_junk_large_orig;
|
||||
static huge_dalloc_junk_t *huge_dalloc_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,redzone:true,quarantine:0,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,redzone:true,quarantine:0,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,redzone:true,quarantine:0,junk:free"
|
||||
fi
|
||||
|
|
@ -1,12 +1,5 @@
|
|||
#include "test/jemalloc_test.h"
|
||||
|
||||
/*
|
||||
* Make sure that opt.lg_chunk clamping is sufficient. In practice, this test
|
||||
* program will fail a debug assertion during initialization and abort (rather
|
||||
* than the test soft-failing) if clamping is insufficient.
|
||||
*/
|
||||
const char *malloc_conf = "lg_chunk:0";
|
||||
|
||||
TEST_BEGIN(test_lg_chunk_clamp)
|
||||
{
|
||||
void *p;
|
||||
|
|
|
|||
6
test/unit/lg_chunk.sh
Normal file
6
test/unit/lg_chunk.sh
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Make sure that opt.lg_chunk clamping is sufficient. In practice, this test
|
||||
# program will fail a debug assertion during initialization and abort (rather
|
||||
# than the test soft-failing) if clamping is insufficient.
|
||||
export MALLOC_CONF="lg_chunk:0"
|
||||
|
|
@ -1,13 +1,5 @@
|
|||
#include "test/jemalloc_test.h"
|
||||
|
||||
const char *malloc_conf =
|
||||
/* Use smallest possible chunk size. */
|
||||
"lg_chunk:0"
|
||||
/* Immediately purge to minimize fragmentation. */
|
||||
",lg_dirty_mult:-1"
|
||||
",decay_time:-1"
|
||||
;
|
||||
|
||||
/*
|
||||
* Size class that is a divisor of the page size, ideally 4+ regions per run.
|
||||
*/
|
||||
|
|
|
|||
5
test/unit/pack.sh
Normal file
5
test/unit/pack.sh
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Use smallest possible chunk size. Immediately purge to minimize
|
||||
# fragmentation.
|
||||
export MALLOC_CONF="lg_chunk:0,lg_dirty_mult:-1,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)
|
||||
{
|
||||
|
|
|
|||
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)
|
||||
{
|
||||
|
|
|
|||
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,11 +1,5 @@
|
|||
#include "test/jemalloc_test.h"
|
||||
|
||||
#ifdef JEMALLOC_PROF
|
||||
const char *malloc_conf =
|
||||
"prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0,"
|
||||
"lg_prof_interval:0";
|
||||
#endif
|
||||
|
||||
static bool did_prof_dump_open;
|
||||
|
||||
static int
|
||||
|
|
|
|||
7
test/unit/prof_idump.sh
Normal file
7
test/unit/prof_idump.sh
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#!/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"
|
||||
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)
|
||||
{
|
||||
|
|
|
|||
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
|
||||
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,13 +1,7 @@
|
|||
#include "test/jemalloc_test.h"
|
||||
|
||||
/* Keep in sync with definition in quarantine.sh. */
|
||||
#define QUARANTINE_SIZE 8192
|
||||
#define STRINGIFY_HELPER(x) #x
|
||||
#define STRINGIFY(x) STRINGIFY_HELPER(x)
|
||||
|
||||
#ifdef JEMALLOC_FILL
|
||||
const char *malloc_conf = "abort:false,junk:true,redzone:true,quarantine:"
|
||||
STRINGIFY(QUARANTINE_SIZE);
|
||||
#endif
|
||||
|
||||
void
|
||||
quarantine_clear(void)
|
||||
|
|
|
|||
8
test/unit/quarantine.sh
Normal file
8
test/unit/quarantine.sh
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Keep in sync with definition in quarantine.c.
|
||||
export QUARANTINE_SIZE=8192
|
||||
|
||||
if [ "x${enable_fill}" = "x1" ] ; then
|
||||
export MALLOC_CONF="abort:false,junk:true,redzone:true,quarantine:${QUARANTINE_SIZE}"
|
||||
fi
|
||||
|
|
@ -1,10 +1,5 @@
|
|||
#include "test/jemalloc_test.h"
|
||||
|
||||
#ifdef JEMALLOC_FILL
|
||||
const char *malloc_conf =
|
||||
"abort:false,junk:false,zero:true,redzone:false,quarantine:0";
|
||||
#endif
|
||||
|
||||
static void
|
||||
test_zero(size_t sz_min, size_t sz_max)
|
||||
{
|
||||
|
|
|
|||
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,redzone:false,quarantine:0"
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue