Skip to contentSkip to conversation

memcg_conctrol_test: fix if CONFIG_SWAP=n

PATCH In review Joerg Vehlow 2 participants 2 messages Nov 23, 2022 – Nov 24, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 memcg_conctrol_test: fix if CONFIG_SWAP=n

From: Joerg Vehlow <[email protected]>

This allows the test to run successfully on systems without swap enabled It restores the behaviour of the test before
a77b65bbe ("controllers: Update memcg_control_test to newer test lib and cgroup lib")

---
 .../kernel/controllers/memcg/control/memcg_control_test.sh  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
testcases/kernel/controllers/memcg/control/memcg_control_test.sh +5 -1
index 093d50c2a..941d918fc 100644
@@ -47,7 +47,11 @@ test1()
 	tst_res TINFO "Test #1: Checking if the memory usage limit imposed by the topmost group is enforced"
 
 	ROD echo "$ACTIVE_MEM_LIMIT" \> "$test_dir/$memory_limit"
-	ROD echo "$TOT_MEM_LIMIT" \> "$test_dir/$memsw_memory_limit"
+	
+	# If the kernel is built without swap, the $memsw_memory_limit file is missing
+	if [ -e "$test_dir/$memsw_memory_limit" ]; then
+		ROD echo "$TOT_MEM_LIMIT" \> "$test_dir/$memsw_memory_limit"
+	fi
 
 	KILLED_CNT=0
 	test_proc_kill
Signature · 5 lines
2.25.1


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

From: Joerg Vehlow <[email protected]>

This allows the test to run successfully on systems without swap enabled It restores the behaviour of the test before
a77b65bbe ("controllers: Update memcg_control_test to newer test lib and cgroup lib")

---

Quoted 33 lines
 .../kernel/controllers/memcg/control/memcg_control_test.sh  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/controllers/memcg/control/memcg_control_test.sh b/testcases/kernel/controllers/memcg/control/memcg_control_test.sh index 093d50c2a..941d918fc 100644

testcases/kernel/controllers/memcg/control/memcg_control_test.sh +0 -0
@@ -47,7 +47,11 @@ test1()
        tst_res TINFO "Test #1: Checking if the memory usage limit imposed

by the topmost group is enforced"

ROD echo "$ACTIVE_MEM_LIMIT" \> "$test_dir/$memory_limit"

testcases/kernel/controllers/memcg/control/memcg_control_test.sh +2 -1
-       ROD echo "$TOT_MEM_LIMIT" \> "$test_dir/$memsw_memory_limit"
+
+       # If the kernel is built without swap, the $memsw_memory_limit

file is missing

testcases/kernel/controllers/memcg/control/memcg_control_test.sh +2 -0
+       if [ -e "$test_dir/$memsw_memory_limit" ]; then
+               ROD echo "$TOT_MEM_LIMIT" \>

"$test_dir/$memsw_memory_limit"
+ fi

KILLED_CNT=0
test_proc_kill
--
2.25.1

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

Signature · 2 lines
Regards,
Li Wang
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp