Skip to contentSkip to conversation

cpuset_memory_testset.sh: Fix syntax error when hugepages not supported

PATCH In review Martin Doucha 2 participants 3 messages Jul 19, 2023 – Jul 20, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpuset_memory_testset.sh: Fix syntax error when hugepages not supported

The initial hugepage size calculation can result in multiplication of empty string on machines which don't support hugepages. Make sure that empty string is converted to zero.

---
 .../cpuset/cpuset_memory_test/cpuset_memory_testset.sh          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh +1 -1
index cb7dbd867..c1e7cea8f 100755
@@ -41,7 +41,7 @@ mems_all="$(seq -s, 0 $((nr_mems-1)))"
 cpu_of_node0=0
 
 HUGEPAGESIZE=$(awk '/Hugepagesize/{ print $2 }' /proc/meminfo)
-HUGEPAGESIZE=$(($HUGEPAGESIZE * 1024))
+HUGEPAGESIZE=$((${HUGEPAGESIZE:-0} * 1024))
 
 MEMORY_RESULT="$CPUSET_TMP/memory_result"
 
Signature · 5 lines
2.41.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Martin Doucha

The initial hugepage size calculation can result in multiplication of empty string on machines which don't support hugepages. Make sure that empty string is converted to zero.

Quoted 29 lines
---
 .../cpuset/cpuset_memory_test/cpuset_memory_testset.sh          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh b/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh index cb7dbd867..c1e7cea8f 100755
---
a/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh
+++
b/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh

testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh +1 -2
@@ -41,7 +41,7 @@ mems_all="$(seq -s, 0 $((nr_mems-1)))"
 cpu_of_node0=0
 
 HUGEPAGESIZE=$(awk '/Hugepagesize/{ print $2 }' /proc/meminfo)
-HUGEPAGESIZE=$(($HUGEPAGESIZE * 1024))
+HUGEPAGESIZE=$((${HUGEPAGESIZE:-0} * 1024))
 
 MEMORY_RESULT="$CPUSET_TMP/memory_result"
 
--

2.41.0

--
Mailing list info: https://lists.linux.it/listinfo/ltp

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

Patch merged, thanks!

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp