"/command", "fork-bomb", NULL,
};
+static const char* cmd_stat_ownership[] = {
+ "/command", "stat-ownership", NULL,
+};
+
static int test_create(const struct test* t) {
struct pakfire_jail* jail = NULL;
struct pakfire_jail* jail = NULL;
int r = EXIT_FAILURE;
-
// Create cgroup
ASSERT_SUCCESS(pakfire_cgroup_open(&cgroup, t->pakfire, "pakfire-test", 0));
return r;
}
+static int test_file_ownership(const struct test* t) {
+ int r = EXIT_FAILURE;
+ char* output = NULL;
+
+ // Execute a simple command
+ ASSERT_SUCCESS(pakfire_jail_run(t->pakfire, cmd_stat_ownership, 0, &output));
+
+ // Check if the file has been mapped to root/root
+ ASSERT_STRING_EQUALS(output, "uid=0 gid=0\n");
+
+ // Success
+ r = EXIT_SUCCESS;
+
+FAIL:
+ if (output)
+ free(output);
+
+ return r;
+}
+
int main(int argc, const char* argv[]) {
testsuite_add_test(test_create);
testsuite_add_test(test_env);
testsuite_add_test(test_nice);
testsuite_add_test(test_memory_limit);
testsuite_add_test(test_pid_limit);
+ testsuite_add_test(test_file_ownership);
return testsuite_run(argc, argv);
}