From: Michael Tremer Date: Thu, 30 Nov 2017 11:45:31 +0000 (+0100) Subject: testsuite: Initialize pakfire in test directory X-Git-Tag: 0.9.28~1285^2~1240 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4250f96b7d7c55135417879f54ef06b1b326daa5;p=pakfire.git testsuite: Initialize pakfire in test directory Signed-off-by: Michael Tremer --- diff --git a/.gitignore b/.gitignore index 7db670d62..26aa7688a 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ /src/scripts/quality-agent /src/scripts/extract-debuginfo /src/systemd/*.service +/tests/.data /tests/libpakfire/main /tmp *.py[co] diff --git a/Makefile.am b/Makefile.am index e53db9eb2..0b1254d16 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/tests/libpakfire/pakfire.h b/tests/libpakfire/pakfire.h index 82fda5fc7..e42d944f4 100644 --- a/tests/libpakfire/pakfire.h +++ b/tests/libpakfire/pakfire.h @@ -20,8 +20,10 @@ #include +#include "../testsuite.h" + static Pakfire init_pakfire() { - const char* path = "/"; + const char* path = TEST_PATH; return pakfire_create(path, NULL); } diff --git a/tests/testsuite.c b/tests/testsuite.c index 851459b84..b427405dc 100644 --- a/tests/testsuite.c +++ b/tests/testsuite.c @@ -23,6 +23,8 @@ #include #include +const char* TEST_PATH = ABS_TOP_BUILDDIR "/tests/.data"; + int testsuite_init() { // Initialize the pakfire library int r = pakfire_init(); diff --git a/tests/testsuite.h b/tests/testsuite.h index 5e6958f7b..f6dce93e7 100644 --- a/tests/testsuite.h +++ b/tests/testsuite.h @@ -24,6 +24,8 @@ #include #include +extern const char* TEST_PATH; + // Forward declaration struct test;