* [PATCH WIP v1]tests: Makefile.am (Work in Progress)
@ 2019-06-14 17:07 Shekhar Sharma
0 siblings, 0 replies; only message in thread
From: Shekhar Sharma @ 2019-06-14 17:07 UTC (permalink / raw)
To: netfilter-devel; +Cc: Shekhar Sharma
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 netfilter-devel@vger.kernel.org
============================================================================
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
Signed-off-by: Shekhar Sharma <shekhar250198@gmail.com>
---
Makefile.am | 4 +++-
configure.ac | 3 +++
tests/Makefile.am | 19 +++++++++++++++++++
3 files changed, 25 insertions(+), 1 deletion(-)
create mode 100644 tests/Makefile.am
diff --git a/Makefile.am b/Makefile.am
index e567d32d..adccf7ff 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,10 +4,12 @@ SUBDIRS = src \
include \
files \
doc \
- py
+ py \
+ tests
EXTRA_DIST = tests \
files
+
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libnftables.pc
diff --git a/configure.ac b/configure.ac
index e3c0be2b..04ad1180 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 00000000..6b87af9e
--- /dev/null
+++ b/tests/Makefile.am
@@ -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)
+
--
2.17.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-06-14 17:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-14 17:07 [PATCH WIP v1]tests: Makefile.am (Work in Progress) Shekhar Sharma
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).