Blob Blame History Raw
From 7df0987d2373df664cee3014ac0ad94186ac7acb Mon Sep 17 00:00:00 2001
From: Ernestas Kulik <ekulik@redhat.com>
Date: Mon, 4 Feb 2019 10:12:04 +0100
Subject: [PATCH] =?UTF-8?q?tests:=20forbidden=5Fwords:=20Don=E2=80=99t=20h?=
 =?UTF-8?q?ardcode=20sysconfdir?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

As it may not necessarily be /etc (an example would be rpmbuild, where
it can become /usr/local/etc or somesuch), it would make more sense to
do the same thing libreport does - define $sysconfdir in a macro.

Signed-off-by: Ernestas Kulik <ekulik@redhat.com>
---
 tests/Makefile.am        | 3 +++
 tests/forbidden_words.at | 2 +-
 tests/local.at           | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 89d5f694..d46d5772 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -29,6 +29,9 @@ libreport_include_helpers_HEADERS = \
 	helpers/testsuite.h \
 	helpers/testsuite_tools.h
 
+TESTSUITEFLAGS = \
+    CPPFLAGS='-DCONF_DIR="$(CONF_DIR)" $(CPPFLAGS)'
+
 TESTSUITE_AT = \
   local.at \
   testsuite.at \
diff --git a/tests/forbidden_words.at b/tests/forbidden_words.at
index 259ebc1d..a6c0193d 100644
--- a/tests/forbidden_words.at
+++ b/tests/forbidden_words.at
@@ -34,7 +34,7 @@ TS_MAIN
     {
         dynamic_words = load_words_from_file("test_ignored.conf");
     }
-    TS_ASSERT_STDERR_EQ_END("Can't open /etc/libreport/test_ignored.conf: No such file or directory\n", "User notified about errors!");
+    TS_ASSERT_STDERR_EQ_END("Can't open " CONF_DIR "/test_ignored.conf: No such file or directory\n", "User notified about errors!");
 
     TS_ASSERT_PTR_IS_NOT_NULL(dynamic_words);
 
diff --git a/tests/local.at b/tests/local.at
index 00e088ff..3a181239 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -6,7 +6,7 @@
 # Compile SOURCES into OUTPUT.  If OUTPUT does not contain '.',
 # assume that we are linking too; this is a hack.
 m4_define([AT_COMPILE],
-[AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS m4_bmatch([$1], [[.]], [], [$LDFLAGS ])-o $1 m4_default([$2], [$1.c])[]m4_bmatch([$1], [[.]], [], [ $LIBS])],
+[AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $CPPFLAGS m4_bmatch([$1], [[.]], [], [$LDFLAGS ])-o $1 m4_default([$2], [$1.c])[]m4_bmatch([$1], [[.]], [], [ $LIBS])],
           0, [ignore], [ignore])])
 
 # ------------------------
-- 
2.20.1