From 3e936d6761e98dcd4f62111f263ddc9d61303e45 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 30 Nov 2017 14:15:10 +0100 Subject: [PATCH] testsuite: Cleanup properly after we have run the testsuite Signed-off-by: Michael Tremer --- Makefile.am | 15 ++++++++++++--- tests/libpakfire/main.c | 2 +- tests/testsuite.c | 3 +-- tests/testsuite.h | 1 - 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index 6be3a5223..bb6ccee2b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -43,6 +43,8 @@ macrosdir = $(prefix)/lib/pakfire/macros qualityagentdir = $(prefix)/lib/quality-agent scriptsdir = $(prefix)/lib/$(PACKAGE_NAME) +TEST_ROOTFS = $(abs_top_builddir)/.root + CLEANFILES = DISTCLEANFILES = EXTRA_DIST = @@ -70,6 +72,8 @@ DISTCHECK_CONFIGURE_FLAGS = \ @INTLTOOL_POLICY_RULE@ +clean-local: clean-local-check + .PHONY: update-po update-po: $(MAKE) -C po update-po @@ -330,7 +334,8 @@ dist_tests_libpakfire_main_SOURCES = \ tests/libpakfire/main.c tests_libpakfire_main_CPPFLAGS = \ - $(TESTSUITE_CPPFLAGS) + $(TESTSUITE_CPPFLAGS) \ + -DTEST_ROOTFS=\"$(TEST_ROOTFS)\" tests_libpakfire_main_LDADD = \ $(TESTSUITE_LDADD) \ @@ -501,8 +506,8 @@ tests_libtestsuite_la_SOURCES = \ tests_libtestsuite_la_CPPFLAGS = \ $(TESTSUITE_CPPFLAGS) \ - -DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\" \ - -DABS_TOP_SRCDIR=\"$(abs_top_srcdir)\" + -DABS_TOP_SRCDIR=\"$(abs_top_srcdir)\" \ + -DTEST_ROOTFS=\"$(TEST_ROOTFS)\" TESTSUITE_CPPFLAGS = \ $(AM_CPPFLAGS) \ @@ -527,3 +532,7 @@ TESTS = \ EXTRA_DIST += \ tests/data/726D8B0B0889B04E.key \ tests/data/beep-1.3-2.ip3.x86_64.pfm + +.PHONY: clean-local-check +clean-local-check: + -rm -rf $(TEST_ROOTFS) diff --git a/tests/libpakfire/main.c b/tests/libpakfire/main.c index 018bbc7e5..9927572d8 100644 --- a/tests/libpakfire/main.c +++ b/tests/libpakfire/main.c @@ -32,7 +32,7 @@ static int test_init(const test_t* t) { static int test_path(const test_t* t) { const char* path = pakfire_get_path(t->pakfire); - assert_return(strcmp(path, TEST_PATH) == 0, EXIT_FAILURE); + assert_return(strcmp(path, TEST_ROOTFS) == 0, EXIT_FAILURE); return EXIT_SUCCESS; } diff --git a/tests/testsuite.c b/tests/testsuite.c index 64d4f27d2..0bdece7a6 100644 --- a/tests/testsuite.c +++ b/tests/testsuite.c @@ -24,7 +24,6 @@ #include const char* TEST_SRC_PATH = ABS_TOP_SRCDIR "/tests"; -const char* TEST_PATH = ABS_TOP_BUILDDIR "/tests/.data"; int testsuite_init() { // Initialize the pakfire library @@ -41,7 +40,7 @@ int testsuite_init() { static int test_run(test_t* t) { LOG("running %s\n", t->name); - t->pakfire = pakfire_create(TEST_PATH, NULL); + t->pakfire = pakfire_create(TEST_ROOTFS, NULL); assert_return(t->pakfire, EXIT_FAILURE); int r = t->func(t); diff --git a/tests/testsuite.h b/tests/testsuite.h index 13f540df4..417075580 100644 --- a/tests/testsuite.h +++ b/tests/testsuite.h @@ -27,7 +27,6 @@ #include extern const char* TEST_SRC_PATH; -extern const char* TEST_PATH; // Forward declaration struct test; -- 2.39.5