Blob Blame History Raw
From 8d2f8e36353fc23c198d06fd7bbcb2835d973d41 Mon Sep 17 00:00:00 2001
From: Eric Garver <eric@garver.life>
Date: Tue, 8 Oct 2019 16:50:28 -0400
Subject: [PATCH 117/122] fix: build: distribute testsuite

Make some build changes that allow distributing the testsuite. User will
still need to run ./configure to generate atconfig and atlocal, but they
won't need autoconf installed anymore.

(cherry picked from commit 374f9411106b80b4d333053936b1582eeb4fab96)
(cherry picked from commit 077eadda76bc6d9e4b433027ab2371ca781e69ab)
---
 .gitignore             |  1 +
 configure.ac           |  1 +
 src/tests/Makefile.am  | 17 ++++++-----------
 src/tests/atlocal.in   |  6 ++++++
 src/tests/functions.at |  6 +++---
 5 files changed, 17 insertions(+), 14 deletions(-)
 create mode 100644 src/tests/atlocal.in

diff --git a/.gitignore b/.gitignore
index a0f455d7bf28..11e257f5f0b0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,6 +39,7 @@
 /src/firewall-offline-cmd
 /src/firewalld
 /src/tests/atconfig
+/src/tests/atlocal
 /src/tests/package.m4
 /src/tests/testsuite*
 Makefile
diff --git a/configure.ac b/configure.ac
index 1f8f8dff07ae..ea5d1d72009e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -170,6 +170,7 @@ AC_CONFIG_FILES([Makefile
 		 src/firewall/config/__init__.py
 		 src/Makefile
 		 src/tests/Makefile
+		 src/tests/atlocal
 		 src/icons/Makefile])
 
 m4_foreach([FILE], [[src/firewall-applet],
diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am
index 9a0352bcab05..cfb80aa0c8c0 100644
--- a/src/tests/Makefile.am
+++ b/src/tests/Makefile.am
@@ -8,7 +8,8 @@ EXTRA_DIST = \
 	$(TESTSUITE) \
 	$(TESTSUITE_FILES) \
 	$(wildcard $(srcdir)/python/*.py) \
-	$(srcdir)/package.m4
+	$(srcdir)/package.m4 \
+	atlocal.in
 
 DISTCLEANFILES = atconfig
 
@@ -18,23 +19,17 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac $(top_srcdir)/firewalld.spec $(
 	echo 'm4_define([AT_PACKAGE_VERSION],[$(PACKAGE_VERSION)])' && \
 	echo 'm4_define([AT_PACKAGE_STRING],[$(PACKAGE_STRING)])' && \
 	echo 'm4_define([AT_PACKAGE_URL],[http://firewalld.org/])' && \
-	echo 'm4_define([AT_PACKAGE_BUGREPORT],[https://github.com/firewalld/firewalld])' && \
-	echo 'm4_define([IPTABLES],[$(IPTABLES)])' && \
-	echo 'm4_define([IPTABLES_RESTORE],[$(IPTABLES_RESTORE)])' && \
-	echo 'm4_define([IP6TABLES],[$(IP6TABLES)])' && \
-	echo 'm4_define([IP6TABLES_RESTORE],[$(IP6TABLES_RESTORE)])' ; \
+	echo 'm4_define([AT_PACKAGE_BUGREPORT],[https://github.com/firewalld/firewalld])' ; \
 	} > "$@"
 
-check-local: atconfig $(TESTSUITE)
+check-local: atconfig atlocal $(TESTSUITE)
 	$(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS) \
 		AUTOTEST_PATH="src" \
-		PYTHON="$(PYTHON)" \
 		PYTHONPATH="${abs_top_srcdir}/src:${PYTHONPATH}" \
 		FIREWALLD_DEFAULT_CONFIG="${abs_top_srcdir}/config"
 
-installcheck-local: atconfig $(TESTSUITE)
-	$(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS) \
-		PYTHON="$(PYTHON)"
+installcheck-local: atconfig atlocal $(TESTSUITE)
+	$(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS)
 
 clean-local:
 	test ! -f '$(TESTSUITE)' || $(SHELL) '$(TESTSUITE)' --clean
diff --git a/src/tests/atlocal.in b/src/tests/atlocal.in
new file mode 100644
index 000000000000..474685515437
--- /dev/null
+++ b/src/tests/atlocal.in
@@ -0,0 +1,6 @@
+export PYTHON=@PYTHON@
+
+export IPTABLES=@IPTABLES@
+export IPTABLES_RESTORE=@IPTABLES_RESTORE@
+export IP6TABLES=@IP6TABLES@
+export IP6TABLES_RESTORE=@IP6TABLES_RESTORE@
diff --git a/src/tests/functions.at b/src/tests/functions.at
index 17ca6c9fc052..debabba8b8eb 100644
--- a/src/tests/functions.at
+++ b/src/tests/functions.at
@@ -244,7 +244,7 @@ m4_define([EBTABLES_LIST_RULES], [
 
 m4_define([IPTABLES_LIST_RULES_ALWAYS], [
     m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [], [
-        NS_CHECK([IPTABLES -w -n -t $1 -L $2 | TRIM_WHITESPACE | tail -n +3], [$3], [m4_strip([$4])], [m4_strip([$5])], [$6], [$7])
+        NS_CHECK([$IPTABLES -w -n -t $1 -L $2 | TRIM_WHITESPACE | tail -n +3], [$3], [m4_strip([$4])], [m4_strip([$5])], [$6], [$7])
     ])
 ])
 
@@ -257,7 +257,7 @@ m4_define([IPTABLES_LIST_RULES], [
 m4_define([IP6TABLES_LIST_RULES_ALWAYS], [
     m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [], [
     m4_if(yes, HOST_SUPPORTS_IP6TABLES, [
-        NS_CHECK([IP6TABLES -w -n -t $1 -L $2 | TRIM_WHITESPACE | tail -n +3], [$3], [m4_strip([$4])], [m4_strip([$5])], [$6], [$7])
+        NS_CHECK([$IP6TABLES -w -n -t $1 -L $2 | TRIM_WHITESPACE | tail -n +3], [$3], [m4_strip([$4])], [m4_strip([$5])], [$6], [$7])
     ])
     ])
 ])
@@ -425,7 +425,7 @@ m4_define([CHECK_MODULE_PROTO_GRE], [
 m4_define([NFT_NUMERIC_ARGS], m4_esyscmd([nft -h |grep "numeric-protocol" >/dev/null && echo -n "" || { echo -n "-" && echo -n "nn"; } ]))
 
 m4_define([HOST_SUPPORTS_IP6TABLES], m4_esyscmd(
-    if IP6TABLES -L >/dev/null 2>&1; then
+    if $IP6TABLES -L >/dev/null 2>&1; then
         echo -n "yes"
     else
         echo -n "no"
-- 
2.23.0