fix cgpath test

Commit 1ea59ad28 sets memory.use_hierarchy, which means that this test
cannot use memory.swappiness as its dummy cgroup item to set/unset since
writing to it with use_hierarchy set gets -EINVAL. Change test to use
memory.soft_limit_in_bytes instead.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
Dwight Engen 2013-10-29 16:46:16 -04:00 committed by Stéphane Graber
parent 50266dc604
commit 1f845c396f

View File

@ -74,8 +74,8 @@ static int test_running_container(const char *lxcpath,
goto err3; goto err3;
} }
/* test get/set value using memory.swappiness file */ /* test get/set value using memory.soft_limit_in_bytes file */
ret = lxc_cgroup_get("memory.swappiness", value, sizeof(value), ret = lxc_cgroup_get("memory.soft_limit_in_bytes", value, sizeof(value),
c->name, c->config_path); c->name, c->config_path);
if (ret < 0) { if (ret < 0) {
TSTERR("lxc_cgroup_get failed"); TSTERR("lxc_cgroup_get failed");
@ -83,39 +83,30 @@ static int test_running_container(const char *lxcpath,
} }
strcpy(value_save, value); strcpy(value_save, value);
ret = lxc_cgroup_set("memory.swappiness", "100", c->name, c->config_path); ret = lxc_cgroup_set("memory.soft_limit_in_bytes", "512M", c->name, c->config_path);
if (ret < 0) { if (ret < 0) {
TSTERR("lxc_cgroup_set_bypath failed"); TSTERR("lxc_cgroup_set failed %d %d", ret, errno);
getchar();
goto err3; goto err3;
} }
ret = lxc_cgroup_get("memory.swappiness", value, sizeof(value), ret = lxc_cgroup_get("memory.soft_limit_in_bytes", value, sizeof(value),
c->name, c->config_path); c->name, c->config_path);
if (ret < 0) { if (ret < 0) {
TSTERR("lxc_cgroup_get failed"); TSTERR("lxc_cgroup_get failed");
goto err3; goto err3;
} }
if (strcmp(value, "100\n")) { if (strcmp(value, "536870912\n")) {
TSTERR("lxc_cgroup_set_bypath failed to set value >%s<", value); TSTERR("lxc_cgroup_set_bypath failed to set value >%s<", value);
goto err3; goto err3;
} }
/* restore original value */ /* restore original value */
ret = lxc_cgroup_set("memory.swappiness", value_save, ret = lxc_cgroup_set("memory.soft_limit_in_bytes", value_save,
c->name, c->config_path); c->name, c->config_path);
if (ret < 0) { if (ret < 0) {
TSTERR("lxc_cgroup_set failed"); TSTERR("lxc_cgroup_set failed");
goto err3; goto err3;
} }
ret = lxc_cgroup_get("memory.swappiness", value, sizeof(value),
c->name, c->config_path);
if (ret < 0) {
TSTERR("lxc_cgroup_get failed");
goto err3;
}
if (strcmp(value, value_save)) {
TSTERR("lxc_cgroup_set failed to set value >%s<", value);
goto err3;
}
cgabspath = lxc_cgroup_path_get("freezer", c->name, c->config_path); cgabspath = lxc_cgroup_path_get("freezer", c->name, c->config_path);
if (!cgabspath) { if (!cgabspath) {