]>
git.proxmox.com Git - rustc.git/blob - src/jemalloc/test/include/test/jemalloc_test.h.in
3 # define SIZE_T_MAX SIZE_MAX
12 # include "msvc_compat/strings.h"
17 # include "msvc_compat/windows_extra.h"
22 /******************************************************************************/
24 * Define always-enabled assertion macros, so that test assertions execute even
25 * if assertions are disabled in the library code. These definitions must
26 * exist prior to including "jemalloc/internal/util.h".
28 #define assert(e) do { \
31 "<jemalloc>: %s:%d: Failed assertion: \"%s\"\n", \
32 __FILE__, __LINE__, #e); \
37 #define not_reached() do { \
39 "<jemalloc>: %s:%d: Unreachable code reached\n", \
40 __FILE__, __LINE__); \
44 #define not_implemented() do { \
45 malloc_printf("<jemalloc>: %s:%d: Not implemented\n", \
46 __FILE__, __LINE__); \
50 #define assert_not_implemented(e) do { \
55 #include "test/jemalloc_test_defs.h"
57 #ifdef JEMALLOC_OSSPIN
58 # include <libkern/OSAtomic.h>
61 #if defined(HAVE_ALTIVEC) && !defined(__APPLE__)
65 # include <emmintrin.h>
68 /******************************************************************************/
70 * For unit tests, expose all public and private interfaces.
72 #ifdef JEMALLOC_UNIT_TEST
74 # define JEMALLOC_MANGLE
75 # include "jemalloc/internal/jemalloc_internal.h"
77 /******************************************************************************/
79 * For integration tests, expose the public jemalloc interfaces, but only
80 * expose the minimum necessary internal utility code (to avoid re-implementing
81 * essentially identical code within the test infrastructure).
83 #elif defined(JEMALLOC_INTEGRATION_TEST)
84 # define JEMALLOC_MANGLE
85 # include "jemalloc/jemalloc@install_suffix@.h"
86 # include "jemalloc/internal/jemalloc_internal_defs.h"
87 # include "jemalloc/internal/jemalloc_internal_macros.h"
89 # define JEMALLOC_N(n) @private_namespace@##n
90 # include "jemalloc/internal/private_namespace.h"
92 # define JEMALLOC_H_TYPES
93 # define JEMALLOC_H_STRUCTS
94 # define JEMALLOC_H_EXTERNS
95 # define JEMALLOC_H_INLINES
96 # include "jemalloc/internal/nstime.h"
97 # include "jemalloc/internal/util.h"
98 # include "jemalloc/internal/qr.h"
99 # include "jemalloc/internal/ql.h"
100 # undef JEMALLOC_H_TYPES
101 # undef JEMALLOC_H_STRUCTS
102 # undef JEMALLOC_H_EXTERNS
103 # undef JEMALLOC_H_INLINES
105 /******************************************************************************/
107 * For stress tests, expose the public jemalloc interfaces with name mangling
108 * so that they can be tested as e.g. malloc() and free(). Also expose the
109 * public jemalloc interfaces with jet_ prefixes, so that stress tests can use
110 * a separate allocator for their internal data structures.
112 #elif defined(JEMALLOC_STRESS_TEST)
113 # include "jemalloc/jemalloc@install_suffix@.h"
115 # include "jemalloc/jemalloc_protos_jet.h"
117 # define JEMALLOC_JET
118 # include "jemalloc/internal/jemalloc_internal.h"
119 # include "jemalloc/internal/public_unnamespace.h"
122 # include "jemalloc/jemalloc_rename.h"
123 # define JEMALLOC_MANGLE
124 # ifdef JEMALLOC_STRESS_TESTLIB
125 # include "jemalloc/jemalloc_mangle_jet.h"
127 # include "jemalloc/jemalloc_mangle.h"
130 /******************************************************************************/
132 * This header does dangerous things, the effects of which only test code
133 * should be subject to.
136 # error "This header cannot be included outside a testing context"
139 /******************************************************************************/
141 * Common test utilities.
143 #include "test/btalloc.h"
144 #include "test/math.h"
145 #include "test/mtx.h"
147 #include "test/test.h"
148 #include "test/timer.h"
149 #include "test/thd.h"
151 #include "test/SFMT.h"