[libnetfilter_conntrack PATCH 2/2] tests: Add simple tests to TESTS variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This way, 'make check' and 'make distcheck' call them. Omit
ct_stress/ct_events_reliable, they require root.

For test_connlabel to find qa-connlabel.conf during 'make distcheck',
use of 'srcdir' env variable is needed. Add this as a third option to
not break existing use-cases.

Signed-off-by: Phil Sutter <phil@xxxxxx>
---
 tests/Makefile.am      | 2 ++
 tests/test_connlabel.c | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 56c78d9424326..16fbe6a77aa6d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -5,6 +5,8 @@ check_PROGRAMS = test_api test_filter test_connlabel ct_stress \
 
 EXTRA_DIST = qa-connlabel.conf
 
+TESTS = test_api test_filter test_connlabel
+
 test_api_SOURCES = test_api.c
 test_api_LDADD = ../src/libnetfilter_conntrack.la
 
diff --git a/tests/test_connlabel.c b/tests/test_connlabel.c
index 99b1171857db3..f6f222b309a84 100644
--- a/tests/test_connlabel.c
+++ b/tests/test_connlabel.c
@@ -1,4 +1,5 @@
 #include <assert.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <time.h>
@@ -60,6 +61,13 @@ int main(void)
 	l = nfct_labelmap_new("qa-connlabel.conf");
 	if (!l)
 		l = nfct_labelmap_new("tests/qa-connlabel.conf");
+	if (!l) {
+		char testconf[PATH_MAX];
+
+		snprintf(testconf, PATH_MAX,
+			 "%s/qa-connlabel.conf", getenv("srcdir"));
+		l = nfct_labelmap_new(testconf);
+	}
 	assert(l);
 	puts("qa-connlabel.conf:");
 	dump_map(l);
-- 
2.34.1




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux