From: Michael Tremer Date: Thu, 17 Oct 2024 18:26:55 +0000 (+0000) Subject: tests: Let Pakfire create its own temporary directories X-Git-Tag: 0.9.30~1023 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=98666917d4f800f593a88ffcb439f6ca30546cf1;p=pakfire.git tests: Let Pakfire create its own temporary directories Signed-off-by: Michael Tremer --- diff --git a/tests/testsuite.c b/tests/testsuite.c index 4f82c1700..b6cb90e77 100644 --- a/tests/testsuite.c +++ b/tests/testsuite.c @@ -37,18 +37,9 @@ static int test_run(int i, struct test* t) { struct pakfire_ctx* ctx = NULL; struct pakfire* p = NULL; FILE* c = NULL; - - char root[PATH_MAX] = TEST_ROOTFS "/pakfire-test-XXXXXX"; int r; - // Create test root directory - char* tmp = pakfire_mkdtemp(root); - if (!tmp) { - LOG("Could not create temporary directory %s: %m\n", root); - exit(1); - } - - LOG("running %s (%s)\n", t->name, root); + LOG("running %s\n", t->name); // Create a new context r = pakfire_ctx_create(&t->ctx, TEST_CONFIG_FILE); @@ -73,9 +64,9 @@ 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, root, NULL, c, 0); - if (r) { - LOG("ERROR: Could not initialize pakfire: %m\n"); + r = pakfire_create(&t->pakfire, t->ctx, NULL, NULL, c, 0); + if (r < 0) { + LOG("ERROR: Could not initialize pakfire: %s\n", strerror(-r)); goto ERROR; } @@ -96,7 +87,7 @@ static int test_run(int i, struct test* t) { // Create a HTTP client (if requested) if (t->flags & TEST_WANTS_HTTPCLIENT) { r = pakfire_httpclient_create(&t->httpclient, t->ctx, NULL); - if (r) { + if (r < 0) { LOG("ERROR: Could not initialize the HTTP client: %s\n", strerror(-r)); goto ERROR; } @@ -144,9 +135,6 @@ ERROR: if (c) fclose(c); - // Cleanup root - pakfire_rmtree(root, 0); - return r; }