[PATCH] benchtest: Correct shell script related to bench-malloc-thread
Cupertino Miranda
cupertino.miranda@oracle.com
Thu Apr 24 11:42:44 GMT 2025
Hi everyone,
I came accross this error when executing make bench.
Maybe it has something to do with my environment, but could not
understand the root cause for this.
Please consider this patch if you think it is a reasonable/proper
solution.
Cheers,
Cupertino
This patch changes the shell script that selects which arguments are used
for the execution of bench-malloc-thread.
The problem seems to have been introduced in commit:
commit 2d6427a63cad8056ba6bcaaaa8df21977c8dde3d
Author: Wangyang Guo <wangyang.guo@intel.com>
Date: Fri Nov 29 16:05:35 2024 +0800
benchtests: Add calloc test
With current condition, the following error "/bin/sh: 3: [[: not found"
occurs when executing `make bench BENCHSET="malloc-thread"` and the else
path of the if condition is taken, using incorrect arguments for
bench-[cm]alloc-thread execution.
Error was reproducible in multiple Debian based distros.
---
benchtests/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/benchtests/Makefile b/benchtests/Makefile
index cccee62eb0..32eb30977e 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -493,7 +493,8 @@ bench-set: $(binaries-benchset)
bench-malloc: $(binaries-bench-malloc)
for run in $^; do \
echo "$${run}"; \
- if [[ `basename $${run}` =~ bench-[cm]alloc-thread ]]; then \
+ is_thread=`echo "$(basename $${run})" | grep -q -E "bench-[cm]alloc-thread"; echo "$$?"`; \
+ if [ $${is_thread} -eq 0 ]; then \
for thr in 1 8 16 32; do \
echo "Running $${run} $${thr}"; \
$(run-bench) $${thr} > $${run}-$${thr}.out; \
--
2.30.2
More information about the Libc-alpha
mailing list