From: Michael Tremer Date: Fri, 18 Oct 2024 16:17:16 +0000 (+0000) Subject: tests: Make Pakfire operate in the stub root all the time X-Git-Tag: 0.9.30~1001 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8ed3315e4864a1eeeb4dbfe30841453a0d921db0;p=pakfire.git tests: Make Pakfire operate in the stub root all the time This makes it easier than bind-mounting the command. Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 5f31c49fc..91d82ae75 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1082,7 +1082,6 @@ TESTSUITE_CPPFLAGS = \ -DTEST_CONFIG_FILE=\"$(abs_top_srcdir)/contrib/config/pakfire.conf\" \ -DTEST_DATA_DIR=\"$(abs_top_srcdir)/tests/data\" \ -DTEST_ROOTFS=\"$(TEST_ROOTFS)\" \ - -DTEST_STUB_COMMAND=\"$(abs_top_builddir)/tests/stub/root/command\" \ -DTEST_STUB_ROOT=\"$(TEST_STUB_ROOT)\" \ -DPAKFIRE_PRIVATE diff --git a/tests/libpakfire/main.c b/tests/libpakfire/main.c index af0059bd4..5ac1a7df3 100644 --- a/tests/libpakfire/main.c +++ b/tests/libpakfire/main.c @@ -25,12 +25,8 @@ static int test_init(const struct test* t) { LOG("Allocated at %p\n", t->pakfire); - return EXIT_SUCCESS; -} - -static int test_path(const struct test* t) { - const char* path = pakfire_get_path(t->pakfire); - ASSERT_STRING_STARTSWITH(path, TEST_ROOTFS); + // Check if the path matches + ASSERT_STRING_EQUALS(pakfire_get_path(t->pakfire), TEST_STUB_ROOT); return EXIT_SUCCESS; @@ -40,7 +36,6 @@ FAIL: int main(int argc, const char* argv[]) { testsuite_add_test(test_init, TEST_WANTS_PAKFIRE); - testsuite_add_test(test_path, TEST_WANTS_PAKFIRE); return testsuite_run(argc, argv); } diff --git a/tests/testsuite.c b/tests/testsuite.c index b6cb90e77..3e3304dab 100644 --- a/tests/testsuite.c +++ b/tests/testsuite.c @@ -64,7 +64,7 @@ static int test_run(int i, struct test* t) { // Create a pakfire instance (if requested) if (t->flags & TEST_WANTS_PAKFIRE) { - r = pakfire_create(&t->pakfire, t->ctx, NULL, NULL, c, 0); + r = pakfire_create(&t->pakfire, t->ctx, TEST_STUB_ROOT, NULL, c, 0); if (r < 0) { LOG("ERROR: Could not initialize pakfire: %s\n", strerror(-r)); goto ERROR; @@ -75,13 +75,6 @@ static int test_run(int i, struct test* t) { LOG("ERROR: Pakfire was not initialized, but no error was raised: %m\n"); goto ERROR; } - - // Copy command into environment - r = pakfire_bind(t->pakfire, TEST_STUB_COMMAND, "/command", 0); - if (r) { - LOG("ERROR: Could not copy command: %m\n"); - goto ERROR; - } } // Create a HTTP client (if requested)