All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-oe][PATCH] jemalloc: include the missing shell scripts and source the corresponds shell scripts for some test cases.
@ 2023-04-03  8:16 Wentao Zhang
  0 siblings, 0 replies; only message in thread
From: Wentao Zhang @ 2023-04-03  8:16 UTC (permalink / raw)
  To: openembedded-devel

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>
---
 .../recipes-devtools/jemalloc/files/run-ptest | 29 ++++++++++++++++++-
 .../jemalloc/jemalloc_5.3.0.bb                |  7 +++--
 2 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/meta-oe/recipes-devtools/jemalloc/files/run-ptest b/meta-oe/recipes-devtools/jemalloc/files/run-ptest
index b351f947e..5c826a176 100644
--- a/meta-oe/recipes-devtools/jemalloc/files/run-ptest
+++ b/meta-oe/recipes-devtools/jemalloc/files/run-ptest
@@ -1,9 +1,37 @@
 #!/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
@@ -18,4 +46,3 @@ for dir in tests/* ; do
 	done
 	cd $saved_dir
 done
-
diff --git a/meta-oe/recipes-devtools/jemalloc/jemalloc_5.3.0.bb b/meta-oe/recipes-devtools/jemalloc/jemalloc_5.3.0.bb
index 950b64ee9..9ad83261e 100644
--- a/meta-oe/recipes-devtools/jemalloc/jemalloc_5.3.0.bb
+++ b/meta-oe/recipes-devtools/jemalloc/jemalloc_5.3.0.bb
@@ -42,10 +42,13 @@ do_compile_ptest() {
 
 do_install_ptest() {
 	install -d ${D}${PTEST_PATH}/tests
-	subdirs="test/unit test/integration test/stress "
+	subdirs="unit integration stress "
 	for tooltest in ${subdirs}
 	do
-		cp -r ${B}/${tooltest} ${D}${PTEST_PATH}/tests
+		cp -r ${B}/test/${tooltest} ${D}${PTEST_PATH}/tests
+        if find ${S}/test/${tooltest}/ -name '*.sh' -print -quit | grep -q .; then
+		    cp ${S}/test/${tooltest}/*.sh ${D}${PTEST_PATH}/tests/${tooltest}
+        fi
 	done
 	find ${D}${PTEST_PATH}/tests \( -name "*.d" -o -name "*.o" \) -exec rm -f {} \;
 }
-- 
2.25.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-03  8:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-03  8:16 [meta-oe][PATCH] jemalloc: include the missing shell scripts and source the corresponds shell scripts for some test cases Wentao Zhang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.