Skip to contentSkip to conversation

tests: Makefile.am (Work in Progress)

PATCH New Shekhar Sharma 1 participant 1 message Jun 14, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: Makefile.am (Work in Progress)

I have been trying to make a Makefile.am for the tests in nftables so that all of them run when 'make check' is used.To do this, i have done the following changes:
1. add AM_PATH_PYTHON statement to configure.ac
2. add tests in the SUBDIRS in Makefile.am
3. add a Makefile.am file in the tests directory

For now this is just for the two python tests, other tests will be added later.

Whenever i copy the .py test files from tests/json_echo and tests/py and paste them in the tests/ directory, the Makefile.am runs and generates a report. But if the .py files remain where they are and are not copied, the Makefile.am fails to run.

I am not sure why. I have already specified there correct location in the Makefile.am.

Result when the two files are copied in tests directory:

Making check in tests
make[1]: Entering directory '/home/shekhar/at1_nftables/tests' make check-TESTS
make[2]: Entering directory '/home/shekhar/at1_nftables/tests' make[3]: Entering directory '/home/shekhar/at1_nftables/tests'
FAIL: run-test.py
PASS: nft-test.py
============================================================================
Testsuite summary for nftables 0.9.0
============================================================================
# TOTAL: 2
# PASS: 1
# SKIP: 0
# XFAIL: 0
# FAIL: 1
# XPASS: 0
# ERROR: 0
============================================================================
See tests/test-suite.log
Please report to [email protected]
============================================================================
Makefile:592: recipe for target 'test-suite.log' failed make[3]: *** [test-suite.log] Error 1
make[3]: Leaving directory '/home/shekhar/at1_nftables/tests' Makefile:698: recipe for target 'check-TESTS' failed make[2]: *** [check-TESTS] Error 2
make[2]: Leaving directory '/home/shekhar/at1_nftables/tests' Makefile:778: recipe for target 'check-am' failed make[1]: *** [check-am] Error 2
make[1]: Leaving directory '/home/shekhar/at1_nftables/tests' Makefile:494: recipe for target 'check-recursive' failed
make: *** [check-recursive] Error 1

=============================================================================

Result when they remain where they are:

Making check in tests
make[1]: Entering directory '/home/shekhar/at1_nftables/tests' make check-TESTS
make[2]: Entering directory '/home/shekhar/at1_nftables/tests' make[3]: Entering directory '/home/shekhar/at1_nftables/tests' /usr/bin/python json_echo/run-test.py
Error: flush ruleset failed: Error: syntax error, unexpected '{' {"nftables": [{"flush": {"ruleset": null}}]}
^

Makefile:903: recipe for target 'run-test.py' failed make[3]: *** [run-test.py] Error 1
make[3]: Leaving directory '/home/shekhar/at1_nftables/tests' Makefile:698: recipe for target 'check-TESTS' failed make[2]: *** [check-TESTS] Error 2
make[2]: Leaving directory '/home/shekhar/at1_nftables/tests' Makefile:778: recipe for target 'check-am' failed make[1]: *** [check-am] Error 2
make[1]: Leaving directory '/home/shekhar/at1_nftables/tests' Makefile:494: recipe for target 'check-recursive' failed
make: *** [check-recursive] Error 1

---
 Makefile.am       |  4 +++-
 configure.ac      |  3 +++
 tests/Makefile.am | 19 +++++++++++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 tests/Makefile.am
Makefile.am +3 -1
index e567d32d..adccf7ff 100644
@@ -4,10 +4,12 @@ SUBDIRS = 	src	\
 		include	\
 		files	\
 		doc		\
-		py
+		py	\
+		tests
 
 EXTRA_DIST =	tests	\
 		files
 
+
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libnftables.pc
configure.ac +3 -0
index e3c0be2b..04ad1180 100644
@@ -21,6 +21,8 @@ AC_ARG_ENABLE([man-doc],
 	      [], [enable_man_doc=yes])
 AM_CONDITIONAL([BUILD_MAN], [test "x$enable_man_doc" = "xyes" ])
 
+AM_PATH_PYTHON([1.0])
+
 # Checks for programs.
 AC_PROG_CC
 AC_PROG_MKDIR_P
@@ -126,6 +128,7 @@ AC_CONFIG_FILES([					\
 		files/osf/Makefile			\
 		doc/Makefile				\
 		py/Makefile				\
+		tests/Makefile				\
 		])
 AC_OUTPUT
 
tests/Makefile.am new file +19 -0
new file mode 100644
index 00000000..6b87af9e
@@ -0,0 +1,19 @@
+
+checkdir=tests 
+
+python_PYTHON= run-test.py nft-test.py
+
+
+run-test.py: 
+	$(PYTHON) json_echo/run-test.py
+
+nft-test.py: 
+	$(PYTHON) py/nft-test.py
+	
+
+##run_test_py_SOURCES=json_echo/run-test.py
+
+##nft_test_py_SOURCES=py/nft-test.py
+
+TESTS= $(python_PYTHON)
+ 
Signature · 1 line
2.17.1