• 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 #include "tst_cgroup.h"
8 
9 static char *only_mount_v1;
10 static char *no_cleanup;
11 static struct tst_option opts[] = {
12 	{"v", &only_mount_v1, "-v\tOnly try to mount CGroups V1"},
13 	{"n", &no_cleanup, "-n\tLeave CGroups created by test"},
14 	{NULL, NULL, NULL},
15 };
16 struct tst_cgroup_opts cgopts;
17 
do_test(void)18 static void do_test(void)
19 {
20 	tst_res(TPASS, "pass");
21 }
22 
setup(void)23 static void setup(void)
24 {
25 	cgopts.only_mount_v1 = !!only_mount_v1,
26 
27 	tst_cgroup_scan();
28 	tst_cgroup_print_config();
29 
30 	tst_cgroup_require("memory", &cgopts);
31 	tst_cgroup_print_config();
32 	tst_cgroup_require("cpuset", &cgopts);
33 	tst_cgroup_print_config();
34 }
35 
cleanup(void)36 static void cleanup(void)
37 {
38 	if (no_cleanup) {
39 		tst_res(TINFO, "no cleanup");
40 	} else {
41 		tst_res(TINFO, "cleanup");
42 		tst_cgroup_cleanup();
43 	}
44 }
45 
46 static struct tst_test test = {
47 	.test_all = do_test,
48 	.setup = setup,
49 	.cleanup = cleanup,
50 	.options = opts,
51 };
52