]> git.ipfire.org Git - pakfire.git/commitdiff
testsuite: Initialize pakfire in test directory
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 30 Nov 2017 11:45:31 +0000 (12:45 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 30 Nov 2017 11:45:31 +0000 (12:45 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
.gitignore
Makefile.am
tests/libpakfire/pakfire.h
tests/testsuite.c
tests/testsuite.h

index 7db670d6237c03f2f8768c5b230b9593f8ae35f3..26aa7688a217a58cfba0f14a45500c12e41a2219 100644 (file)
@@ -9,6 +9,7 @@
 /src/scripts/quality-agent
 /src/scripts/extract-debuginfo
 /src/systemd/*.service
+/tests/.data
 /tests/libpakfire/main
 /tmp
 *.py[co]
index e53db9eb2e8833e118043ae008b393498ce83de0..0b1254d16e54302476136f0e9b138009bbead74f 100644 (file)
@@ -476,6 +476,10 @@ tests_libtestsuite_la_SOURCES = \
        tests/testsuite.c \
        tests/testsuite.h
 
+tests_libtestsuite_la_CPPFLAGS = \
+       $(TESTSUITE_CPPFLAGS) \
+       -DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\"
+
 EXTRA_DIST += \
        tests/libpakfire/pakfire.h
 
index 82fda5fc7240844ffad318554f47dc102603f7a7..e42d944f4e5b274d02e20c9023609111a785818e 100644 (file)
 
 #include <pakfire/pakfire.h>
 
+#include "../testsuite.h"
+
 static Pakfire init_pakfire() {
-    const char* path = "/";
+    const char* path = TEST_PATH;
 
     return pakfire_create(path, NULL);
 }
index 851459b8425499334876b2c2392dc8406f3235aa..b427405dc2a42ec2af1fc5193ca734d0402b91cd 100644 (file)
@@ -23,6 +23,8 @@
 #include <pakfire/logging.h>
 #include <pakfire/pakfire.h>
 
+const char* TEST_PATH = ABS_TOP_BUILDDIR "/tests/.data";
+
 int testsuite_init() {
        // Initialize the pakfire library
        int r = pakfire_init();
index 5e6958f7bdd2cb8c3d816d65c761a2d90c4705a0..f6dce93e7653b9403a8936bc8d8fba1348804062 100644 (file)
@@ -24,6 +24,8 @@
 #include <stdlib.h>
 #include <stdio.h>
 
+extern const char* TEST_PATH;
+
 // Forward declaration
 struct test;