summaryrefslogtreecommitdiffstats
path: root/tests/get_mount_point.c
diff options
context:
space:
mode:
authorDhaval Giani <dhaval@linux.vnet.ibm.com>2009-06-26 23:16:22 +0530
committerDhaval Giani <dhaval@linux.vnet.ibm.com>2009-06-26 23:16:22 +0530
commit7620ff3e067b8d77ddf321d81b4b19adc2729f6b (patch)
tree0db5afe41cb368a57efa7a2b61ce053ef86a5150 /tests/get_mount_point.c
parent305fdb705e4eca50f3dc18d7cc685b547ce0ee98 (diff)
downloadlibcg-7620ff3e067b8d77ddf321d81b4b19adc2729f6b.tar.gz
libcg-7620ff3e067b8d77ddf321d81b4b19adc2729f6b.tar.xz
libcg-7620ff3e067b8d77ddf321d81b4b19adc2729f6b.zip
libcgroup: Add get_mount_point test case
The test case to test the new mount point API. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Diffstat (limited to 'tests/get_mount_point.c')
-rw-r--r--tests/get_mount_point.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/get_mount_point.c b/tests/get_mount_point.c
new file mode 100644
index 0000000..b372092
--- /dev/null
+++ b/tests/get_mount_point.c
@@ -0,0 +1,49 @@
+#include <libcgroup.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+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;
+}