aboutsummaryrefslogtreecommitdiffstats
path: root/test/test.sh.in
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2017-02-21 23:40:06 -0800
committerJason Evans <jasone@canonware.com>2017-02-23 08:57:02 -0800
commitde49674fbde4d124a0a7e7e97f5656e190980759 (patch)
tree9a29c6d5f569ea6098cc85663b4cb0e7bba4dc3f /test/test.sh.in
parent8ac7937eb5ce011945188ef3553dbc2bcc294a25 (diff)
downloadplatform_external_jemalloc_new-de49674fbde4d124a0a7e7e97f5656e190980759.tar.gz
platform_external_jemalloc_new-de49674fbde4d124a0a7e7e97f5656e190980759.tar.bz2
platform_external_jemalloc_new-de49674fbde4d124a0a7e7e97f5656e190980759.zip
Use MALLOC_CONF rather than malloc_conf for tests.
malloc_conf does not reliably work with MSVC, which complains of "inconsistent dll linkage", i.e. its inability to support the application overriding malloc_conf when dynamically linking/loading. Work around this limitation by adding test harness support for per test shell script sourcing, and converting all tests to use MALLOC_CONF instead of malloc_conf.
Diffstat (limited to 'test/test.sh.in')
-rw-r--r--test/test.sh.in29
1 files changed, 28 insertions, 1 deletions
diff --git a/test/test.sh.in b/test/test.sh.in
index a39f99f6..f0f0f979 100644
--- a/test/test.sh.in
+++ b/test/test.sh.in
@@ -11,6 +11,18 @@ case @abi@ in
;;
esac
+# Make a copy of the @JEMALLOC_CPREFIX@MALLOC_CONF passed in to this script, so
+# it can be repeatedly concatenated with per test settings.
+export MALLOC_CONF_ALL=${@JEMALLOC_CPREFIX@MALLOC_CONF}
+# Concatenate the individual test's MALLOC_CONF and MALLOC_CONF_ALL.
+export_malloc_conf() {
+ if [ "x${MALLOC_CONF}" != "x" -a "x${MALLOC_CONF_ALL}" != "x" ] ; then
+ export @JEMALLOC_CPREFIX@MALLOC_CONF="${MALLOC_CONF},${MALLOC_CONF_ALL}"
+ else
+ export @JEMALLOC_CPREFIX@MALLOC_CONF="${MALLOC_CONF}${MALLOC_CONF_ALL}"
+ fi
+}
+
# Corresponds to test_status_t.
pass_code=0
skip_code=1
@@ -24,7 +36,22 @@ for t in $@; do
echo
fi
echo "=== ${t} ==="
- ${t}@exe@ @abs_srcroot@ @abs_objroot@
+ if [ -e "@srcroot@${t}.sh" ] ; then
+ # Source the shell script corresponding to the test in a subshell and
+ # execute the test. This allows the shell script to set MALLOC_CONF, which
+ # is then used to set @JEMALLOC_CPREFIX@MALLOC_CONF (thus allowing the
+ # per test shell script to ignore the @JEMALLOC_CPREFIX@ detail).
+ $(enable_fill=@enable_fill@ \
+ enable_prof=@enable_prof@ \
+ enable_tcache=@enable_tcache@ \
+ . @srcroot@${t}.sh && \
+ export_malloc_conf && \
+ ${t}@exe@ @abs_srcroot@ @abs_objroot@)
+ else
+ $(export MALLOC_CONF= && \
+ export_malloc_conf &&
+ ${t}@exe@ @abs_srcroot@ @abs_objroot@)
+ fi
result_code=$?
case ${result_code} in
${pass_code})