From: Dhaval Giani Date: Fri, 26 Jun 2009 17:46:22 +0000 (+0530) Subject: libcgroup: Add get_mount_point test case X-Git-Tag: v0.34~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7620ff3e067b8d77ddf321d81b4b19adc2729f6b;p=thirdparty%2Flibcgroup.git libcgroup: Add get_mount_point test case The test case to test the new mount point API. Signed-off-by: Dhaval Giani --- diff --git a/tests/get_mount_point.c b/tests/get_mount_point.c new file mode 100644 index 00000000..b3720927 --- /dev/null +++ b/tests/get_mount_point.c @@ -0,0 +1,49 @@ +#include +#include +#include +#include +#include + +int main() +{ + int ret; + char *mount_point; + char string[100]; + + strcpy(string, "cpu"); + + ret = cgroup_init(); + if (ret) { + printf("cgroup_init failed with %s\n", cgroup_strerror(ret)); + exit(3); + } + + ret = cgroup_get_subsys_mount_point(string, &mount_point); + if (ret) { + printf("get_mount_point failed with %s\n", + cgroup_strerror(ret)); + exit(3); + } + + printf("The mount point is %s\n", mount_point); + free(mount_point); + + strcpy(string, "obviouslynonexistsubsys"); + + ret = cgroup_get_subsys_mount_point(string, &mount_point); + + if (!ret) { + printf("get_mount_point failed as it got a " + "non existant subsys\n"); + exit(3); + } + + if (ret == ECGROUPNOTEXIST) { + printf("get_mount_point worked as expected\n"); + return 0; + } + + printf("get_mount_point failed with %s\n", cgroup_strerror(ret)); + + return 3; +}