LDADD = $(top_srcdir)/src/.libs/libcgroup.la
# compile the tests, but do not install them
-noinst_PROGRAMS = libcgrouptest01 libcg_ba setuid pathtest walk_test read_stats walk_task get_controller get_mount_point proctest get_all_controller get_variable_names
+noinst_PROGRAMS = libcgrouptest01 libcg_ba setuid pathtest walk_test read_stats walk_task get_controller get_mount_point proctest get_all_controller get_variable_names test_named_hierarchy
libcgrouptest01_SOURCES=libcgrouptest01.c test_functions.c libcgrouptest.h
libcg_ba_SOURCES=libcg_ba.cpp
proctest_SOURCES=proctest.c
get_all_controller_SOURCES=get_all_controller.c
get_variable_names_SOURCES=get_variable_names.c
+test_named_hierarchy_SOURCES=test_named_hierarchy.c
EXTRA_DIST = pathtest.sh runlibcgrouptest.sh
--- /dev/null
+#include <stdio.h>
+#include <libcgroup.h>
+
+/*
+ * Assumes cgroup is mounted at /cgroup using
+ *
+ * mount -t cgroup -o none,name=test none /cgroup
+ */
+int main()
+{
+ int ret;
+ struct cgroup *cgroup;
+ struct cgroup_controller *cgc;
+
+ ret = cgroup_init();
+ if (ret) {
+ printf("FAIL: cgroup_init failed with %s\n", cgroup_strerror(ret));
+ exit(3);
+ }
+
+ cgroup = cgroup_new_cgroup("test");
+ if (!cgroup) {
+ printf("FAIL: cgroup_new_cgroup failed\n");
+ exit(3);
+ }
+
+ cgc = cgroup_add_controller(cgroup, "name=test");
+ if (!cgc) {
+ printf("FAIL: cgroup_add_controller failed\n");
+ exit(3);
+ }
+
+ ret = cgroup_create_cgroup(cgroup, 1);
+ if (ret) {
+ printf("FAIL: cgroup_create_cgroup failed with %s\n", cgroup_strerror(ret));
+ exit(3);
+ }
+
+ if (access("/cgroup/test", F_OK))
+ printf("PASS\n");
+ else
+ printf("Failed to create cgroup\n");
+
+ return 0;
+}