/* API test functions end here */
void test_cgroup_compare_cgroup(int ctl1, int ctl2, int i);
+void test_cgroup_add_free_controller(int i);
void get_controllers(const char *name, int *exist);
static int group_exist(char *path_group);
static int set_controller(int controller, char *controller_name,
*/
test_cgroup_delete_cgroup(ECGROUPNOTINITIALIZED, nullcgroup,
"group1", 0, 1, 1, 7);
+ /* Test08: test the wrapper */
+ test_cgroup_add_free_controller(8);
cgroup_free(&nullcgroup);
cgroup_free(&cgroup1);
cgroup_free(&cgroup_b);
cgroup_free(&cgroup_filled);
}
+
+void test_cgroup_add_free_controller(int i)
+{
+ struct cgroup *cgroup1 = NULL, *cgroup2 = NULL;
+ struct cgroup_controller *cgctl1, *cgctl2;
+
+ /* Test with a Null cgroup */
+ cgctl1 = cgroup_add_controller(cgroup1, "cpu");
+ if (!cgctl1)
+ message(i++, PASS, "add_controller()", 0, info[NOMESSAGE]);
+ else
+ message(i++, FAIL, "add_controller()", -1, info[NOMESSAGE]);
+
+ cgroup1 = cgroup_new_cgroup("testgroup");
+ cgctl1 = cgroup_add_controller(cgroup1, "cpuset");
+ if (cgctl1)
+ message(i++, PASS, "add_controller()", 0, info[NOMESSAGE]);
+ else
+ message(i++, FAIL, "add_controller()", -1, info[NOMESSAGE]);
+
+ cgctl2 = cgroup_add_controller(cgroup1, "cpu");
+ if (cgctl2)
+ message(i++, PASS, "add_controller()", 0, info[NOMESSAGE]);
+ else
+ message(i++, FAIL, "add_controller()", -1, info[NOMESSAGE]);
+
+ cgroup_free(&cgroup1);
+ cgroup_free_controllers(cgroup2);
+
+}