]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
fix cgpath test
authorDwight Engen <dwight.engen@oracle.com>
Tue, 29 Oct 2013 20:46:16 +0000 (16:46 -0400)
committerStéphane Graber <stgraber@ubuntu.com>
Wed, 30 Oct 2013 13:52:52 +0000 (09:52 -0400)
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>
src/tests/cgpath.c

index 26a79c390e45d142e463a77c4d7e13fd7ce7c829..13986cfa05511eda683246c418e236c0fdb183d3 100644 (file)
@@ -74,8 +74,8 @@ static int test_running_container(const char *lxcpath,
                goto err3;
        }
 
-       /* test get/set value using memory.swappiness file */
-       ret = lxc_cgroup_get("memory.swappiness", value, sizeof(value),
+       /* test get/set value using memory.soft_limit_in_bytes file */
+       ret = lxc_cgroup_get("memory.soft_limit_in_bytes", value, sizeof(value),
                             c->name, c->config_path);
        if (ret < 0) {
                TSTERR("lxc_cgroup_get failed");
@@ -83,39 +83,30 @@ static int test_running_container(const char *lxcpath,
        }
        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) {
-               TSTERR("lxc_cgroup_set_bypath failed");
+               TSTERR("lxc_cgroup_set failed %d %d", ret, errno);
+               getchar();
                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);
        if (ret < 0) {
                TSTERR("lxc_cgroup_get failed");
                goto err3;
        }
-       if (strcmp(value, "100\n")) {
+       if (strcmp(value, "536870912\n")) {
                TSTERR("lxc_cgroup_set_bypath failed to set value >%s<", value);
                goto err3;
        }
 
        /* 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);
        if (ret < 0) {
                TSTERR("lxc_cgroup_set failed");
                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);
        if (!cgabspath) {