Wentao Zhang b3274b4e90 jemalloc: include the missing shell scripts and source the corresponds shell scripts for some test cases.
The test cases in jemalloc require the appropriate value to be exported
to MALLOC_CONF, which is stored in shell scripts.
The privious script just ran the test cases without exporting value, causing
the tests to fail.
Include the missing shell scripts, and source them before running the test
cases now.

Signed-off-by: Wentao Zhang <wentao.zhang@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2023-04-04 13:39:46 -07:00

49 lines
1.3 KiB
Bash

#!/bin/sh
export MALLOC_CONF_ALL=${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 MALLOC_CONF="${MALLOC_CONF},${MALLOC_CONF_ALL}"
else
export MALLOC_CONF="${MALLOC_CONF}${MALLOC_CONF_ALL}"
fi
}
saved_dir=$PWD
for dir in tests/* ; do
cd $dir
for atest in * ; do
if [[ "${atest##*.}" == "sh" ]]; then
continue
fi
if [ -e "${atest}.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 MALLOC_CONF (thus allowing the
# per test shell script to ignore the detail).
enable_fill=1 \
enable_prof=1 \
. $(pwd)/${atest}.sh && \
export_malloc_conf
else
export MALLOC_CONF= && \
export_malloc_conf
fi
if [ \( -x $atest \) -a \( -f $atest \) ] ; then
rm -rf tests.log
./$atest > tests.log 2>&1
sed -e '/: pass/ s/^/PASS: /g' \
-e '/: skip/ s/^/SKIP: /g' \
-e '/: fail/ s/^/FAIL: /g' \
-e 's/: pass//g' \
-e 's/: skip//g' \
-e 's/: fail//g' \
-e '/^--- pass:/d' tests.log
fi
done
cd $saved_dir
done