[LTP] [PATCH] tst_cgroup: Fix typo

Yang Xu xuyang2018.jy@fujitsu.com
Fri Jul 8 12:49:08 CEST 2022


We only have needs_cgroup_ctrls instead of needs_cgroup_controllers in
tst_test structure. So fix it.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
I found it when I plan to write a cgroup regression test to ltp.
 doc/c-test-api.txt   | 6 +++---
 include/tst_cgroup.h | 2 +-
 lib/tst_test.c       | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/doc/c-test-api.txt b/doc/c-test-api.txt
index c138b7027..9ecf28630 100644
--- a/doc/c-test-api.txt
+++ b/doc/c-test-api.txt
@@ -2144,13 +2144,13 @@ struct tst_test test = {
 	.setup = setup,
 	.test_all = run,
 	.cleanup = cleanup,
-	.needs_cgroup_controllers = (const char *const []){ "memory", NULL },
+	.needs_cgroup_ctrls = (const char *const []){ "memory", NULL },
 	...
 };
 -------------------------------------------------------------------------------
 
 Above, we first ensure the memory controller is available on the
-test's CGroup with '.needs_cgroup_controllers'. This populates a structure,
+test's CGroup with '.needs_cgroup_ctrls'. This populates a structure,
 'tst_cg', which represents the test's CGroup.
 
 We then write the current processes PID into 'cgroup.procs', which
@@ -2217,7 +2217,7 @@ static void cleanup(void)
 struct tst_test test = {
 	.setup = setup,
 	.test_all = run,
-	.needs_cgroup_controllers = (const char *const []){
+	.needs_cgroup_ctrls = (const char *const []){
 		"cpuset",
 		"memory",
 		NULL
diff --git a/include/tst_cgroup.h b/include/tst_cgroup.h
index d32d62399..08d1339a2 100644
--- a/include/tst_cgroup.h
+++ b/include/tst_cgroup.h
@@ -115,7 +115,7 @@ void tst_cg_print_config(void);
 
 /* Ensure the specified controller is available in the test's default
  * CGroup, mounting/enabling it if necessary. Usually this is not
- * necesary use tst_test.needs_cgroup_controllers instead.
+ * necessary use tst_test.needs_cgroup_ctrls instead.
  */
 void tst_cg_require(const char *const ctrl_name,
 			const struct tst_cg_opts *const options)
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 4a196fc46..4b4dd125d 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -1259,7 +1259,7 @@ static void do_setup(int argc, char *argv[])
 	if (tst_test->needs_cgroup_ctrls)
 		do_cgroup_requires();
 	else if (tst_test->needs_cgroup_ver)
-		tst_brk(TBROK, "needs_cgroup_ver only works with needs_cgroup_controllers");
+		tst_brk(TBROK, "tst_test->needs_cgroup_ctrls must be set");
 }
 
 static void do_test_setup(void)
-- 
2.27.0



More information about the ltp mailing list