[LTP] [PATCH v2] controllers: skip test when cgroup v2 is loaded
Jin Guojie
guojie.jin@gmail.com
Thu Dec 19 07:36:28 CET 2024
V2:
* Correction of comments
V1:
* Initial check for cgroup v2
When running "controllers" case on some newer Linux distributions, there
will be 10 ERROR messages during the setup phase, and several TFAIL
results at the end.
Current "controllers" cases only implement tests for cgroup v1 file interface.
It's better to skip the test after checking that v2 hierarchy has
already been loaded.
[1] https://lists.linux.it/pipermail/ltp/2024-December/041082.html
Signed-off-by: Jin Guojie <guojie.jin@gmail.com>
---
testcases/kernel/controllers/test_controllers.sh | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/testcases/kernel/controllers/test_controllers.sh
b/testcases/kernel/controllers/test_controllers.sh
index 7aa974ff2..0b67387ec 100755
--- a/testcases/kernel/controllers/test_controllers.sh
+++ b/testcases/kernel/controllers/test_controllers.sh
@@ -37,6 +37,15 @@
#
#
##################################################################################
+# Currently only cgroup v1 interface can be tested.
+# When the v2 hierarchy is already loaded in the system, skip the test.
+mount | grep " type cgroup2 " &>/dev/null
+if [ $? == 0 ]
+then
+ tst_brkm TCONF "" "test_controllers.sh: V1 controller
required, but mounted on V2"
+ exit 32
+fi
+
if [ -f /proc/cgroups ]
then
CPU_CONTROLLER=`grep -w cpu /proc/cgroups | cut -f1`;
--
2.34.1
More information about the ltp
mailing list