summaryrefslogtreecommitdiffstats
path: root/test/include
Commit message (Collapse)AuthorAgeFilesLines
* Add more tests for extent hooks failure paths.Qi Wang2017-11-291-0/+2
|
* Add extent_destroy_t and use it during arena destruction.Jason Evans2017-04-291-0/+24
| | | | | | | | | | Add the extent_destroy_t extent destruction hook to extent_hooks_t, and use it during arena destruction. This hook explicitly communicates to the callee that the extent must be destroyed or tracked for later reuse, lest it be permanently leaked. Prior to this change, retained extents could unintentionally be leaked if extent retention was enabled. This resolves #560.
* Get rid of most of the various inline macros.David Goldblatt2017-04-244-52/+27
|
* Header refactoring: unify nstime.h and move it out of the catch-allDavid Goldblatt2017-04-191-3/+1
|
* Header refactoring: Split up jemalloc_internal.hDavid Goldblatt2017-04-111-3/+4
| | | | | | | | | | | | | | This is a biggy. jemalloc_internal.h has been doing multiple jobs for a while now: - The source of system-wide definitions. - The catch-all include file. - The module header file for jemalloc.c This commit splits up this functionality. The system-wide definitions responsibility has moved to jemalloc_preamble.h. The catch-all include file is now jemalloc_internal_includes.h. The module headers for jemalloc.c are now in jemalloc_internal_[externs|inlines|types].h, just as they are for the other modules.
* Add hooking functionalityDavid Goldblatt2017-04-072-0/+8
| | | | | This allows us to hook chosen functions and do interesting things there (in particular: reentrancy checking).
* Disentangle assert and utilDavid Goldblatt2017-03-061-3/+6
| | | | | | | | | This is the first header refactoring diff, #533. It splits the assert and util components into separate, hermetic, header files. In the process, it splits out two of the large sub-components of util (the stdio.h replacement, and bit manipulation routines) into their own components (malloc_io.h and bit_util.h). This is mostly to break up cyclic dependencies, but it also breaks off a good chunk of the catch-all-ness of util, which is nice.
* Replace tabs following #define with spaces.Jason Evans2017-01-214-123/+123
| | | | This resolves #564.
* Remove extraneous parens around return arguments.Jason Evans2017-01-214-35/+35
| | | | This resolves #540.
* Update brace style.Jason Evans2017-01-217-91/+84
| | | | | | | Add braces around single-line blocks, and remove line breaks before function-opening braces. This resolves #537.
* Remove leading blank lines from function bodies.Jason Evans2017-01-132-2/+0
| | | | This resolves #535.
* Break up headers into constituent partsDavid Goldblatt2017-01-121-10/+6
| | | | | | | | | | This is part of a broader change to make header files better represent the dependencies between one another (see https://github.com/jemalloc/jemalloc/issues/533). It breaks up component headers into smaller parts that can be made to have a simpler dependency graph. For the autogenerated headers (smoothstep.h and size_classes.h), no splitting was necessary, so I didn't add support to emit multiple headers.
* Refactor test extent hook code to be reusable.Jason Evans2017-01-071-0/+264
| | | | | | Move test extent hook code from the extent integration test into a header, and normalize the out-of-band controls and introspection. Also refactor the base unit test to use the header.
* jemalloc cpp new/delete bindingsDave Watson2016-12-132-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds cpp bindings for jemalloc, along with necessary autoconf settings. This is mostly to add sized deallocation support, which can't be added from C directly. Sized deallocation is ~10% microbench improvement. * Import ax_cxx_compile_stdcxx.m4 from the autoconf repo, seems like the easiest way to get c++14 detection. * Adds various other changes, like CXXFLAGS, to configure.ac. * Adds new rules to Makefile.in for src/jemalloc-cpp.cpp, and a basic unittest. * Both new and delete are overridden, to ensure jemalloc is used for both. * TODO future enhancement of avoiding extra PLT thunks for new and delete - sdallocx and malloc are publicly exported jemalloc symbols, using an alias would link them directly. Unfortunately, was having trouble getting it to play nice with jemalloc's namespace support. Testing: Tested gcc 4.8, gcc 5, gcc 5.2, clang 4.0. Only gcc >= 5 has sized deallocation support, verified that the rest build correctly. Tested mac osx and Centos. Tested --with-jemalloc-prefix and --without-export. This resolves #202.
* Add os_unfair_lock support.Jason Evans2016-11-031-0/+2
| | | | | OS X 10.12 deprecated OSSpinLock; os_unfair_lock is the recommended replacement.
* Fix tsd bootstrapping for a0malloc().Jason Evans2016-05-071-0/+4
|
* Avoid blindly enabling assertions for header code when testing.Jason Evans2016-03-231-33/+45
| | | | | | Restructure the test program master header to avoid blindly enabling assertions. Prior to this change, assertion code in e.g. arena.h was always enabled for tests, which could skew performance-related testing.
* Fix Windows build issuesDmitri Smirnov2016-02-242-4/+0
| | | | This resolves #333.
* Refactor time_* into nstime_*.Jason Evans2016-02-222-3/+3
| | | | | | | Use a single uint64_t in nstime_t to store nanoseconds rather than using struct timespec. This reduces fragility around conversions between long and uint64_t, especially missing casts that only cause problems on 32-bit platforms.
* Flesh out time_*() API.Jason Evans2016-02-202-14/+3
|
* Fix MinGW-related portability issues.Jason Evans2015-07-232-37/+40
| | | | | | | | | | | | | Create and use FMT* macros that are equivalent to the PRI* macros that inttypes.h defines. This allows uniform use of the Unix-specific format specifiers, e.g. "%zu", as well as avoiding Windows-specific definitions of e.g. PRIu64. Add ffs()/ffsl() support for compiling with gcc. Extract compatibility definitions of ENOENT, EINVAL, EAGAIN, EPERM, ENOMEM, and ENORANGE into include/msvc_compat/windows_extra.h and use the file for tests as well as for core jemalloc code.
* Add JEMALLOC_FORMAT_PRINTF().Jason Evans2015-07-221-2/+2
| | | | | | Replace JEMALLOC_ATTR(format(printf, ...). with JEMALLOC_FORMAT_PRINTF(), so that configuration feature tests can omit the attribute if it would cause extraneous compilation warnings.
* Port mq_get() to MinGW.Jason Evans2015-07-211-10/+9
|
* Fix more MinGW build warnings.Jason Evans2015-07-181-12/+12
|
* Add timer support for Windows.Jason Evans2015-07-131-3/+6
|
* Fix size class overflow handling when profiling is enabled.Jason Evans2015-06-241-0/+4
| | | | | | | | | | Fix size class overflow handling for malloc(), posix_memalign(), memalign(), calloc(), and realloc() when profiling is enabled. Remove an assertion that erroneously caused arena_sdalloc() to fail when profiling was enabled. This resolves #232.
* use CLOCK_MONOTONIC in the timer if it's availableDaniel Micay2015-03-131-0/+10
| | | | | | Linux sets _POSIX_MONOTONIC_CLOCK to 0 meaning it *might* be available, so a sysconf check is necessary at runtime with a fallback to the mandatory CLOCK_REALTIME clock.
* Style and spelling fixes.Jason Evans2014-12-093-5/+3
|
* Don't configure HAVE_SSE2.Jason Evans2014-10-091-1/+4
| | | | | | | Don't configure HAVE_SSE2 (on behalf of SFMT), because its dependencies are notoriously unportable in practice. This resolves #119.
* Refactor permuted backtrace test allocation.Jason Evans2014-10-022-0/+32
| | | | | | Refactor permuted backtrace test allocation that was originally used only by the prof_accum test, so that it can be used by other heap profiling test binaries.
* avoid conflict with the POSIX timer_t typeDaniel Micay2014-09-081-5/+5
| | | | It hits a compilation error with glibc 2.19 without a rename.
* Add a simple timer implementation for use in benchmarking.Jason Evans2014-09-082-0/+17
|
* Move platform headers and tricks from jemalloc_internal.h.in to a new ↵Mike Hommey2014-05-281-0/+1
| | | | jemalloc_internal_decls.h header
* Use C99 varadic macros instead of GCC onesMike Hommey2014-05-271-192/+192
|
* Fix coding sytle nits.Jason Evans2014-05-011-1/+1
|
* Fix p_test_fail()'s va_list abuse.Jason Evans2014-03-301-13/+40
| | | | | | | | | 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.
* Remove duplicate 'static' keyword.Jason Evans2014-02-261-1/+1
| | | | Reported by İsmail Dönmez.
* Fix name mangling for stress tests.Jason Evans2014-01-171-4/+6
| | | | | | | | | | | Fix stress tests such that testlib code uses the jet_ allocator, but test code uses libjemalloc. Generate jemalloc_{rename,mangle}.h, the former because it's needed for the stress test name mangling fix, and the latter for consistency. As an artifact of this change, some (but not all) definitions related to the experimental API are absent from the headers unless the feature is enabled at configure time.
* Add util unit tests, and fix discovered bugs.Jason Evans2014-01-071-0/+83
| | | | | | | | | | | | | 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.
* Add mallctl*() unit tests.Jason Evans2013-12-201-8/+14
|
* Add quarantine unit tests.Jason Evans2013-12-171-0/+10
| | | | | | | | | 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 name mangling issues.Jason Evans2013-12-131-0/+1
| | | | | | | | | 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.
* Add mq (message queue) to test infrastructure.Jason Evans2013-12-126-13/+154
| | | | | | | | | 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.
* Fix inline-related macro issues.Jason Evans2013-12-103-32/+8
| | | | | | | | | Add JEMALLOC_INLINE_C and use it instead of JEMALLOC_INLINE in .c files, so that the annotated functions are always static. Remove SFMT's inline-related macros and use jemalloc's instead, so that there's no danger of interactions with jemalloc's definitions that disable inlining for debug builds.
* Add probabability distribution utility code.Jason Evans2013-12-105-34/+331
| | | | | | | | | | | | | | | 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-0917-0/+1539
| | | | | | | | | | | | 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.
* Refactor tests.Jason Evans2013-12-091-1/+176
| | | | | | | 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.
* Fix more test refactoring issues.Jason Evans2013-12-061-0/+1
|
* Fix test refactoring issues for Linux.Jason Evans2013-12-061-2/+1
|
* Refactor to support more varied testing.Jason Evans2013-12-043-0/+125
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.