tests: support pure unified cgroup layouts in cgpath test

parent a4f24357
...@@ -104,33 +104,33 @@ static int test_running_container(const char *lxcpath, const char *name) ...@@ -104,33 +104,33 @@ static int test_running_container(const char *lxcpath, const char *name)
goto err3; goto err3;
/* test get/set value using memory.soft_limit_in_bytes file */ /* test get/set value using memory.soft_limit_in_bytes file */
ret = cgroup_ops->get(cgroup_ops, "memory.soft_limit_in_bytes", value, ret = cgroup_ops->get(cgroup_ops, "pids.max", value, sizeof(value),
sizeof(value), c->name, c->config_path); c->name, c->config_path);
if (ret < 0) { if (ret < 0) {
TSTERR("cgroup_get failed"); TSTERR("cgroup_get failed");
goto err3; goto err3;
} }
(void)strlcpy(value_save, value, NAME_MAX); (void)strlcpy(value_save, value, NAME_MAX);
ret = cgroup_ops->set(cgroup_ops, "memory.soft_limit_in_bytes", "512M", ret = cgroup_ops->set(cgroup_ops, "pids.max", "10000",
c->name, c->config_path); c->name, c->config_path);
if (ret < 0) { if (ret < 0) {
TSTERR("cgroup_set failed %d %d", ret, errno); TSTERR("cgroup_set failed %d %d", ret, errno);
goto err3; goto err3;
} }
ret = cgroup_ops->get(cgroup_ops, "memory.soft_limit_in_bytes", value, ret = cgroup_ops->get(cgroup_ops, "pids.max", value,
sizeof(value), c->name, c->config_path); sizeof(value), c->name, c->config_path);
if (ret < 0) { if (ret < 0) {
TSTERR("cgroup_get failed"); TSTERR("cgroup_get failed");
goto err3; goto err3;
} }
if (strcmp(value, "536870912\n")) { if (strcmp(value, "10000\n")) {
TSTERR("cgroup_set_bypath failed to set value >%s<", value); TSTERR("cgroup_set_bypath failed to set value >%s<", value);
goto err3; goto err3;
} }
/* restore original value */ /* restore original value */
ret = cgroup_ops->set(cgroup_ops, "memory.soft_limit_in_bytes", ret = cgroup_ops->set(cgroup_ops, "pids.max",
value_save, c->name, c->config_path); value_save, c->name, c->config_path);
if (ret < 0) { if (ret < 0) {
TSTERR("cgroup_set failed"); TSTERR("cgroup_set failed");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment