Dag-Erling Smørgrav
d014682206
Add t_is_zero predicates.
2022-09-16 11:09:55 +02:00
Dag-Erling Smørgrav
ea5b521c61
Add a simple test case for the allocator.
2017-05-11 00:08:45 +02:00
Dag-Erling Smørgrav
f8ebdbc14d
Move the test framework into its own subdirectory
2015-10-04 07:49:48 +00:00
Dag-Erling Smørgrav
3ec87c7a8c
Introduce t_malloc_fail_after: if non-zero, it serves as a countdown to
...
setting t_malloc_fail. Also, enforce t_malloc_fail in realloc(), but not
before checking that the argument was valid.
2014-12-29 23:49:29 +00:00
Dag-Erling Smørgrav
82e32027af
Move the decision of whether to check for memory leaks from the malloc()
...
code to the driver and allow an environment variable to override the
default (on unless coverage is enabled).
2014-12-29 13:24:44 +00:00
Dag-Erling Smørgrav
eb10ce6d05
If the test case changes desc, it *must* point to an allocated buffer
...
which the driver will free after printing the result.
2014-12-29 12:56:35 +00:00
Dag-Erling Smørgrav
eadeeb486c
Skip memory leak checks if coverage analysis is enabled.
2014-12-20 01:30:01 +00:00
Dag-Erling Smørgrav
6ed802ddf3
Consistently use #if HAVE_FOO instead of #ifdef HAVE_FOO. The reason is
...
that AC_CHECK_DECLS([foo]), unlike AC_CHECK_FUNCS([foo]), will always
define HAVE_FOO, so #ifdef HAVE_FOO will always be true even if it is 0.
This commit finally fixes the [bl]e{32,64}{enc,dec} issue on Linux.
2014-12-20 00:38:54 +00:00
Dag-Erling Smørgrav
a587a25d45
Ignore free(NULL) instead of treating it the same as free(malloc(0)).
2014-10-30 16:35:54 +00:00
Dag-Erling Smørgrav
1f0fd8d9fe
Create an additional test case which always runs after cleanup and checks
...
for memory leaks. It may be necessary to make this optional at some point,
but for now, none of our tests leak memory.
2014-10-30 16:31:03 +00:00
Dag-Erling Smørgrav
14c64ec3a5
Improved checks for <sys/ktrace.h>.
2014-10-30 13:07:16 +00:00
Dag-Erling Smørgrav
46beb1adcb
Various fixes for Linux and gcc portability.
2014-10-30 12:14:05 +00:00
Dag-Erling Smørgrav
bd69c34a11
Emit jemalloc-compatible trace events if possible.
2014-10-30 12:05:08 +00:00
Dag-Erling Smørgrav
bf087fd70e
Gather memory allocation statistics and print them at the end if verbose.
2014-10-30 11:05:01 +00:00
Dag-Erling Smørgrav
4a4726f9d6
Compare the result of mmap() to MAP_FAILED, not NULL.
2014-10-18 22:01:08 +00:00
Dag-Erling Smørgrav
64a2da2b84
Refactor the malloc() etc code to reduce code duplication.
...
Introduce a t_malloc_fatal flag that makes unintentional allocation
failures fatal. This reduces the need for error handling in tests.
Enable that flag in t_main(). Test programs that don't want it can
override it in t_prepare().
2014-08-03 00:58:13 +00:00
Dag-Erling Smørgrav
ce567a72e0
Add a simple malloc() implementation which can be configured to fail
...
when testing error handling code.
2014-08-02 23:30:07 +00:00