summaryrefslogtreecommitdiffstats
path: root/test/unit
Commit message (Collapse)AuthorAgeFilesLines
* Adapt hash tests to big-endian systems.Jason Evans2014-03-301-0/+6
| | | | | | | | | The hash code, which has MurmurHash3 at its core, generates different output depending on system endianness, so adapt the expected output on big-endian systems. MurmurHash3 code also makes the assumption that unaligned access is okay (not true on all systems), but jemalloc only hashes data structures that have sufficient alignment to dodge this limitation.
* Fix message formatting errors uncovered by p_test_fail() refactoring.Jason Evans2014-03-305-11/+12
|
* Fix p_test_fail()'s va_list abuse.Jason Evans2014-03-301-1/+1
| | | | | | | | | p_test_fail() was passing a va_list to two separate functions with the expectation that no reset would occur. Refactor p_test_fail()'s callers to instead format two strings and pass them to p_test_fail(). Add a missing parameter to an assert_u64_eq() call, which the compiler warned about after the assertion macro refactoring.
* Restore tail call optimization subversion.Jason Evans2014-02-261-7/+13
| | | | | | Restore the essence of 898960247a8b2e6534738b7a3a244855f379faf9, which sabotages tail call optimization. This is necessary even when the mutually recursive functions are in separate compilation units.
* Fix junk filling for mremap(2)-based huge reallocation.Jason Evans2014-02-251-3/+6
| | | | | | | If mremap(2) is used for huge reallocation, physical pages are mapped to new virtual addresses rather than data being copied to new pages. This bypasses the normal junk filling that would happen during allocation, so add junk filling that is specific to this case.
* Break prof_accum into multiple compilation units.Jason Evans2014-02-254-37/+36
| | | | | | Break prof_accum into multiple compilation units, in order to thwart compiler optimizations such as inlining and tail call optimization that would alter backtraces.
* Prevent inlining of backtraced test functions.Jason Evans2014-01-291-2/+2
| | | | | Inlining of alloc_0() and alloc_1() would prevent generation of unique backtraces, upon which the test code relies.
* Fix mallctl argument size mismatches (size_t vs. uint64_t).Jason Evans2014-01-291-8/+15
| | | | Reported by İsmail Dönmez.
* Test and fix malloc_printf("%%").Jason Evans2014-01-221-0/+2
|
* Subvert tail call optimization in backtrace test.Jason Evans2014-01-211-11/+17
| | | | | | | Re-structure alloc_[01](), which are mutually tail-recursive functions, to do (unnecessary) work post-recursion so that the compiler cannot perform tail call optimization, thus preserving intentionally unique call paths in captured backtraces.
* Fix unused variable warnings.Jason Evans2014-01-211-3/+1
|
* Avoid lazy-lock in a tcache-dependent test.Jason Evans2014-01-211-14/+34
|
* Add heap profiling tests.Jason Evans2014-01-173-0/+223
| | | | | | Fix a regression in prof_dump_ctx() due to an uninitized variable. This was caused by revision 4f37ef693e3d5903ce07dc0b61c0da320b35e3d9, so no releases are affected.
* Fix warnings and a test failure exposed on CentOS 6.3.Jason Evans2014-01-152-4/+5
|
* Add junk/zero filling unit tests, and fix discovered bugs.Jason Evans2014-01-083-3/+300
| | | | | | Fix growing large reallocation to junk fill new space. Fix huge deallocation to junk fill when munmap is disabled.
* Add util unit tests, and fix discovered bugs.Jason Evans2014-01-071-0/+294
| | | | | | | | | | | | | Add unit tests for pow2_ceil(), malloc_strtoumax(), and malloc_snprintf(). Fix numerous bugs in malloc_strotumax() error handling/reporting. These bugs could have caused application-visible issues for some seldom used (0X... and 0... prefixes) or malformed MALLOC_CONF or mallctl() argument strings, but otherwise they had no impact. Fix numerous bugs in malloc_snprintf(). These bugs were not exercised by existing malloc_*printf() calls, so they had no impact.
* Convert assert() in test code to assert_*().Jason Evans2014-01-041-4/+12
|
* Add unit tests for qr, ql, and rb.Jason Evans2014-01-043-0/+784
|
* Convert rtree from (void *) to (uint8_t) storage.Jason Evans2014-01-031-18/+16
| | | | | | | | | | | | | Reduce rtree memory usage by storing booleans (1 byte each) rather than pointers. The rtree code is only used to record whether jemalloc manages a chunk of memory, so there's no need to store pointers in the rtree. Increase rtree node size to 64 KiB in order to reduce tree depth from 13 to 3 on 64-bit systems. The conversion to more compact leaf nodes was enough by itself to make the rtree depth 1 on 32-bit systems; due to the fact that root nodes are smaller than the specified node size if possible, the node size change has no impact on 32-bit systems (assuming default chunk size).
* Add rtree unit tests.Jason Evans2014-01-031-0/+119
|
* Clean up code formatting.Jason Evans2014-01-021-4/+2
|
* Add stats unit tests.Jason Evans2013-12-201-0/+350
|
* Add mallctl*() unit tests.Jason Evans2013-12-201-0/+415
|
* Add quarantine unit tests.Jason Evans2013-12-171-0/+108
| | | | | | | | | Verify that freed regions are quarantined, and that redzone corruption is detected. Introduce a testing idiom for intercepting/replacing internal functions. In this case the replaced function is ordinarily a static function, but the idiom should work similarly for library-private functions.
* Fix a typo in a string constant.Jason Evans2013-12-171-1/+1
|
* Add hash (MurmurHash3) tests.Jason Evans2013-12-171-0/+167
| | | | Add hash tests that are based on SMHasher's VerificationTest() function.
* Add ckh unit tests.Jason Evans2013-12-171-0/+206
|
* Fix name mangling issues.Jason Evans2013-12-131-2/+2
| | | | | | | | | Move je_* definitions from jemalloc_macros.h.in to jemalloc_defs.h.in, because only the latter is an autoconf header (#undef substitution occurs). Fix unit tests to use automatic mangling, so that e.g. mallocx is macro-substituted to becom jet_mallocx.
* Implement the *allocx() API.Jason Evans2013-12-131-4/+3
| | | | | | | | | | | | | | | | | | | | | | | Implement the *allocx() API, which is a successor to the *allocm() API. The *allocx() functions are slightly simpler to use because they have fewer parameters, they directly return the results of primary interest, and mallocx()/rallocx() avoid the strict aliasing pitfall that allocm()/rallocx() share with posix_memalign(). The following code violates strict aliasing rules: foo_t *foo; allocm((void **)&foo, NULL, 42, 0); whereas the following is safe: foo_t *foo; void *p; allocm(&p, NULL, 42, 0); foo = (foo_t *)p; mallocx() does not have this problem: foo_t *foo = (foo_t *)mallocx(42, 0);
* Fix a strict aliasing violation.Jason Evans2013-12-121-2/+4
|
* Add mq (message queue) to test infrastructure.Jason Evans2013-12-123-7/+158
| | | | | | | | | Add mtx (mutex) to test infrastructure, in order to avoid bootstrapping complications that would result from directly using malloc_mutex. Rename test infrastructure's thread abstraction from je_thread to thd. Fix some header ordering issues.
* Clean up SFMT test.Jason Evans2013-12-101-43/+40
| | | | | | | | Refactor array declarations to remove some dubious casts. Reduce array size to what is actually used. Extract magic numbers into cpp macro definitions.
* Add probabability distribution utility code.Jason Evans2013-12-101-0/+388
| | | | | | | | | | | | | | | Add probabability distribution utility code that enables generation of random deviates drawn from normal, Chi-square, and Gamma distributions. Fix format strings in several of the assert_* macros (remove a %s). Clean up header issues; it's critical that system headers are not included after internal definitions potentially do things like: #define inline Fix the build system to incorporate header dependencies for the test library C files.
* Integrate SFMT 1.3.3 into test infrastructure.Jason Evans2013-12-091-0/+1608
| | | | | | | | | | | | Integrate the SIMD-oriented Fast Mersenne Twister (SFMT) 1.3.3 into the test infrastructure. The sfmt_t state encapsulation modification comes from Crux (http://www.canonware.com/Crux/) and enables multiple concurrent PRNGs. test/unit/SFMT.c is an adaptation of SFMT's test.c that performs all the same validation, both for 32- and 64-bit generation.
* Normalize #define whitespace.Jason Evans2013-12-091-2/+2
| | | | Consistently use a tab rather than a space following #define.
* Refactor tests.Jason Evans2013-12-094-60/+80
| | | | | | | Refactor tests to use explicit testing assertions, rather than diff'ing test output. This makes the test code a bit shorter, more explicitly encodes testing intent, and makes test failure diagnosis more straightforward.
* Add tsd test.Jason Evans2013-12-052-0/+63
| | | | Submitted by Mike Hommey.
* Refactor to support more varied testing.Jason Evans2013-12-042-0/+153
Refactor the test harness to support three types of tests: - unit: White box unit tests. These tests have full access to all internal jemalloc library symbols. Though in actuality all symbols are prefixed by jet_, macro-based name mangling abstracts this away from test code. - integration: Black box integration tests. These tests link with the installable shared jemalloc library, and with the exception of some utility code and configure-generated macro definitions, they have no access to jemalloc internals. - stress: Black box stress tests. These tests link with the installable shared jemalloc library, as well as with an internal allocator with symbols prefixed by jet_ (same as for unit tests) that can be used to allocate data structures that are internal to the test code. Move existing tests into test/{unit,integration}/ as appropriate. Split out internal parts of jemalloc_defs.h.in and put them in jemalloc_internal_defs.h.in. This reduces internals exposure to applications that #include <jemalloc/jemalloc.h>. Refactor jemalloc.h header generation so that a single header file results, and the prototypes can be used to generate jet_ prototypes for tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in, jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and use a shell script to generate a unified jemalloc.h at configure time. Change the default private namespace prefix from "" to "je_". Add missing private namespace mangling. Remove hard-coded private_namespace.h. Instead generate it and private_unnamespace.h from private_symbols.txt. Use similar logic for public symbols, which aids in name mangling for jet_ symbols. Add test_warn() and test_fail(). Replace existing exit(1) calls with test_fail() calls.