summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/btree_test.c2
-rw-r--r--test/hash_test.c2
-rw-r--r--wscript15
3 files changed, 14 insertions, 5 deletions
diff --git a/test/btree_test.c b/test/btree_test.c
index df44081..ad6b6b7 100644
--- a/test/btree_test.c
+++ b/test/btree_test.c
@@ -460,7 +460,7 @@ main(int argc, char** argv)
}
printf("\n");
-#ifndef _WIN32
+#ifdef ZIX_WITH_TEST_MALLOC
const size_t total_n_allocs = test_malloc_get_n_allocs();
const size_t fail_n_elems = 1000;
printf("Testing 0 ... %zu failed allocations\n", total_n_allocs);
diff --git a/test/hash_test.c b/test/hash_test.c
index ea808e6..91c0127 100644
--- a/test/hash_test.c
+++ b/test/hash_test.c
@@ -208,7 +208,7 @@ main(void)
return 1;
}
-#ifndef _WIN32
+#ifdef ZIX_WITH_TEST_MALLOC
const size_t total_n_allocs = test_malloc_get_n_allocs();
printf("Testing 0 ... %zu failed allocations\n", total_n_allocs);
expect_failure = true;
diff --git a/wscript b/wscript
index 802d415..1ae541c 100644
--- a/wscript
+++ b/wscript
@@ -28,6 +28,9 @@ def options(ctx):
'static': 'build static library'})
opt.add_option('--page-size', type='int', default=4096, dest='page_size',
help='Page size for B-tree')
+ opt.add_option('--no-test-malloc', action='store_true',
+ dest='no_test_malloc',
+ help='Do not use test malloc implementation')
def configure(conf):
@@ -97,6 +100,11 @@ def configure(conf):
if not conf.is_defined('HAVE_GLIB'):
conf.fatal('Glib is required to build benchmarks')
+ if not (conf.env.DEST_OS == 'win32' or Options.options.no_test_malloc):
+ conf.env['ZIX_WITH_TEST_MALLOC'] = True
+ else:
+ conf.env['ZIX_WITH_TEST_MALLOC'] = False
+
conf.define('ZIX_VERSION', ZIX_VERSION)
conf.define('ZIX_BTREE_PAGE_SIZE', Options.options.page_size)
conf.write_config_header('zix-config.h', remove=False)
@@ -204,10 +212,11 @@ def build(bld):
cflags = test_cflags + ['-DZIX_INTERNAL'],
linkflags = test_linkflags)
- if bld.env.DEST_OS == 'win32':
- test_malloc = []
- else:
+ if bld.env.ZIX_WITH_TEST_MALLOC:
test_malloc = ['test/test_malloc.c']
+ test_cflags += ['-DZIX_WITH_TEST_MALLOC']
+ else:
+ test_malloc = []
# Unit test programs
for i in tests: