@@ -1,12 +1,12 @@
|
||||
/* btalloc() provides a mechanism for allocating via permuted backtraces. */
|
||||
void *btalloc(size_t size, unsigned bits);
|
||||
|
||||
#define btalloc_n_proto(n) \
|
||||
#define btalloc_n_proto(n) \
|
||||
void *btalloc_##n(size_t size, unsigned bits);
|
||||
btalloc_n_proto(0)
|
||||
btalloc_n_proto(1)
|
||||
|
||||
#define btalloc_n_gen(n) \
|
||||
#define btalloc_n_gen(n) \
|
||||
void * \
|
||||
btalloc_##n(size_t size, unsigned bits) { \
|
||||
void *p; \
|
||||
|
@@ -123,7 +123,7 @@ static const bool config_debug =
|
||||
#include "test/test.h"
|
||||
#include "test/timer.h"
|
||||
#include "test/thd.h"
|
||||
#define MEXP 19937
|
||||
#define MEXP 19937
|
||||
#include "test/SFMT.h"
|
||||
|
||||
/******************************************************************************/
|
||||
@@ -136,7 +136,7 @@ static const bool config_debug =
|
||||
#undef not_implemented
|
||||
#undef assert_not_implemented
|
||||
|
||||
#define assert(e) do { \
|
||||
#define assert(e) do { \
|
||||
if (!(e)) { \
|
||||
malloc_printf( \
|
||||
"<jemalloc>: %s:%d: Failed assertion: \"%s\"\n", \
|
||||
@@ -145,20 +145,20 @@ static const bool config_debug =
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define not_reached() do { \
|
||||
#define not_reached() do { \
|
||||
malloc_printf( \
|
||||
"<jemalloc>: %s:%d: Unreachable code reached\n", \
|
||||
__FILE__, __LINE__); \
|
||||
abort(); \
|
||||
} while (0)
|
||||
|
||||
#define not_implemented() do { \
|
||||
#define not_implemented() do { \
|
||||
malloc_printf("<jemalloc>: %s:%d: Not implemented\n", \
|
||||
__FILE__, __LINE__); \
|
||||
abort(); \
|
||||
} while (0)
|
||||
|
||||
#define assert_not_implemented(e) do { \
|
||||
#define assert_not_implemented(e) do { \
|
||||
if (!(e)) { \
|
||||
not_implemented(); \
|
||||
} \
|
||||
|
@@ -26,9 +26,9 @@ void mq_nanosleep(unsigned ns);
|
||||
* does not perform any cleanup of messages, since it knows nothing of their
|
||||
* payloads.
|
||||
*/
|
||||
#define mq_msg(a_mq_msg_type) ql_elm(a_mq_msg_type)
|
||||
#define mq_msg(a_mq_msg_type) ql_elm(a_mq_msg_type)
|
||||
|
||||
#define mq_gen(a_attr, a_prefix, a_mq_type, a_mq_msg_type, a_field) \
|
||||
#define mq_gen(a_attr, a_prefix, a_mq_type, a_mq_msg_type, a_field) \
|
||||
typedef struct { \
|
||||
mtx_t lock; \
|
||||
ql_head(a_mq_msg_type) msgs; \
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#define ASSERT_BUFSIZE 256
|
||||
#define ASSERT_BUFSIZE 256
|
||||
|
||||
#define assert_cmp(t, a, b, cmp, neg_cmp, pri, ...) do { \
|
||||
#define assert_cmp(t, a, b, cmp, neg_cmp, pri, ...) do { \
|
||||
t a_ = (a); \
|
||||
t b_ = (b); \
|
||||
if (!(a_ cmp b_)) { \
|
||||
@@ -17,200 +17,200 @@
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define assert_ptr_eq(a, b, ...) assert_cmp(void *, a, b, ==, \
|
||||
#define assert_ptr_eq(a, b, ...) assert_cmp(void *, a, b, ==, \
|
||||
!=, "p", __VA_ARGS__)
|
||||
#define assert_ptr_ne(a, b, ...) assert_cmp(void *, a, b, !=, \
|
||||
#define assert_ptr_ne(a, b, ...) assert_cmp(void *, a, b, !=, \
|
||||
==, "p", __VA_ARGS__)
|
||||
#define assert_ptr_null(a, ...) assert_cmp(void *, a, NULL, ==, \
|
||||
#define assert_ptr_null(a, ...) assert_cmp(void *, a, NULL, ==, \
|
||||
!=, "p", __VA_ARGS__)
|
||||
#define assert_ptr_not_null(a, ...) assert_cmp(void *, a, NULL, !=, \
|
||||
#define assert_ptr_not_null(a, ...) assert_cmp(void *, a, NULL, !=, \
|
||||
==, "p", __VA_ARGS__)
|
||||
|
||||
#define assert_c_eq(a, b, ...) assert_cmp(char, a, b, ==, !=, "c", __VA_ARGS__)
|
||||
#define assert_c_ne(a, b, ...) assert_cmp(char, a, b, !=, ==, "c", __VA_ARGS__)
|
||||
#define assert_c_lt(a, b, ...) assert_cmp(char, a, b, <, >=, "c", __VA_ARGS__)
|
||||
#define assert_c_le(a, b, ...) assert_cmp(char, a, b, <=, >, "c", __VA_ARGS__)
|
||||
#define assert_c_ge(a, b, ...) assert_cmp(char, a, b, >=, <, "c", __VA_ARGS__)
|
||||
#define assert_c_gt(a, b, ...) assert_cmp(char, a, b, >, <=, "c", __VA_ARGS__)
|
||||
#define assert_c_eq(a, b, ...) assert_cmp(char, a, b, ==, !=, "c", __VA_ARGS__)
|
||||
#define assert_c_ne(a, b, ...) assert_cmp(char, a, b, !=, ==, "c", __VA_ARGS__)
|
||||
#define assert_c_lt(a, b, ...) assert_cmp(char, a, b, <, >=, "c", __VA_ARGS__)
|
||||
#define assert_c_le(a, b, ...) assert_cmp(char, a, b, <=, >, "c", __VA_ARGS__)
|
||||
#define assert_c_ge(a, b, ...) assert_cmp(char, a, b, >=, <, "c", __VA_ARGS__)
|
||||
#define assert_c_gt(a, b, ...) assert_cmp(char, a, b, >, <=, "c", __VA_ARGS__)
|
||||
|
||||
#define assert_x_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "#x", __VA_ARGS__)
|
||||
#define assert_x_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "#x", __VA_ARGS__)
|
||||
#define assert_x_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "#x", __VA_ARGS__)
|
||||
#define assert_x_le(a, b, ...) assert_cmp(int, a, b, <=, >, "#x", __VA_ARGS__)
|
||||
#define assert_x_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "#x", __VA_ARGS__)
|
||||
#define assert_x_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "#x", __VA_ARGS__)
|
||||
#define assert_x_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "#x", __VA_ARGS__)
|
||||
#define assert_x_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "#x", __VA_ARGS__)
|
||||
#define assert_x_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "#x", __VA_ARGS__)
|
||||
#define assert_x_le(a, b, ...) assert_cmp(int, a, b, <=, >, "#x", __VA_ARGS__)
|
||||
#define assert_x_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "#x", __VA_ARGS__)
|
||||
#define assert_x_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "#x", __VA_ARGS__)
|
||||
|
||||
#define assert_d_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "d", __VA_ARGS__)
|
||||
#define assert_d_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "d", __VA_ARGS__)
|
||||
#define assert_d_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "d", __VA_ARGS__)
|
||||
#define assert_d_le(a, b, ...) assert_cmp(int, a, b, <=, >, "d", __VA_ARGS__)
|
||||
#define assert_d_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "d", __VA_ARGS__)
|
||||
#define assert_d_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "d", __VA_ARGS__)
|
||||
#define assert_d_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "d", __VA_ARGS__)
|
||||
#define assert_d_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "d", __VA_ARGS__)
|
||||
#define assert_d_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "d", __VA_ARGS__)
|
||||
#define assert_d_le(a, b, ...) assert_cmp(int, a, b, <=, >, "d", __VA_ARGS__)
|
||||
#define assert_d_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "d", __VA_ARGS__)
|
||||
#define assert_d_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "d", __VA_ARGS__)
|
||||
|
||||
#define assert_u_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "u", __VA_ARGS__)
|
||||
#define assert_u_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "u", __VA_ARGS__)
|
||||
#define assert_u_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "u", __VA_ARGS__)
|
||||
#define assert_u_le(a, b, ...) assert_cmp(int, a, b, <=, >, "u", __VA_ARGS__)
|
||||
#define assert_u_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "u", __VA_ARGS__)
|
||||
#define assert_u_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "u", __VA_ARGS__)
|
||||
#define assert_u_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "u", __VA_ARGS__)
|
||||
#define assert_u_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "u", __VA_ARGS__)
|
||||
#define assert_u_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "u", __VA_ARGS__)
|
||||
#define assert_u_le(a, b, ...) assert_cmp(int, a, b, <=, >, "u", __VA_ARGS__)
|
||||
#define assert_u_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "u", __VA_ARGS__)
|
||||
#define assert_u_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "u", __VA_ARGS__)
|
||||
|
||||
#define assert_ld_eq(a, b, ...) assert_cmp(long, a, b, ==, \
|
||||
#define assert_ld_eq(a, b, ...) assert_cmp(long, a, b, ==, \
|
||||
!=, "ld", __VA_ARGS__)
|
||||
#define assert_ld_ne(a, b, ...) assert_cmp(long, a, b, !=, \
|
||||
#define assert_ld_ne(a, b, ...) assert_cmp(long, a, b, !=, \
|
||||
==, "ld", __VA_ARGS__)
|
||||
#define assert_ld_lt(a, b, ...) assert_cmp(long, a, b, <, \
|
||||
#define assert_ld_lt(a, b, ...) assert_cmp(long, a, b, <, \
|
||||
>=, "ld", __VA_ARGS__)
|
||||
#define assert_ld_le(a, b, ...) assert_cmp(long, a, b, <=, \
|
||||
#define assert_ld_le(a, b, ...) assert_cmp(long, a, b, <=, \
|
||||
>, "ld", __VA_ARGS__)
|
||||
#define assert_ld_ge(a, b, ...) assert_cmp(long, a, b, >=, \
|
||||
#define assert_ld_ge(a, b, ...) assert_cmp(long, a, b, >=, \
|
||||
<, "ld", __VA_ARGS__)
|
||||
#define assert_ld_gt(a, b, ...) assert_cmp(long, a, b, >, \
|
||||
#define assert_ld_gt(a, b, ...) assert_cmp(long, a, b, >, \
|
||||
<=, "ld", __VA_ARGS__)
|
||||
|
||||
#define assert_lu_eq(a, b, ...) assert_cmp(unsigned long, \
|
||||
#define assert_lu_eq(a, b, ...) assert_cmp(unsigned long, \
|
||||
a, b, ==, !=, "lu", __VA_ARGS__)
|
||||
#define assert_lu_ne(a, b, ...) assert_cmp(unsigned long, \
|
||||
#define assert_lu_ne(a, b, ...) assert_cmp(unsigned long, \
|
||||
a, b, !=, ==, "lu", __VA_ARGS__)
|
||||
#define assert_lu_lt(a, b, ...) assert_cmp(unsigned long, \
|
||||
#define assert_lu_lt(a, b, ...) assert_cmp(unsigned long, \
|
||||
a, b, <, >=, "lu", __VA_ARGS__)
|
||||
#define assert_lu_le(a, b, ...) assert_cmp(unsigned long, \
|
||||
#define assert_lu_le(a, b, ...) assert_cmp(unsigned long, \
|
||||
a, b, <=, >, "lu", __VA_ARGS__)
|
||||
#define assert_lu_ge(a, b, ...) assert_cmp(unsigned long, \
|
||||
#define assert_lu_ge(a, b, ...) assert_cmp(unsigned long, \
|
||||
a, b, >=, <, "lu", __VA_ARGS__)
|
||||
#define assert_lu_gt(a, b, ...) assert_cmp(unsigned long, \
|
||||
#define assert_lu_gt(a, b, ...) assert_cmp(unsigned long, \
|
||||
a, b, >, <=, "lu", __VA_ARGS__)
|
||||
|
||||
#define assert_qd_eq(a, b, ...) assert_cmp(long long, a, b, ==, \
|
||||
#define assert_qd_eq(a, b, ...) assert_cmp(long long, a, b, ==, \
|
||||
!=, "qd", __VA_ARGS__)
|
||||
#define assert_qd_ne(a, b, ...) assert_cmp(long long, a, b, !=, \
|
||||
#define assert_qd_ne(a, b, ...) assert_cmp(long long, a, b, !=, \
|
||||
==, "qd", __VA_ARGS__)
|
||||
#define assert_qd_lt(a, b, ...) assert_cmp(long long, a, b, <, \
|
||||
#define assert_qd_lt(a, b, ...) assert_cmp(long long, a, b, <, \
|
||||
>=, "qd", __VA_ARGS__)
|
||||
#define assert_qd_le(a, b, ...) assert_cmp(long long, a, b, <=, \
|
||||
#define assert_qd_le(a, b, ...) assert_cmp(long long, a, b, <=, \
|
||||
>, "qd", __VA_ARGS__)
|
||||
#define assert_qd_ge(a, b, ...) assert_cmp(long long, a, b, >=, \
|
||||
#define assert_qd_ge(a, b, ...) assert_cmp(long long, a, b, >=, \
|
||||
<, "qd", __VA_ARGS__)
|
||||
#define assert_qd_gt(a, b, ...) assert_cmp(long long, a, b, >, \
|
||||
#define assert_qd_gt(a, b, ...) assert_cmp(long long, a, b, >, \
|
||||
<=, "qd", __VA_ARGS__)
|
||||
|
||||
#define assert_qu_eq(a, b, ...) assert_cmp(unsigned long long, \
|
||||
#define assert_qu_eq(a, b, ...) assert_cmp(unsigned long long, \
|
||||
a, b, ==, !=, "qu", __VA_ARGS__)
|
||||
#define assert_qu_ne(a, b, ...) assert_cmp(unsigned long long, \
|
||||
#define assert_qu_ne(a, b, ...) assert_cmp(unsigned long long, \
|
||||
a, b, !=, ==, "qu", __VA_ARGS__)
|
||||
#define assert_qu_lt(a, b, ...) assert_cmp(unsigned long long, \
|
||||
#define assert_qu_lt(a, b, ...) assert_cmp(unsigned long long, \
|
||||
a, b, <, >=, "qu", __VA_ARGS__)
|
||||
#define assert_qu_le(a, b, ...) assert_cmp(unsigned long long, \
|
||||
#define assert_qu_le(a, b, ...) assert_cmp(unsigned long long, \
|
||||
a, b, <=, >, "qu", __VA_ARGS__)
|
||||
#define assert_qu_ge(a, b, ...) assert_cmp(unsigned long long, \
|
||||
#define assert_qu_ge(a, b, ...) assert_cmp(unsigned long long, \
|
||||
a, b, >=, <, "qu", __VA_ARGS__)
|
||||
#define assert_qu_gt(a, b, ...) assert_cmp(unsigned long long, \
|
||||
#define assert_qu_gt(a, b, ...) assert_cmp(unsigned long long, \
|
||||
a, b, >, <=, "qu", __VA_ARGS__)
|
||||
|
||||
#define assert_jd_eq(a, b, ...) assert_cmp(intmax_t, a, b, ==, \
|
||||
#define assert_jd_eq(a, b, ...) assert_cmp(intmax_t, a, b, ==, \
|
||||
!=, "jd", __VA_ARGS__)
|
||||
#define assert_jd_ne(a, b, ...) assert_cmp(intmax_t, a, b, !=, \
|
||||
#define assert_jd_ne(a, b, ...) assert_cmp(intmax_t, a, b, !=, \
|
||||
==, "jd", __VA_ARGS__)
|
||||
#define assert_jd_lt(a, b, ...) assert_cmp(intmax_t, a, b, <, \
|
||||
#define assert_jd_lt(a, b, ...) assert_cmp(intmax_t, a, b, <, \
|
||||
>=, "jd", __VA_ARGS__)
|
||||
#define assert_jd_le(a, b, ...) assert_cmp(intmax_t, a, b, <=, \
|
||||
#define assert_jd_le(a, b, ...) assert_cmp(intmax_t, a, b, <=, \
|
||||
>, "jd", __VA_ARGS__)
|
||||
#define assert_jd_ge(a, b, ...) assert_cmp(intmax_t, a, b, >=, \
|
||||
#define assert_jd_ge(a, b, ...) assert_cmp(intmax_t, a, b, >=, \
|
||||
<, "jd", __VA_ARGS__)
|
||||
#define assert_jd_gt(a, b, ...) assert_cmp(intmax_t, a, b, >, \
|
||||
#define assert_jd_gt(a, b, ...) assert_cmp(intmax_t, a, b, >, \
|
||||
<=, "jd", __VA_ARGS__)
|
||||
|
||||
#define assert_ju_eq(a, b, ...) assert_cmp(uintmax_t, a, b, ==, \
|
||||
#define assert_ju_eq(a, b, ...) assert_cmp(uintmax_t, a, b, ==, \
|
||||
!=, "ju", __VA_ARGS__)
|
||||
#define assert_ju_ne(a, b, ...) assert_cmp(uintmax_t, a, b, !=, \
|
||||
#define assert_ju_ne(a, b, ...) assert_cmp(uintmax_t, a, b, !=, \
|
||||
==, "ju", __VA_ARGS__)
|
||||
#define assert_ju_lt(a, b, ...) assert_cmp(uintmax_t, a, b, <, \
|
||||
#define assert_ju_lt(a, b, ...) assert_cmp(uintmax_t, a, b, <, \
|
||||
>=, "ju", __VA_ARGS__)
|
||||
#define assert_ju_le(a, b, ...) assert_cmp(uintmax_t, a, b, <=, \
|
||||
#define assert_ju_le(a, b, ...) assert_cmp(uintmax_t, a, b, <=, \
|
||||
>, "ju", __VA_ARGS__)
|
||||
#define assert_ju_ge(a, b, ...) assert_cmp(uintmax_t, a, b, >=, \
|
||||
#define assert_ju_ge(a, b, ...) assert_cmp(uintmax_t, a, b, >=, \
|
||||
<, "ju", __VA_ARGS__)
|
||||
#define assert_ju_gt(a, b, ...) assert_cmp(uintmax_t, a, b, >, \
|
||||
#define assert_ju_gt(a, b, ...) assert_cmp(uintmax_t, a, b, >, \
|
||||
<=, "ju", __VA_ARGS__)
|
||||
|
||||
#define assert_zd_eq(a, b, ...) assert_cmp(ssize_t, a, b, ==, \
|
||||
#define assert_zd_eq(a, b, ...) assert_cmp(ssize_t, a, b, ==, \
|
||||
!=, "zd", __VA_ARGS__)
|
||||
#define assert_zd_ne(a, b, ...) assert_cmp(ssize_t, a, b, !=, \
|
||||
#define assert_zd_ne(a, b, ...) assert_cmp(ssize_t, a, b, !=, \
|
||||
==, "zd", __VA_ARGS__)
|
||||
#define assert_zd_lt(a, b, ...) assert_cmp(ssize_t, a, b, <, \
|
||||
#define assert_zd_lt(a, b, ...) assert_cmp(ssize_t, a, b, <, \
|
||||
>=, "zd", __VA_ARGS__)
|
||||
#define assert_zd_le(a, b, ...) assert_cmp(ssize_t, a, b, <=, \
|
||||
#define assert_zd_le(a, b, ...) assert_cmp(ssize_t, a, b, <=, \
|
||||
>, "zd", __VA_ARGS__)
|
||||
#define assert_zd_ge(a, b, ...) assert_cmp(ssize_t, a, b, >=, \
|
||||
#define assert_zd_ge(a, b, ...) assert_cmp(ssize_t, a, b, >=, \
|
||||
<, "zd", __VA_ARGS__)
|
||||
#define assert_zd_gt(a, b, ...) assert_cmp(ssize_t, a, b, >, \
|
||||
#define assert_zd_gt(a, b, ...) assert_cmp(ssize_t, a, b, >, \
|
||||
<=, "zd", __VA_ARGS__)
|
||||
|
||||
#define assert_zu_eq(a, b, ...) assert_cmp(size_t, a, b, ==, \
|
||||
#define assert_zu_eq(a, b, ...) assert_cmp(size_t, a, b, ==, \
|
||||
!=, "zu", __VA_ARGS__)
|
||||
#define assert_zu_ne(a, b, ...) assert_cmp(size_t, a, b, !=, \
|
||||
#define assert_zu_ne(a, b, ...) assert_cmp(size_t, a, b, !=, \
|
||||
==, "zu", __VA_ARGS__)
|
||||
#define assert_zu_lt(a, b, ...) assert_cmp(size_t, a, b, <, \
|
||||
#define assert_zu_lt(a, b, ...) assert_cmp(size_t, a, b, <, \
|
||||
>=, "zu", __VA_ARGS__)
|
||||
#define assert_zu_le(a, b, ...) assert_cmp(size_t, a, b, <=, \
|
||||
#define assert_zu_le(a, b, ...) assert_cmp(size_t, a, b, <=, \
|
||||
>, "zu", __VA_ARGS__)
|
||||
#define assert_zu_ge(a, b, ...) assert_cmp(size_t, a, b, >=, \
|
||||
#define assert_zu_ge(a, b, ...) assert_cmp(size_t, a, b, >=, \
|
||||
<, "zu", __VA_ARGS__)
|
||||
#define assert_zu_gt(a, b, ...) assert_cmp(size_t, a, b, >, \
|
||||
#define assert_zu_gt(a, b, ...) assert_cmp(size_t, a, b, >, \
|
||||
<=, "zu", __VA_ARGS__)
|
||||
|
||||
#define assert_d32_eq(a, b, ...) assert_cmp(int32_t, a, b, ==, \
|
||||
#define assert_d32_eq(a, b, ...) assert_cmp(int32_t, a, b, ==, \
|
||||
!=, FMTd32, __VA_ARGS__)
|
||||
#define assert_d32_ne(a, b, ...) assert_cmp(int32_t, a, b, !=, \
|
||||
#define assert_d32_ne(a, b, ...) assert_cmp(int32_t, a, b, !=, \
|
||||
==, FMTd32, __VA_ARGS__)
|
||||
#define assert_d32_lt(a, b, ...) assert_cmp(int32_t, a, b, <, \
|
||||
#define assert_d32_lt(a, b, ...) assert_cmp(int32_t, a, b, <, \
|
||||
>=, FMTd32, __VA_ARGS__)
|
||||
#define assert_d32_le(a, b, ...) assert_cmp(int32_t, a, b, <=, \
|
||||
#define assert_d32_le(a, b, ...) assert_cmp(int32_t, a, b, <=, \
|
||||
>, FMTd32, __VA_ARGS__)
|
||||
#define assert_d32_ge(a, b, ...) assert_cmp(int32_t, a, b, >=, \
|
||||
#define assert_d32_ge(a, b, ...) assert_cmp(int32_t, a, b, >=, \
|
||||
<, FMTd32, __VA_ARGS__)
|
||||
#define assert_d32_gt(a, b, ...) assert_cmp(int32_t, a, b, >, \
|
||||
#define assert_d32_gt(a, b, ...) assert_cmp(int32_t, a, b, >, \
|
||||
<=, FMTd32, __VA_ARGS__)
|
||||
|
||||
#define assert_u32_eq(a, b, ...) assert_cmp(uint32_t, a, b, ==, \
|
||||
#define assert_u32_eq(a, b, ...) assert_cmp(uint32_t, a, b, ==, \
|
||||
!=, FMTu32, __VA_ARGS__)
|
||||
#define assert_u32_ne(a, b, ...) assert_cmp(uint32_t, a, b, !=, \
|
||||
#define assert_u32_ne(a, b, ...) assert_cmp(uint32_t, a, b, !=, \
|
||||
==, FMTu32, __VA_ARGS__)
|
||||
#define assert_u32_lt(a, b, ...) assert_cmp(uint32_t, a, b, <, \
|
||||
#define assert_u32_lt(a, b, ...) assert_cmp(uint32_t, a, b, <, \
|
||||
>=, FMTu32, __VA_ARGS__)
|
||||
#define assert_u32_le(a, b, ...) assert_cmp(uint32_t, a, b, <=, \
|
||||
#define assert_u32_le(a, b, ...) assert_cmp(uint32_t, a, b, <=, \
|
||||
>, FMTu32, __VA_ARGS__)
|
||||
#define assert_u32_ge(a, b, ...) assert_cmp(uint32_t, a, b, >=, \
|
||||
#define assert_u32_ge(a, b, ...) assert_cmp(uint32_t, a, b, >=, \
|
||||
<, FMTu32, __VA_ARGS__)
|
||||
#define assert_u32_gt(a, b, ...) assert_cmp(uint32_t, a, b, >, \
|
||||
#define assert_u32_gt(a, b, ...) assert_cmp(uint32_t, a, b, >, \
|
||||
<=, FMTu32, __VA_ARGS__)
|
||||
|
||||
#define assert_d64_eq(a, b, ...) assert_cmp(int64_t, a, b, ==, \
|
||||
#define assert_d64_eq(a, b, ...) assert_cmp(int64_t, a, b, ==, \
|
||||
!=, FMTd64, __VA_ARGS__)
|
||||
#define assert_d64_ne(a, b, ...) assert_cmp(int64_t, a, b, !=, \
|
||||
#define assert_d64_ne(a, b, ...) assert_cmp(int64_t, a, b, !=, \
|
||||
==, FMTd64, __VA_ARGS__)
|
||||
#define assert_d64_lt(a, b, ...) assert_cmp(int64_t, a, b, <, \
|
||||
#define assert_d64_lt(a, b, ...) assert_cmp(int64_t, a, b, <, \
|
||||
>=, FMTd64, __VA_ARGS__)
|
||||
#define assert_d64_le(a, b, ...) assert_cmp(int64_t, a, b, <=, \
|
||||
#define assert_d64_le(a, b, ...) assert_cmp(int64_t, a, b, <=, \
|
||||
>, FMTd64, __VA_ARGS__)
|
||||
#define assert_d64_ge(a, b, ...) assert_cmp(int64_t, a, b, >=, \
|
||||
#define assert_d64_ge(a, b, ...) assert_cmp(int64_t, a, b, >=, \
|
||||
<, FMTd64, __VA_ARGS__)
|
||||
#define assert_d64_gt(a, b, ...) assert_cmp(int64_t, a, b, >, \
|
||||
#define assert_d64_gt(a, b, ...) assert_cmp(int64_t, a, b, >, \
|
||||
<=, FMTd64, __VA_ARGS__)
|
||||
|
||||
#define assert_u64_eq(a, b, ...) assert_cmp(uint64_t, a, b, ==, \
|
||||
#define assert_u64_eq(a, b, ...) assert_cmp(uint64_t, a, b, ==, \
|
||||
!=, FMTu64, __VA_ARGS__)
|
||||
#define assert_u64_ne(a, b, ...) assert_cmp(uint64_t, a, b, !=, \
|
||||
#define assert_u64_ne(a, b, ...) assert_cmp(uint64_t, a, b, !=, \
|
||||
==, FMTu64, __VA_ARGS__)
|
||||
#define assert_u64_lt(a, b, ...) assert_cmp(uint64_t, a, b, <, \
|
||||
#define assert_u64_lt(a, b, ...) assert_cmp(uint64_t, a, b, <, \
|
||||
>=, FMTu64, __VA_ARGS__)
|
||||
#define assert_u64_le(a, b, ...) assert_cmp(uint64_t, a, b, <=, \
|
||||
#define assert_u64_le(a, b, ...) assert_cmp(uint64_t, a, b, <=, \
|
||||
>, FMTu64, __VA_ARGS__)
|
||||
#define assert_u64_ge(a, b, ...) assert_cmp(uint64_t, a, b, >=, \
|
||||
#define assert_u64_ge(a, b, ...) assert_cmp(uint64_t, a, b, >=, \
|
||||
<, FMTu64, __VA_ARGS__)
|
||||
#define assert_u64_gt(a, b, ...) assert_cmp(uint64_t, a, b, >, \
|
||||
#define assert_u64_gt(a, b, ...) assert_cmp(uint64_t, a, b, >, \
|
||||
<=, FMTu64, __VA_ARGS__)
|
||||
|
||||
#define assert_b_eq(a, b, ...) do { \
|
||||
#define assert_b_eq(a, b, ...) do { \
|
||||
bool a_ = (a); \
|
||||
bool b_ = (b); \
|
||||
if (!(a_ == b_)) { \
|
||||
@@ -226,7 +226,7 @@
|
||||
p_test_fail(prefix, message); \
|
||||
} \
|
||||
} while (0)
|
||||
#define assert_b_ne(a, b, ...) do { \
|
||||
#define assert_b_ne(a, b, ...) do { \
|
||||
bool a_ = (a); \
|
||||
bool b_ = (b); \
|
||||
if (!(a_ != b_)) { \
|
||||
@@ -242,10 +242,10 @@
|
||||
p_test_fail(prefix, message); \
|
||||
} \
|
||||
} while (0)
|
||||
#define assert_true(a, ...) assert_b_eq(a, true, __VA_ARGS__)
|
||||
#define assert_false(a, ...) assert_b_eq(a, false, __VA_ARGS__)
|
||||
#define assert_true(a, ...) assert_b_eq(a, true, __VA_ARGS__)
|
||||
#define assert_false(a, ...) assert_b_eq(a, false, __VA_ARGS__)
|
||||
|
||||
#define assert_str_eq(a, b, ...) do { \
|
||||
#define assert_str_eq(a, b, ...) do { \
|
||||
if (strcmp((a), (b))) { \
|
||||
char prefix[ASSERT_BUFSIZE]; \
|
||||
char message[ASSERT_BUFSIZE]; \
|
||||
@@ -258,7 +258,7 @@
|
||||
p_test_fail(prefix, message); \
|
||||
} \
|
||||
} while (0)
|
||||
#define assert_str_ne(a, b, ...) do { \
|
||||
#define assert_str_ne(a, b, ...) do { \
|
||||
if (!strcmp((a), (b))) { \
|
||||
char prefix[ASSERT_BUFSIZE]; \
|
||||
char message[ASSERT_BUFSIZE]; \
|
||||
@@ -272,7 +272,7 @@
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define assert_not_reached(...) do { \
|
||||
#define assert_not_reached(...) do { \
|
||||
char prefix[ASSERT_BUFSIZE]; \
|
||||
char message[ASSERT_BUFSIZE]; \
|
||||
malloc_snprintf(prefix, sizeof(prefix), \
|
||||
@@ -296,24 +296,24 @@ typedef enum {
|
||||
|
||||
typedef void (test_t)(void);
|
||||
|
||||
#define TEST_BEGIN(f) \
|
||||
#define TEST_BEGIN(f) \
|
||||
static void \
|
||||
f(void) { \
|
||||
p_test_init(#f);
|
||||
|
||||
#define TEST_END \
|
||||
#define TEST_END \
|
||||
goto label_test_end; \
|
||||
label_test_end: \
|
||||
p_test_fini(); \
|
||||
}
|
||||
|
||||
#define test(...) \
|
||||
#define test(...) \
|
||||
p_test(__VA_ARGS__, NULL)
|
||||
|
||||
#define test_no_malloc_init(...) \
|
||||
#define test_no_malloc_init(...) \
|
||||
p_test_no_malloc_init(__VA_ARGS__, NULL)
|
||||
|
||||
#define test_skip_if(e) do { \
|
||||
#define test_skip_if(e) do { \
|
||||
if (e) { \
|
||||
test_skip("%s:%s:%d: Test skipped: (%s)", \
|
||||
__func__, __FILE__, __LINE__, #e); \
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#define NTHREADS 10
|
||||
#define NTHREADS 10
|
||||
|
||||
static bool have_dss =
|
||||
#ifdef JEMALLOC_DSS
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#define MAXALIGN (((size_t)1) << 23)
|
||||
#define MAXALIGN (((size_t)1) << 23)
|
||||
|
||||
/*
|
||||
* On systems which can't merge extents, tests that call this function generate
|
||||
@@ -79,7 +79,7 @@ TEST_BEGIN(test_oom_errors) {
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_alignment_and_size) {
|
||||
#define NITER 4
|
||||
#define NITER 4
|
||||
size_t alignment, size, total;
|
||||
unsigned i;
|
||||
void *ps[NITER];
|
||||
|
@@ -118,7 +118,7 @@ TEST_BEGIN(test_oom) {
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_basic) {
|
||||
#define MAXSZ (((size_t)1) << 23)
|
||||
#define MAXSZ (((size_t)1) << 23)
|
||||
size_t sz;
|
||||
|
||||
for (sz = 1; sz < MAXSZ; sz = nallocx(sz, 0) + 1) {
|
||||
@@ -155,8 +155,8 @@ TEST_BEGIN(test_basic) {
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_alignment_and_size) {
|
||||
#define MAXALIGN (((size_t)1) << 23)
|
||||
#define NITER 4
|
||||
#define MAXALIGN (((size_t)1) << 23)
|
||||
#define NITER 4
|
||||
size_t nsz, rsz, sz, alignment, total;
|
||||
unsigned i;
|
||||
void *ps[NITER];
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#define MAXALIGN (((size_t)1) << 23)
|
||||
#define MAXALIGN (((size_t)1) << 23)
|
||||
|
||||
/*
|
||||
* On systems which can't merge extents, tests that call this function generate
|
||||
@@ -71,7 +71,7 @@ TEST_BEGIN(test_oom_errors) {
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_alignment_and_size) {
|
||||
#define NITER 4
|
||||
#define NITER 4
|
||||
size_t alignment, size, total;
|
||||
unsigned i;
|
||||
int err;
|
||||
|
@@ -43,11 +43,11 @@ get_large_size(size_t ind) {
|
||||
TEST_BEGIN(test_grow_and_shrink) {
|
||||
void *p, *q;
|
||||
size_t tsz;
|
||||
#define NCYCLES 3
|
||||
#define NCYCLES 3
|
||||
unsigned i, j;
|
||||
#define NSZS 1024
|
||||
#define NSZS 1024
|
||||
size_t szs[NSZS];
|
||||
#define MAXSZ ZU(12 * 1024 * 1024)
|
||||
#define MAXSZ ZU(12 * 1024 * 1024)
|
||||
|
||||
p = mallocx(1, 0);
|
||||
assert_ptr_not_null(p, "Unexpected mallocx() error");
|
||||
@@ -107,8 +107,8 @@ TEST_BEGIN(test_zero) {
|
||||
void *p, *q;
|
||||
size_t psz, qsz, i, j;
|
||||
size_t start_sizes[] = {1, 3*1024, 63*1024, 4095*1024};
|
||||
#define FILL_BYTE 0xaaU
|
||||
#define RANGE 2048
|
||||
#define FILL_BYTE 0xaaU
|
||||
#define RANGE 2048
|
||||
|
||||
for (i = 0; i < sizeof(start_sizes)/sizeof(size_t); i++) {
|
||||
size_t start_size = start_sizes[i];
|
||||
@@ -150,7 +150,7 @@ TEST_END
|
||||
TEST_BEGIN(test_align) {
|
||||
void *p, *q;
|
||||
size_t align;
|
||||
#define MAX_ALIGN (ZU(1) << 25)
|
||||
#define MAX_ALIGN (ZU(1) << 25)
|
||||
|
||||
align = ZU(1);
|
||||
p = mallocx(1, MALLOCX_ALIGN(align));
|
||||
@@ -175,8 +175,8 @@ TEST_BEGIN(test_lg_align_and_zero) {
|
||||
void *p, *q;
|
||||
unsigned lg_align;
|
||||
size_t sz;
|
||||
#define MAX_LG_ALIGN 25
|
||||
#define MAX_VALIDATE (ZU(1) << 22)
|
||||
#define MAX_LG_ALIGN 25
|
||||
#define MAX_VALIDATE (ZU(1) << 22)
|
||||
|
||||
lg_align = 0;
|
||||
p = mallocx(1, MALLOCX_LG_ALIGN(lg_align)|MALLOCX_ZERO);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#define MAXALIGN (((size_t)1) << 22)
|
||||
#define NITER 3
|
||||
#define MAXALIGN (((size_t)1) << 22)
|
||||
#define NITER 3
|
||||
|
||||
TEST_BEGIN(test_basic) {
|
||||
void *ptr = mallocx(64, 0);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#define NTHREADS 10
|
||||
#define NTHREADS 10
|
||||
|
||||
void *
|
||||
thd_start(void *arg) {
|
||||
|
@@ -320,7 +320,7 @@ test_zero(size_t szmin, size_t szmax) {
|
||||
int flags = MALLOCX_ARENA(arena_ind()) | MALLOCX_ZERO;
|
||||
size_t sz, nsz;
|
||||
void *p;
|
||||
#define FILL_BYTE 0x7aU
|
||||
#define FILL_BYTE 0x7aU
|
||||
|
||||
sz = szmax;
|
||||
p = mallocx(sz, flags);
|
||||
|
@@ -45,7 +45,7 @@
|
||||
*
|
||||
* The new BSD License is applied to this software, see LICENSE.txt
|
||||
*/
|
||||
#define SFMT_C_
|
||||
#define SFMT_C_
|
||||
#include "test/jemalloc_test.h"
|
||||
#include "test/SFMT-params.h"
|
||||
|
||||
|
@@ -1,2 +1,2 @@
|
||||
#define MATH_C_
|
||||
#define MATH_C_
|
||||
#include "test/jemalloc_test.h"
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#ifndef _CRT_SPINCOUNT
|
||||
#define _CRT_SPINCOUNT 4000
|
||||
#define _CRT_SPINCOUNT 4000
|
||||
#endif
|
||||
|
||||
bool
|
||||
|
@@ -35,10 +35,10 @@
|
||||
*/
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#define BLOCK_SIZE 10000
|
||||
#define BLOCK_SIZE64 (BLOCK_SIZE / 2)
|
||||
#define COUNT_1 1000
|
||||
#define COUNT_2 700
|
||||
#define BLOCK_SIZE 10000
|
||||
#define BLOCK_SIZE64 (BLOCK_SIZE / 2)
|
||||
#define COUNT_1 1000
|
||||
#define COUNT_2 700
|
||||
|
||||
static const uint32_t init_gen_rand_32_expected[] = {
|
||||
3440181298U, 1564997079U, 1510669302U, 2930277156U, 1452439940U,
|
||||
|
@@ -82,7 +82,7 @@ do_arena_create(extent_hooks_t *h) {
|
||||
|
||||
static void
|
||||
do_arena_reset_pre(unsigned arena_ind, void ***ptrs, unsigned *nptrs) {
|
||||
#define NLARGE 32
|
||||
#define NLARGE 32
|
||||
unsigned nsmall, nlarge, i;
|
||||
size_t sz;
|
||||
int flags;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
#define ARENA_RESET_PROF_C_
|
||||
#define ARENA_RESET_PROF_C_
|
||||
|
||||
const char *malloc_conf = "prof:true,lg_prof_sample:0";
|
||||
#include "arena_reset.c"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#define TEST_STRUCT(p, t) \
|
||||
#define TEST_STRUCT(p, t) \
|
||||
struct p##_test_s { \
|
||||
t accum0; \
|
||||
t x; \
|
||||
@@ -8,7 +8,7 @@ struct p##_test_s { \
|
||||
}; \
|
||||
typedef struct p##_test_s p##_test_t;
|
||||
|
||||
#define TEST_BODY(p, t, tc, ta, FMT) do { \
|
||||
#define TEST_BODY(p, t, tc, ta, FMT) do { \
|
||||
const p##_test_t tests[] = { \
|
||||
{(t)-1, (t)-1, (t)-2}, \
|
||||
{(t)-1, (t) 0, (t)-2}, \
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#define NBITS_TAB \
|
||||
#define NBITS_TAB \
|
||||
NB( 1) \
|
||||
NB( 2) \
|
||||
NB( 3) \
|
||||
@@ -124,7 +124,7 @@ test_bitmap_initializer_body(const bitmap_info_t *binfo, size_t nbits) {
|
||||
}
|
||||
|
||||
TEST_BEGIN(test_bitmap_initializer) {
|
||||
#define NB(nbits) { \
|
||||
#define NB(nbits) { \
|
||||
if (nbits <= BITMAP_MAXBITS) { \
|
||||
bitmap_info_t binfo = \
|
||||
BITMAP_INFO_INITIALIZER(nbits); \
|
||||
@@ -155,7 +155,7 @@ TEST_BEGIN(test_bitmap_size) {
|
||||
bitmap_info_init(&binfo, nbits);
|
||||
prev_size = test_bitmap_size_body(&binfo, nbits, prev_size);
|
||||
}
|
||||
#define NB(nbits) { \
|
||||
#define NB(nbits) { \
|
||||
bitmap_info_t binfo = BITMAP_INFO_INITIALIZER(nbits); \
|
||||
prev_size = test_bitmap_size_body(&binfo, nbits, \
|
||||
prev_size); \
|
||||
@@ -188,7 +188,7 @@ TEST_BEGIN(test_bitmap_init) {
|
||||
bitmap_info_init(&binfo, nbits);
|
||||
test_bitmap_init_body(&binfo, nbits);
|
||||
}
|
||||
#define NB(nbits) { \
|
||||
#define NB(nbits) { \
|
||||
bitmap_info_t binfo = BITMAP_INFO_INITIALIZER(nbits); \
|
||||
test_bitmap_init_body(&binfo, nbits); \
|
||||
}
|
||||
@@ -219,7 +219,7 @@ TEST_BEGIN(test_bitmap_set) {
|
||||
bitmap_info_init(&binfo, nbits);
|
||||
test_bitmap_set_body(&binfo, nbits);
|
||||
}
|
||||
#define NB(nbits) { \
|
||||
#define NB(nbits) { \
|
||||
bitmap_info_t binfo = BITMAP_INFO_INITIALIZER(nbits); \
|
||||
test_bitmap_set_body(&binfo, nbits); \
|
||||
}
|
||||
@@ -257,7 +257,7 @@ TEST_BEGIN(test_bitmap_unset) {
|
||||
bitmap_info_init(&binfo, nbits);
|
||||
test_bitmap_unset_body(&binfo, nbits);
|
||||
}
|
||||
#define NB(nbits) { \
|
||||
#define NB(nbits) { \
|
||||
bitmap_info_t binfo = BITMAP_INFO_INITIALIZER(nbits); \
|
||||
test_bitmap_unset_body(&binfo, nbits); \
|
||||
}
|
||||
@@ -318,7 +318,7 @@ TEST_BEGIN(test_bitmap_sfu) {
|
||||
bitmap_info_init(&binfo, nbits);
|
||||
test_bitmap_sfu_body(&binfo, nbits);
|
||||
}
|
||||
#define NB(nbits) { \
|
||||
#define NB(nbits) { \
|
||||
bitmap_info_t binfo = BITMAP_INFO_INITIALIZER(nbits); \
|
||||
test_bitmap_sfu_body(&binfo, nbits); \
|
||||
}
|
||||
|
@@ -104,7 +104,7 @@ TEST_BEGIN(test_count_insert_search_remove) {
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_insert_iter_remove) {
|
||||
#define NITEMS ZU(1000)
|
||||
#define NITEMS ZU(1000)
|
||||
tsd_t *tsd;
|
||||
ckh_t ckh;
|
||||
void **p[NITEMS];
|
||||
|
@@ -196,7 +196,7 @@ TEST_BEGIN(test_decay_ticks) {
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_decay_ticker) {
|
||||
#define NPS 1024
|
||||
#define NPS 1024
|
||||
int flags = (MALLOCX_ARENA(0) | MALLOCX_TCACHE_NONE);
|
||||
void *ps[NPS];
|
||||
uint64_t epoch;
|
||||
@@ -289,7 +289,7 @@ TEST_BEGIN(test_decay_ticker) {
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_decay_nonmonotonic) {
|
||||
#define NPS (SMOOTHSTEP_NSTEPS + 1)
|
||||
#define NPS (SMOOTHSTEP_NSTEPS + 1)
|
||||
int flags = (MALLOCX_ARENA(0) | MALLOCX_TCACHE_NONE);
|
||||
void *ps[NPS];
|
||||
uint64_t epoch;
|
||||
|
@@ -99,7 +99,7 @@ TEST_BEGIN(test_large_extent_size) {
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_monotonic) {
|
||||
#define SZ_MAX ZU(4 * 1024 * 1024)
|
||||
#define SZ_MAX ZU(4 * 1024 * 1024)
|
||||
unsigned i;
|
||||
size_t floor_prev, ceil_prev;
|
||||
|
||||
|
@@ -55,7 +55,7 @@ hash_variant_string(hash_variant_t variant) {
|
||||
}
|
||||
}
|
||||
|
||||
#define KEY_SIZE 256
|
||||
#define KEY_SIZE 256
|
||||
static void
|
||||
hash_variant_verify_key(hash_variant_t variant, uint8_t *key) {
|
||||
const int hashbytes = hash_variant_bits(variant) / 8;
|
||||
@@ -137,7 +137,7 @@ hash_variant_verify_key(hash_variant_t variant, uint8_t *key) {
|
||||
|
||||
static void
|
||||
hash_variant_verify(hash_variant_t variant) {
|
||||
#define MAX_ALIGN 16
|
||||
#define MAX_ALIGN 16
|
||||
uint8_t key[KEY_SIZE + (MAX_ALIGN - 1)];
|
||||
unsigned i;
|
||||
|
||||
|
@@ -1,3 +1,3 @@
|
||||
#define JEMALLOC_TEST_JUNK_OPT "junk:alloc"
|
||||
#define JEMALLOC_TEST_JUNK_OPT "junk:alloc"
|
||||
#include "junk.c"
|
||||
#undef JEMALLOC_TEST_JUNK_OPT
|
||||
|
@@ -1,3 +1,3 @@
|
||||
#define JEMALLOC_TEST_JUNK_OPT "junk:free"
|
||||
#define JEMALLOC_TEST_JUNK_OPT "junk:free"
|
||||
#include "junk.c"
|
||||
#undef JEMALLOC_TEST_JUNK_OPT
|
||||
|
@@ -115,7 +115,7 @@ TEST_BEGIN(test_mallctlnametomib_short_mib) {
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_mallctl_config) {
|
||||
#define TEST_MALLCTL_CONFIG(config, t) do { \
|
||||
#define TEST_MALLCTL_CONFIG(config, t) do { \
|
||||
t oldval; \
|
||||
size_t sz = sizeof(oldval); \
|
||||
assert_d_eq(mallctl("config."#config, (void *)&oldval, &sz, \
|
||||
@@ -146,7 +146,7 @@ TEST_END
|
||||
TEST_BEGIN(test_mallctl_opt) {
|
||||
bool config_always = true;
|
||||
|
||||
#define TEST_MALLCTL_OPT(t, opt, config) do { \
|
||||
#define TEST_MALLCTL_OPT(t, opt, config) do { \
|
||||
t oldval; \
|
||||
size_t sz = sizeof(oldval); \
|
||||
int expected = config_##config ? 0 : ENOENT; \
|
||||
@@ -232,7 +232,7 @@ TEST_BEGIN(test_tcache_none) {
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_tcache) {
|
||||
#define NTCACHES 10
|
||||
#define NTCACHES 10
|
||||
unsigned tis[NTCACHES];
|
||||
void *ps[NTCACHES];
|
||||
void *qs[NTCACHES];
|
||||
@@ -534,7 +534,7 @@ TEST_BEGIN(test_arenas_decay_time) {
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_arenas_constants) {
|
||||
#define TEST_ARENAS_CONSTANT(t, name, expected) do { \
|
||||
#define TEST_ARENAS_CONSTANT(t, name, expected) do { \
|
||||
t name; \
|
||||
size_t sz = sizeof(t); \
|
||||
assert_d_eq(mallctl("arenas."#name, (void *)&name, &sz, NULL, \
|
||||
@@ -552,7 +552,7 @@ TEST_BEGIN(test_arenas_constants) {
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_arenas_bin_constants) {
|
||||
#define TEST_ARENAS_BIN_CONSTANT(t, name, expected) do { \
|
||||
#define TEST_ARENAS_BIN_CONSTANT(t, name, expected) do { \
|
||||
t name; \
|
||||
size_t sz = sizeof(t); \
|
||||
assert_d_eq(mallctl("arenas.bin.0."#name, (void *)&name, &sz, \
|
||||
@@ -570,7 +570,7 @@ TEST_BEGIN(test_arenas_bin_constants) {
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_arenas_lextent_constants) {
|
||||
#define TEST_ARENAS_LEXTENT_CONSTANT(t, name, expected) do { \
|
||||
#define TEST_ARENAS_LEXTENT_CONSTANT(t, name, expected) do { \
|
||||
t name; \
|
||||
size_t sz = sizeof(t); \
|
||||
assert_d_eq(mallctl("arenas.lextent.0."#name, (void *)&name, \
|
||||
@@ -602,7 +602,7 @@ TEST_BEGIN(test_arenas_create) {
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_stats_arenas) {
|
||||
#define TEST_STATS_ARENAS(t, name) do { \
|
||||
#define TEST_STATS_ARENAS(t, name) do { \
|
||||
t name; \
|
||||
size_t sz = sizeof(t); \
|
||||
assert_d_eq(mallctl("stats.arenas.0."#name, (void *)&name, &sz, \
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#define MAX_REL_ERR 1.0e-9
|
||||
#define MAX_ABS_ERR 1.0e-9
|
||||
#define MAX_REL_ERR 1.0e-9
|
||||
#define MAX_ABS_ERR 1.0e-9
|
||||
|
||||
#include <float.h>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef INFINITY
|
||||
#define INFINITY (DBL_MAX + DBL_MAX)
|
||||
#define INFINITY (DBL_MAX + DBL_MAX)
|
||||
#endif
|
||||
|
||||
static bool
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#define NSENDERS 3
|
||||
#define NMSGS 100000
|
||||
#define NSENDERS 3
|
||||
#define NMSGS 100000
|
||||
|
||||
typedef struct mq_msg_s mq_msg_t;
|
||||
struct mq_msg_s {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#define NTHREADS 2
|
||||
#define NINCRS 2000000
|
||||
#define NTHREADS 2
|
||||
#define NINCRS 2000000
|
||||
|
||||
TEST_BEGIN(test_mtx_basic) {
|
||||
mtx_t mtx;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#define BILLION UINT64_C(1000000000)
|
||||
#define BILLION UINT64_C(1000000000)
|
||||
|
||||
TEST_BEGIN(test_nstime_init) {
|
||||
nstime_t nst;
|
||||
|
@@ -7,9 +7,9 @@ const char *malloc_conf = "decay_time:-1";
|
||||
* Size class that is a divisor of the page size, ideally 4+ regions per run.
|
||||
*/
|
||||
#if LG_PAGE <= 14
|
||||
#define SZ (ZU(1) << (LG_PAGE - 2))
|
||||
#define SZ (ZU(1) << (LG_PAGE - 2))
|
||||
#else
|
||||
#define SZ 4096
|
||||
#define SZ 4096
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -17,7 +17,7 @@ const char *malloc_conf = "decay_time:-1";
|
||||
* if mmap()ed memory grows downward, downward growth of mmap()ed memory is
|
||||
* tested.
|
||||
*/
|
||||
#define NSLABS 8
|
||||
#define NSLABS 8
|
||||
|
||||
static unsigned
|
||||
binind_compute(void) {
|
||||
|
@@ -3,7 +3,7 @@
|
||||
typedef struct node_s node_t;
|
||||
|
||||
struct node_s {
|
||||
#define NODE_MAGIC 0x9823af7e
|
||||
#define NODE_MAGIC 0x9823af7e
|
||||
uint32_t magic;
|
||||
phn(node_t) link;
|
||||
uint64_t key;
|
||||
@@ -160,9 +160,9 @@ node_remove_first(heap_t *heap) {
|
||||
}
|
||||
|
||||
TEST_BEGIN(test_ph_random) {
|
||||
#define NNODES 25
|
||||
#define NBAGS 250
|
||||
#define SEED 42
|
||||
#define NNODES 25
|
||||
#define NBAGS 250
|
||||
#define SEED 42
|
||||
sfmt_t *sfmt;
|
||||
uint64_t bag[NNODES];
|
||||
heap_t heap;
|
||||
|
@@ -137,9 +137,9 @@ TEST_END
|
||||
static void
|
||||
test_prng_range_u32(bool atomic) {
|
||||
uint32_t range;
|
||||
#define MAX_RANGE 10000000
|
||||
#define RANGE_STEP 97
|
||||
#define NREPS 10
|
||||
#define MAX_RANGE 10000000
|
||||
#define RANGE_STEP 97
|
||||
#define NREPS 10
|
||||
|
||||
for (range = 2; range < MAX_RANGE; range += RANGE_STEP) {
|
||||
uint32_t s;
|
||||
@@ -157,9 +157,9 @@ test_prng_range_u32(bool atomic) {
|
||||
static void
|
||||
test_prng_range_u64(void) {
|
||||
uint64_t range;
|
||||
#define MAX_RANGE 10000000
|
||||
#define RANGE_STEP 97
|
||||
#define NREPS 10
|
||||
#define MAX_RANGE 10000000
|
||||
#define RANGE_STEP 97
|
||||
#define NREPS 10
|
||||
|
||||
for (range = 2; range < MAX_RANGE; range += RANGE_STEP) {
|
||||
uint64_t s;
|
||||
@@ -177,9 +177,9 @@ test_prng_range_u64(void) {
|
||||
static void
|
||||
test_prng_range_zu(bool atomic) {
|
||||
size_t range;
|
||||
#define MAX_RANGE 10000000
|
||||
#define RANGE_STEP 97
|
||||
#define NREPS 10
|
||||
#define MAX_RANGE 10000000
|
||||
#define RANGE_STEP 97
|
||||
#define NREPS 10
|
||||
|
||||
for (range = 2; range < MAX_RANGE; range += RANGE_STEP) {
|
||||
size_t s;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#define NTHREADS 4
|
||||
#define NALLOCS_PER_THREAD 50
|
||||
#define DUMP_INTERVAL 1
|
||||
#define BT_COUNT_CHECK_INTERVAL 5
|
||||
#define NTHREADS 4
|
||||
#define NALLOCS_PER_THREAD 50
|
||||
#define DUMP_INTERVAL 1
|
||||
#define BT_COUNT_CHECK_INTERVAL 5
|
||||
|
||||
#ifdef JEMALLOC_PROF
|
||||
const char *malloc_conf =
|
||||
|
@@ -37,7 +37,7 @@ mallctl_prof_active_get_impl(bool prof_active_old_expected, const char *func,
|
||||
int line) {
|
||||
mallctl_bool_get("prof.active", prof_active_old_expected, func, line);
|
||||
}
|
||||
#define mallctl_prof_active_get(a) \
|
||||
#define mallctl_prof_active_get(a) \
|
||||
mallctl_prof_active_get_impl(a, __func__, __LINE__)
|
||||
|
||||
static void
|
||||
@@ -46,7 +46,7 @@ mallctl_prof_active_set_impl(bool prof_active_old_expected,
|
||||
mallctl_bool_set("prof.active", prof_active_old_expected,
|
||||
prof_active_new, func, line);
|
||||
}
|
||||
#define mallctl_prof_active_set(a, b) \
|
||||
#define mallctl_prof_active_set(a, b) \
|
||||
mallctl_prof_active_set_impl(a, b, __func__, __LINE__)
|
||||
|
||||
static void
|
||||
@@ -55,7 +55,7 @@ mallctl_thread_prof_active_get_impl(bool thread_prof_active_old_expected,
|
||||
mallctl_bool_get("thread.prof.active", thread_prof_active_old_expected,
|
||||
func, line);
|
||||
}
|
||||
#define mallctl_thread_prof_active_get(a) \
|
||||
#define mallctl_thread_prof_active_get(a) \
|
||||
mallctl_thread_prof_active_get_impl(a, __func__, __LINE__)
|
||||
|
||||
static void
|
||||
@@ -64,7 +64,7 @@ mallctl_thread_prof_active_set_impl(bool thread_prof_active_old_expected,
|
||||
mallctl_bool_set("thread.prof.active", thread_prof_active_old_expected,
|
||||
thread_prof_active_new, func, line);
|
||||
}
|
||||
#define mallctl_thread_prof_active_set(a, b) \
|
||||
#define mallctl_thread_prof_active_set(a, b) \
|
||||
mallctl_thread_prof_active_set_impl(a, b, __func__, __LINE__)
|
||||
|
||||
static void
|
||||
@@ -80,7 +80,7 @@ prof_sampling_probe_impl(bool expect_sample, const char *func, int line) {
|
||||
"%s():%d: Unexpected backtrace count", func, line);
|
||||
dallocx(p, 0);
|
||||
}
|
||||
#define prof_sampling_probe(a) \
|
||||
#define prof_sampling_probe(a) \
|
||||
prof_sampling_probe_impl(a, __func__, __LINE__)
|
||||
|
||||
TEST_BEGIN(test_prof_active) {
|
||||
|
@@ -135,11 +135,11 @@ TEST_BEGIN(test_prof_reset_cleanup) {
|
||||
}
|
||||
TEST_END
|
||||
|
||||
#define NTHREADS 4
|
||||
#define NALLOCS_PER_THREAD (1U << 13)
|
||||
#define OBJ_RING_BUF_COUNT 1531
|
||||
#define RESET_INTERVAL (1U << 10)
|
||||
#define DUMP_INTERVAL 3677
|
||||
#define NTHREADS 4
|
||||
#define NALLOCS_PER_THREAD (1U << 13)
|
||||
#define OBJ_RING_BUF_COUNT 1531
|
||||
#define RESET_INTERVAL (1U << 10)
|
||||
#define DUMP_INTERVAL 3677
|
||||
static void *
|
||||
thd_start(void *varg) {
|
||||
unsigned thd_ind = *(unsigned *)varg;
|
||||
@@ -228,7 +228,7 @@ TEST_END
|
||||
#undef DUMP_INTERVAL
|
||||
|
||||
/* Test sampling at the same allocation site across resets. */
|
||||
#define NITER 10
|
||||
#define NITER 10
|
||||
TEST_BEGIN(test_xallocx) {
|
||||
size_t lg_prof_sample_orig;
|
||||
unsigned i;
|
||||
|
@@ -18,7 +18,7 @@ mallctl_thread_name_get_impl(const char *thread_name_expected, const char *func,
|
||||
assert_str_eq(thread_name_old, thread_name_expected,
|
||||
"%s():%d: Unexpected thread.prof.name value", func, line);
|
||||
}
|
||||
#define mallctl_thread_name_get(a) \
|
||||
#define mallctl_thread_name_get(a) \
|
||||
mallctl_thread_name_get_impl(a, __func__, __LINE__)
|
||||
|
||||
static void
|
||||
@@ -30,7 +30,7 @@ mallctl_thread_name_set_impl(const char *thread_name, const char *func,
|
||||
func, line);
|
||||
mallctl_thread_name_get_impl(thread_name, func, line);
|
||||
}
|
||||
#define mallctl_thread_name_set(a) \
|
||||
#define mallctl_thread_name_set(a) \
|
||||
mallctl_thread_name_set_impl(a, __func__, __LINE__)
|
||||
|
||||
TEST_BEGIN(test_prof_thread_name_validation) {
|
||||
@@ -72,8 +72,8 @@ TEST_BEGIN(test_prof_thread_name_validation) {
|
||||
}
|
||||
TEST_END
|
||||
|
||||
#define NTHREADS 4
|
||||
#define NRESET 25
|
||||
#define NTHREADS 4
|
||||
#define NRESET 25
|
||||
static void *
|
||||
thd_start(void *varg) {
|
||||
unsigned thd_ind = *(unsigned *)varg;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
/* Number of ring entries, in [2..26]. */
|
||||
#define NENTRIES 9
|
||||
#define NENTRIES 9
|
||||
|
||||
typedef struct list_s list_t;
|
||||
typedef ql_head(list_t) list_head_t;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
/* Number of ring entries, in [2..26]. */
|
||||
#define NENTRIES 9
|
||||
#define NENTRIES 9
|
||||
/* Split index, in [1..NENTRIES). */
|
||||
#define SPLIT_INDEX 5
|
||||
#define SPLIT_INDEX 5
|
||||
|
||||
typedef struct ring_s ring_t;
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#define rbtn_black_height(a_type, a_field, a_rbt, r_height) do { \
|
||||
#define rbtn_black_height(a_type, a_field, a_rbt, r_height) do { \
|
||||
a_type *rbp_bh_t; \
|
||||
for (rbp_bh_t = (a_rbt)->rbt_root, (r_height) = 0; rbp_bh_t != \
|
||||
NULL; rbp_bh_t = rbtn_left_get(a_type, a_field, \
|
||||
@@ -14,7 +14,7 @@
|
||||
typedef struct node_s node_t;
|
||||
|
||||
struct node_s {
|
||||
#define NODE_MAGIC 0x9823af7e
|
||||
#define NODE_MAGIC 0x9823af7e
|
||||
uint32_t magic;
|
||||
rb_node(node_t) link;
|
||||
uint64_t key;
|
||||
@@ -223,9 +223,9 @@ destroy_cb(node_t *node, void *data) {
|
||||
}
|
||||
|
||||
TEST_BEGIN(test_rb_random) {
|
||||
#define NNODES 25
|
||||
#define NBAGS 250
|
||||
#define SEED 42
|
||||
#define NNODES 25
|
||||
#define NBAGS 250
|
||||
#define SEED 42
|
||||
sfmt_t *sfmt;
|
||||
uint64_t bag[NNODES];
|
||||
tree_t tree;
|
||||
|
@@ -51,10 +51,10 @@ TEST_BEGIN(test_rtree_read_empty) {
|
||||
}
|
||||
TEST_END
|
||||
|
||||
#define NTHREADS 8
|
||||
#define MAX_NBITS 18
|
||||
#define NITERS 1000
|
||||
#define SEED 42
|
||||
#define NTHREADS 8
|
||||
#define MAX_NBITS 18
|
||||
#define NITERS 1000
|
||||
#define SEED 42
|
||||
|
||||
typedef struct {
|
||||
unsigned nbits;
|
||||
@@ -218,8 +218,8 @@ TEST_BEGIN(test_rtree_random) {
|
||||
unsigned i;
|
||||
sfmt_t *sfmt;
|
||||
tsdn_t *tsdn;
|
||||
#define NSET 16
|
||||
#define SEED 42
|
||||
#define NSET 16
|
||||
#define SEED 42
|
||||
|
||||
sfmt = init_gen_rand(SEED);
|
||||
tsdn = tsdn_fetch();
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
static const uint64_t smoothstep_tab[] = {
|
||||
#define STEP(step, h, x, y) \
|
||||
#define STEP(step, h, x, y) \
|
||||
h,
|
||||
SMOOTHSTEP
|
||||
#undef STEP
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
TEST_BEGIN(test_ticker_tick) {
|
||||
#define NREPS 2
|
||||
#define NTICKS 3
|
||||
#define NREPS 2
|
||||
#define NTICKS 3
|
||||
ticker_t ticker;
|
||||
int32_t i, j;
|
||||
|
||||
@@ -26,7 +26,7 @@ TEST_BEGIN(test_ticker_tick) {
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_ticker_ticks) {
|
||||
#define NTICKS 3
|
||||
#define NTICKS 3
|
||||
ticker_t ticker;
|
||||
|
||||
ticker_init(&ticker, NTICKS);
|
||||
@@ -44,7 +44,7 @@ TEST_BEGIN(test_ticker_ticks) {
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_ticker_copy) {
|
||||
#define NTICKS 3
|
||||
#define NTICKS 3
|
||||
ticker_t ta, tb;
|
||||
|
||||
ticker_init(&ta, NTICKS);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#define THREAD_DATA 0x72b65c10
|
||||
#define THREAD_DATA 0x72b65c10
|
||||
|
||||
typedef unsigned int data_t;
|
||||
|
||||
@@ -47,7 +47,7 @@ data_cleanup(void *arg) {
|
||||
}
|
||||
|
||||
malloc_tsd_externs(data_, data_t)
|
||||
#define DATA_INIT 0x12345678
|
||||
#define DATA_INIT 0x12345678
|
||||
malloc_tsd_data(, data_, data_t, DATA_INIT)
|
||||
malloc_tsd_funcs(, data_, data_t, DATA_INIT, data_cleanup)
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "test/jemalloc_test.h"
|
||||
|
||||
#define TEST_POW2_CEIL(t, suf, pri) do { \
|
||||
#define TEST_POW2_CEIL(t, suf, pri) do { \
|
||||
unsigned i, pow2; \
|
||||
t x; \
|
||||
\
|
||||
@@ -65,9 +65,9 @@ TEST_BEGIN(test_malloc_strtoumax) {
|
||||
const char *expected_errno_name;
|
||||
uintmax_t expected_x;
|
||||
};
|
||||
#define ERR(e) e, #e
|
||||
#define KUMAX(x) ((uintmax_t)x##ULL)
|
||||
#define KSMAX(x) ((uintmax_t)(intmax_t)x##LL)
|
||||
#define ERR(e) e, #e
|
||||
#define KUMAX(x) ((uintmax_t)x##ULL)
|
||||
#define KSMAX(x) ((uintmax_t)(intmax_t)x##LL)
|
||||
struct test_s tests[] = {
|
||||
{"0", "0", -1, ERR(EINVAL), UINTMAX_MAX},
|
||||
{"0", "0", 1, ERR(EINVAL), UINTMAX_MAX},
|
||||
@@ -151,11 +151,11 @@ TEST_BEGIN(test_malloc_strtoumax) {
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_malloc_snprintf_truncated) {
|
||||
#define BUFLEN 15
|
||||
#define BUFLEN 15
|
||||
char buf[BUFLEN];
|
||||
size_t result;
|
||||
size_t len;
|
||||
#define TEST(expected_str_untruncated, ...) do { \
|
||||
#define TEST(expected_str_untruncated, ...) do { \
|
||||
result = malloc_snprintf(buf, len, __VA_ARGS__); \
|
||||
assert_d_eq(strncmp(buf, expected_str_untruncated, len-1), 0, \
|
||||
"Unexpected string inequality (\"%s\" vs \"%s\")", \
|
||||
@@ -183,10 +183,10 @@ TEST_BEGIN(test_malloc_snprintf_truncated) {
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_malloc_snprintf) {
|
||||
#define BUFLEN 128
|
||||
#define BUFLEN 128
|
||||
char buf[BUFLEN];
|
||||
size_t result;
|
||||
#define TEST(expected_str, ...) do { \
|
||||
#define TEST(expected_str, ...) do { \
|
||||
result = malloc_snprintf(buf, sizeof(buf), __VA_ARGS__); \
|
||||
assert_str_eq(buf, expected_str, "Unexpected output"); \
|
||||
assert_zu_eq(result, strlen(expected_str), "Unexpected result");\
|
||||
|
@@ -9,7 +9,7 @@ static void
|
||||
test_zero(size_t sz_min, size_t sz_max) {
|
||||
uint8_t *s;
|
||||
size_t sz_prev, sz, i;
|
||||
#define MAGIC ((uint8_t)0x61)
|
||||
#define MAGIC ((uint8_t)0x61)
|
||||
|
||||
sz_prev = 0;
|
||||
s = (uint8_t *)mallocx(sz_min, 0);
|
||||
|
Reference in New Issue
Block a user