• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* Copyright (c) 2021 SUSE LLC */
3 
4 #include <stdio.h>
5 
6 #include "tst_test.h"
7 
8 static char *only_mount_v1;
9 static char *no_cleanup;
10 static struct tst_option opts[] = {
11 	{"v", &only_mount_v1, "-v\tOnly try to mount CGroups V1"},
12 	{"n", &no_cleanup, "-n\tLeave CGroups created by test"},
13 	{NULL, NULL, NULL},
14 };
15 struct tst_cg_opts cgopts;
16 
do_test(void)17 static void do_test(void)
18 {
19 	tst_res(TPASS, "pass");
20 }
21 
setup(void)22 static void setup(void)
23 {
24 	cgopts.needs_ver = !!only_mount_v1 ? TST_CG_V1 : 0;
25 
26 	tst_cg_scan();
27 	tst_cg_print_config();
28 
29 	tst_cg_require("memory", &cgopts);
30 	tst_cg_print_config();
31 	tst_cg_require("cpuset", &cgopts);
32 	tst_cg_print_config();
33 }
34 
cleanup(void)35 static void cleanup(void)
36 {
37 	if (no_cleanup) {
38 		tst_res(TINFO, "no cleanup");
39 	} else {
40 		tst_res(TINFO, "cleanup");
41 		tst_cg_cleanup();
42 	}
43 }
44 
45 static struct tst_test test = {
46 	.test_all = do_test,
47 	.setup = setup,
48 	.cleanup = cleanup,
49 	.options = opts,
50 };
51