]> git.ipfire.org Git - pakfire.git/commitdiff
tests: jail: Actually run a useful command
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 9 Aug 2022 13:35:37 +0000 (13:35 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 9 Aug 2022 13:35:37 +0000 (13:35 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
tests/libpakfire/jail.c

index cb847745b90e6d09d057b10feb819ecf2e54acce..c502b6ae198baabea4abcd84fab8448760cc90d0 100644 (file)
@@ -23,8 +23,8 @@
 
 #include "../testsuite.h"
 
-static const char* cmd[2] = {
-       "/usr/bin/does-not-exist",
+static const char* cmd_hello_world[] = {
+       "/command", "echo", "Hello World!", NULL,
 };
 
 static int test_create(const struct test* t) {
@@ -79,16 +79,11 @@ FAIL:
 static int test_exec(const struct test* t) {
        struct pakfire_jail* jail = NULL;
 
-       const char* argv[] = {
-               "/does-not-exist",
-               NULL,
-       };
-
        // Create a new jail
        ASSERT_SUCCESS(pakfire_jail_create(&jail, t->pakfire, 0));
 
        // Try to execute something
-       ASSERT(pakfire_jail_exec(jail, argv, NULL) == 127);
+       ASSERT_SUCCESS(pakfire_jail_exec(jail, cmd_hello_world, NULL));
 
        // Destroy it
        ASSERT_NULL(pakfire_jail_unref(jail));
@@ -114,7 +109,7 @@ static int test_launch_into_cgroup(const struct test* t) {
        ASSERT_SUCCESS(pakfire_jail_set_cgroup(jail, cgroup));
 
        // Run command
-       ASSERT(pakfire_jail_exec(jail, cmd, NULL) == 0);
+       ASSERT(pakfire_jail_exec(jail, cmd_hello_world, NULL) == 0);
 
        r = EXIT_SUCCESS;