Blame memkind-1.10.0/jemalloc/test/include/test/jemalloc_test.h.in

Packit 345191
#ifdef __cplusplus
Packit 345191
extern "C" {
Packit 345191
#endif
Packit 345191
Packit 345191
#include <limits.h>
Packit 345191
#ifndef SIZE_T_MAX
Packit 345191
#  define SIZE_T_MAX	SIZE_MAX
Packit 345191
#endif
Packit 345191
#include <stdlib.h>
Packit 345191
#include <stdarg.h>
Packit 345191
#include <stdbool.h>
Packit 345191
#include <errno.h>
Packit 345191
#include <math.h>
Packit 345191
#include <string.h>
Packit 345191
#ifdef _WIN32
Packit 345191
#  include "msvc_compat/strings.h"
Packit 345191
#endif
Packit 345191
Packit 345191
#ifdef _WIN32
Packit 345191
#  include <windows.h>
Packit 345191
#  include "msvc_compat/windows_extra.h"
Packit 345191
#else
Packit 345191
#  include <pthread.h>
Packit 345191
#endif
Packit 345191
Packit 345191
#include "test/jemalloc_test_defs.h"
Packit 345191
Packit 345191
#if defined(JEMALLOC_OSATOMIC)
Packit 345191
#  include <libkern/OSAtomic.h>
Packit 345191
#endif
Packit 345191
Packit 345191
#if defined(HAVE_ALTIVEC) && !defined(__APPLE__)
Packit 345191
#  include <altivec.h>
Packit 345191
#endif
Packit 345191
#ifdef HAVE_SSE2
Packit 345191
#  include <emmintrin.h>
Packit 345191
#endif
Packit 345191
Packit 345191
/******************************************************************************/
Packit 345191
/*
Packit 345191
 * For unit tests, expose all public and private interfaces.
Packit 345191
 */
Packit 345191
#ifdef JEMALLOC_UNIT_TEST
Packit 345191
#  define JEMALLOC_JET
Packit 345191
#  define JEMALLOC_MANGLE
Packit 345191
#  include "jemalloc/internal/jemalloc_preamble.h"
Packit 345191
#  include "jemalloc/internal/jemalloc_internal_includes.h"
Packit 345191
Packit 345191
/******************************************************************************/
Packit 345191
/*
Packit 345191
 * For integration tests, expose the public jemalloc interfaces, but only
Packit 345191
 * expose the minimum necessary internal utility code (to avoid re-implementing
Packit 345191
 * essentially identical code within the test infrastructure).
Packit 345191
 */
Packit 345191
#elif defined(JEMALLOC_INTEGRATION_TEST) || \
Packit 345191
    defined(JEMALLOC_INTEGRATION_CPP_TEST)
Packit 345191
#  define JEMALLOC_MANGLE
Packit 345191
#  include "jemalloc/jemalloc@install_suffix@.h"
Packit 345191
#  include "jemalloc/internal/jemalloc_internal_defs.h"
Packit 345191
#  include "jemalloc/internal/jemalloc_internal_macros.h"
Packit 345191
Packit 345191
static const bool config_debug =
Packit 345191
#ifdef JEMALLOC_DEBUG
Packit 345191
    true
Packit 345191
#else
Packit 345191
    false
Packit 345191
#endif
Packit 345191
    ;
Packit 345191
Packit 345191
#  define JEMALLOC_N(n) @private_namespace@##n
Packit 345191
#  include "jemalloc/internal/private_namespace.h"
Packit 345191
#  include "jemalloc/internal/test_hooks.h"
Packit 345191
Packit 345191
/* Hermetic headers. */
Packit 345191
#  include "jemalloc/internal/assert.h"
Packit 345191
#  include "jemalloc/internal/malloc_io.h"
Packit 345191
#  include "jemalloc/internal/nstime.h"
Packit 345191
#  include "jemalloc/internal/util.h"
Packit 345191
Packit 345191
/* Non-hermetic headers. */
Packit 345191
#  include "jemalloc/internal/qr.h"
Packit 345191
#  include "jemalloc/internal/ql.h"
Packit 345191
Packit 345191
/******************************************************************************/
Packit 345191
/*
Packit 345191
 * For stress tests, expose the public jemalloc interfaces with name mangling
Packit 345191
 * so that they can be tested as e.g. malloc() and free().  Also expose the
Packit 345191
 * public jemalloc interfaces with jet_ prefixes, so that stress tests can use
Packit 345191
 * a separate allocator for their internal data structures.
Packit 345191
 */
Packit 345191
#elif defined(JEMALLOC_STRESS_TEST)
Packit 345191
#  include "jemalloc/jemalloc@install_suffix@.h"
Packit 345191
Packit 345191
#  include "jemalloc/jemalloc_protos_jet.h"
Packit 345191
Packit 345191
#  define JEMALLOC_JET
Packit 345191
#  include "jemalloc/internal/jemalloc_preamble.h"
Packit 345191
#  include "jemalloc/internal/jemalloc_internal_includes.h"
Packit 345191
#  include "jemalloc/internal/public_unnamespace.h"
Packit 345191
#  undef JEMALLOC_JET
Packit 345191
Packit 345191
#  include "jemalloc/jemalloc_rename.h"
Packit 345191
#  define JEMALLOC_MANGLE
Packit 345191
#  ifdef JEMALLOC_STRESS_TESTLIB
Packit 345191
#    include "jemalloc/jemalloc_mangle_jet.h"
Packit 345191
#  else
Packit 345191
#    include "jemalloc/jemalloc_mangle.h"
Packit 345191
#  endif
Packit 345191
Packit 345191
/******************************************************************************/
Packit 345191
/*
Packit 345191
 * This header does dangerous things, the effects of which only test code
Packit 345191
 * should be subject to.
Packit 345191
 */
Packit 345191
#else
Packit 345191
#  error "This header cannot be included outside a testing context"
Packit 345191
#endif
Packit 345191
Packit 345191
/******************************************************************************/
Packit 345191
/*
Packit 345191
 * Common test utilities.
Packit 345191
 */
Packit 345191
#include "test/btalloc.h"
Packit 345191
#include "test/math.h"
Packit 345191
#include "test/mtx.h"
Packit 345191
#include "test/mq.h"
Packit 345191
#include "test/test.h"
Packit 345191
#include "test/timer.h"
Packit 345191
#include "test/thd.h"
Packit 345191
#define MEXP 19937
Packit 345191
#include "test/SFMT.h"
Packit 345191
Packit 345191
/******************************************************************************/
Packit 345191
/*
Packit 345191
 * Define always-enabled assertion macros, so that test assertions execute even
Packit 345191
 * if assertions are disabled in the library code.
Packit 345191
 */
Packit 345191
#undef assert
Packit 345191
#undef not_reached
Packit 345191
#undef not_implemented
Packit 345191
#undef assert_not_implemented
Packit 345191
Packit 345191
#define assert(e) do {							\
Packit 345191
	if (!(e)) {							\
Packit 345191
		malloc_printf(						\
Packit 345191
		    "<jemalloc>: %s:%d: Failed assertion: \"%s\"\n",	\
Packit 345191
		    __FILE__, __LINE__, #e);				\
Packit 345191
		abort();						\
Packit 345191
	}								\
Packit 345191
} while (0)
Packit 345191
Packit 345191
#define not_reached() do {						\
Packit 345191
	malloc_printf(							\
Packit 345191
	    "<jemalloc>: %s:%d: Unreachable code reached\n",		\
Packit 345191
	    __FILE__, __LINE__);					\
Packit 345191
	abort();							\
Packit 345191
} while (0)
Packit 345191
Packit 345191
#define not_implemented() do {						\
Packit 345191
	malloc_printf("<jemalloc>: %s:%d: Not implemented\n",		\
Packit 345191
	    __FILE__, __LINE__);					\
Packit 345191
	abort();							\
Packit 345191
} while (0)
Packit 345191
Packit 345191
#define assert_not_implemented(e) do {					\
Packit 345191
	if (!(e)) {							\
Packit 345191
		not_implemented();					\
Packit 345191
	}								\
Packit 345191
} while (0)
Packit 345191
Packit 345191
#ifdef __cplusplus
Packit 345191
}
Packit 345191
#endif