# #
#############################################################################*/
+#include <pakfire/cgroup.h>
#include <pakfire/jail.h>
#include "../testsuite.h"
return EXIT_FAILURE;
}
+static int test_launch_into_cgroup(const struct test* t) {
+ struct pakfire_cgroup* cgroup = NULL;
+ struct pakfire_jail* jail = NULL;
+ int r = EXIT_FAILURE;
+
+ // Create a new cgroup
+ ASSERT_SUCCESS(pakfire_cgroup_open(&cgroup, t->pakfire, "pakfire-test", 0));
+
+ // Create a new jail
+ ASSERT_SUCCESS(pakfire_jail_create(&jail, t->pakfire, 0));
+
+ // Connect jail to the cgroup
+ ASSERT_SUCCESS(pakfire_jail_set_cgroup(jail, cgroup));
+
+ // Run command
+ ASSERT(pakfire_jail_exec(jail, cmd, NULL) == 0);
+
+ r = EXIT_SUCCESS;
+
+FAIL:
+ if (cgroup) {
+ pakfire_cgroup_destroy(cgroup);
+ pakfire_cgroup_unref(cgroup);
+ }
+ if (jail)
+ pakfire_jail_unref(jail);
+
+ return r;
+}
+
int main(int argc, char** argv) {
testsuite_add_test(test_create);
testsuite_add_test(test_env);
testsuite_add_test(test_exec);
+ testsuite_add_test(test_launch_into_cgroup);
return testsuite_run();
}