X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Ftest%2Ftest-cgroup.c;h=4be69a408d8d9930e49bf15c7b8cc1bbc665d71a;hb=b6e676ce41508e2aeea22202fc8f234126177f52;hp=e742632032ccb435b225c8467d7f29df64bd45bc;hpb=379079ba6b06e82de9a8f0025456308a34b4b115;p=elogind.git diff --git a/src/test/test-cgroup.c b/src/test/test-cgroup.c index e74263203..4be69a408 100644 --- a/src/test/test-cgroup.c +++ b/src/test/test-cgroup.c @@ -23,8 +23,8 @@ #include #include "cgroup-util.h" +#include "path-util.h" #include "util.h" -#include "log.h" int main(int argc, char*argv[]) { char *path; @@ -36,19 +36,19 @@ int main(int argc, char*argv[]) { assert_se(cg_create(SYSTEMD_CGROUP_CONTROLLER, "/test-b/test-c") == 0); assert_se(cg_create_and_attach(SYSTEMD_CGROUP_CONTROLLER, "/test-b", 0) == 0); - assert_se(cg_get_by_pid(SYSTEMD_CGROUP_CONTROLLER, getpid(), &path) == 0); + assert_se(cg_pid_get_path(SYSTEMD_CGROUP_CONTROLLER, getpid(), &path) == 0); assert_se(streq(path, "/test-b")); free(path); assert_se(cg_attach(SYSTEMD_CGROUP_CONTROLLER, "/test-a", 0) == 0); - assert_se(cg_get_by_pid(SYSTEMD_CGROUP_CONTROLLER, getpid(), &path) == 0); + assert_se(cg_pid_get_path(SYSTEMD_CGROUP_CONTROLLER, getpid(), &path) == 0); assert_se(path_equal(path, "/test-a")); free(path); assert_se(cg_create_and_attach(SYSTEMD_CGROUP_CONTROLLER, "/test-b/test-d", 0) == 0); - assert_se(cg_get_by_pid(SYSTEMD_CGROUP_CONTROLLER, getpid(), &path) == 0); + assert_se(cg_pid_get_path(SYSTEMD_CGROUP_CONTROLLER, getpid(), &path) == 0); assert_se(path_equal(path, "/test-b/test-d")); free(path); @@ -64,7 +64,7 @@ int main(int argc, char*argv[]) { assert_se(cg_kill_recursive(SYSTEMD_CGROUP_CONTROLLER, "/test-a", 0, false, false, false, NULL) == 0); assert_se(cg_kill_recursive(SYSTEMD_CGROUP_CONTROLLER, "/test-b", 0, false, false, false, NULL) > 0); - assert_se(cg_migrate_recursive(SYSTEMD_CGROUP_CONTROLLER, "/test-b", "/test-a", false, false) > 0); + assert_se(cg_migrate_recursive(SYSTEMD_CGROUP_CONTROLLER, "/test-b", SYSTEMD_CGROUP_CONTROLLER, "/test-a", false, false) > 0); assert_se(cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, "/test-a", false) == 0); assert_se(cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, "/test-b", false) > 0); @@ -78,8 +78,8 @@ int main(int argc, char*argv[]) { assert_se(cg_delete(SYSTEMD_CGROUP_CONTROLLER, "/test-a") >= 0); assert_se(cg_split_spec("foobar:/", &c, &p) == 0); - assert(streq(c, "foobar")); - assert(streq(p, "/")); + assert_se(streq(c, "foobar")); + assert_se(streq(p, "/")); free(c); free(p); @@ -91,13 +91,13 @@ int main(int argc, char*argv[]) { assert_se(cg_split_spec("fo/obar:/", &c, &p) < 0); assert_se(cg_split_spec("/", &c, &p) >= 0); - assert(c == NULL); - assert(streq(p, "/")); + assert_se(c == NULL); + assert_se(streq(p, "/")); free(p); assert_se(cg_split_spec("foo", &c, &p) >= 0); - assert(streq(c, "foo")); - assert(p == NULL); + assert_se(streq(c, "foo")); + assert_se(p == NULL); free(c); return 0;