summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2018-08-05 10:37:53 +0100
committerDavid Goldblatt <davidtgoldblatt@gmail.com>2018-08-09 10:41:20 -0700
commit0771ff2cea6dc18fcd3f6bf452b4224a4e17ae38 (patch)
tree72644683fb50daf50842dea794f9191612642e29
parente8ec9528abac90efe4e0cc3a29da8d7aea59f23d (diff)
downloadjemalloc-0771ff2cea6dc18fcd3f6bf452b4224a4e17ae38.tar.gz
FreeBSD build changes and allow to run the tests.
-rw-r--r--include/jemalloc/internal/mutex.h13
-rwxr-xr-xscripts/gen_run_tests.py25
-rw-r--r--src/pages.c2
3 files changed, 29 insertions, 11 deletions
diff --git a/include/jemalloc/internal/mutex.h b/include/jemalloc/internal/mutex.h
index 651ce5f9..5a955d9e 100644
--- a/include/jemalloc/internal/mutex.h
+++ b/include/jemalloc/internal/mutex.h
@@ -115,9 +115,16 @@ struct malloc_mutex_s {
{{{LOCK_PROF_DATA_INITIALIZER, 0}}, \
WITNESS_INITIALIZER("mutex", WITNESS_RANK_OMIT)}
#elif (defined(JEMALLOC_MUTEX_INIT_CB))
-# define MALLOC_MUTEX_INITIALIZER \
- {{{LOCK_PROF_DATA_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, NULL}}, \
- WITNESS_INITIALIZER("mutex", WITNESS_RANK_OMIT)}
+# if (defined(JEMALLOC_DEBUG))
+# define MALLOC_MUTEX_INITIALIZER \
+ {{{LOCK_PROF_DATA_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, NULL}}, \
+ WITNESS_INITIALIZER("mutex", WITNESS_RANK_OMIT), 0}
+# else
+# define MALLOC_MUTEX_INITIALIZER \
+ {{{LOCK_PROF_DATA_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, NULL}}, \
+ WITNESS_INITIALIZER("mutex", WITNESS_RANK_OMIT)}
+# endif
+
#else
# define MALLOC_MUTEX_TYPE PTHREAD_MUTEX_DEFAULT
# if defined(JEMALLOC_DEBUG)
diff --git a/scripts/gen_run_tests.py b/scripts/gen_run_tests.py
index a87ecffb..5052b3e0 100755
--- a/scripts/gen_run_tests.py
+++ b/scripts/gen_run_tests.py
@@ -4,6 +4,7 @@ import sys
from itertools import combinations
from os import uname
from multiprocessing import cpu_count
+from subprocess import call
# Later, we want to test extended vaddr support. Apparently, the "real" way of
# checking this is flaky on OS X.
@@ -13,13 +14,25 @@ nparallel = cpu_count() * 2
uname = uname()[0]
+if "BSD" in uname:
+ make_cmd = 'gmake'
+else:
+ make_cmd = 'make'
+
def powerset(items):
result = []
for i in xrange(len(items) + 1):
result += combinations(items, i)
return result
-possible_compilers = [('gcc', 'g++'), ('clang', 'clang++')]
+possible_compilers = []
+for cc, cxx in (['gcc', 'g++'], ['clang', 'clang++']):
+ try:
+ cmd_ret = call([cc, "-v"])
+ if cmd_ret == 0:
+ possible_compilers.append((cc, cxx))
+ except:
+ pass
possible_compiler_opts = [
'-m32',
]
@@ -39,7 +52,7 @@ possible_malloc_conf_opts = [
]
print 'set -e'
-print 'if [ -f Makefile ] ; then make relclean ; fi'
+print 'if [ -f Makefile ] ; then %(make_cmd)s relclean ; fi' % {'make_cmd': make_cmd}
print 'autoconf'
print 'rm -rf run_tests.out'
print 'mkdir run_tests.out'
@@ -102,11 +115,11 @@ cd run_test_%(ind)d.out
echo "==> %(config_line)s" >> run_test.log
%(config_line)s >> run_test.log 2>&1 || abort
-run_cmd make all tests
-run_cmd make check
-run_cmd make distclean
+run_cmd %(make_cmd)s all tests
+run_cmd %(make_cmd)s check
+run_cmd %(make_cmd)s distclean
EOF
-chmod 755 run_test_%(ind)d.sh""" % {'ind': ind, 'config_line': config_line}
+chmod 755 run_test_%(ind)d.sh""" % {'ind': ind, 'config_line': config_line, 'make_cmd': make_cmd}
ind += 1
print 'for i in `seq 0 %(last_ind)d` ; do echo run_test_${i}.sh ; done | xargs -P %(nparallel)d -n 1 sh' % {'last_ind': ind-1, 'nparallel': nparallel}
diff --git a/src/pages.c b/src/pages.c
index cc967fcf..9561eb36 100644
--- a/src/pages.c
+++ b/src/pages.c
@@ -390,8 +390,6 @@ os_page_detect(void) {
SYSTEM_INFO si;
GetSystemInfo(&si);
return si.dwPageSize;
-#elif defined(__FreeBSD__)
- return getpagesize();
#else
long result = sysconf(_SC_PAGESIZE);
if (result == -1) {