Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | From 2b5fb416aa275fd2a17a0139a2f783998bcb42cc Mon Sep 17 00:00:00 2001 |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 2 | From: Peter Kjellerstedt <pkj@axis.com> |
| 3 | Date: Fri, 9 Jun 2017 17:50:46 +0200 |
| 4 | Subject: [PATCH] Make ptest run the python tests if python is enabled |
| 5 | |
| 6 | One of the tests (tstLastError.py) needed a minor correction. It might |
| 7 | be due to the fact that the tests are forced to run with Python 3. |
| 8 | |
| 9 | Upstream-Status: Inappropriate [OE specific] |
| 10 | Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 11 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 12 | --- |
| 13 | Makefile.am | 2 +- |
| 14 | python/Makefile.am | 9 +++++++++ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 15 | python/tests/Makefile.am | 10 ++++++++++ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 16 | python/tests/tstLastError.py | 2 +- |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 17 | 4 files changed, 21 insertions(+), 2 deletions(-) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 18 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 19 | diff --git a/Makefile.am b/Makefile.am |
| 20 | index ae62274..bd1e425 100644 |
| 21 | --- a/Makefile.am |
| 22 | +++ b/Makefile.am |
| 23 | @@ -203,9 +203,9 @@ install-ptest: |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 24 | install $(check_PROGRAMS) $(DESTDIR)) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 25 | cp -r $(srcdir)/test $(DESTDIR) |
| 26 | cp -r $(srcdir)/result $(DESTDIR) |
| 27 | - cp -r $(srcdir)/python $(DESTDIR) |
| 28 | cp Makefile $(DESTDIR) |
| 29 | sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile |
| 30 | + $(MAKE) -C python install-ptest |
| 31 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 32 | runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \ |
| 33 | testchar$(EXEEXT) testdict$(EXEEXT) runxmlconf$(EXEEXT) |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 34 | diff --git a/python/Makefile.am b/python/Makefile.am |
| 35 | index 34aed96..ba3ec6a 100644 |
| 36 | --- a/python/Makefile.am |
| 37 | +++ b/python/Makefile.am |
| 38 | @@ -48,7 +48,16 @@ GENERATED = libxml2class.py libxml2class.txt $(BUILT_SOURCES) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 39 | |
| 40 | $(GENERATED): $(srcdir)/generator.py $(API_DESC) |
| 41 | $(PYTHON) $(srcdir)/generator.py $(srcdir) |
| 42 | + |
| 43 | +install-ptest: |
| 44 | + cp -r $(srcdir) $(DESTDIR) |
| 45 | + sed -e 's|^Makefile:|_Makefile:|' \ |
| 46 | + -e 's|^\(tests test:\) all|\1|' Makefile >$(DESTDIR)/python/Makefile |
| 47 | + $(MAKE) -C tests install-ptest |
| 48 | +else |
| 49 | +install-ptest: |
| 50 | endif |
| 51 | |
| 52 | +.PHONY: tests test |
| 53 | tests test: all |
| 54 | cd tests && $(MAKE) tests |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 55 | diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am |
| 56 | index 227e24d..021bb29 100644 |
| 57 | --- a/python/tests/Makefile.am |
| 58 | +++ b/python/tests/Makefile.am |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 59 | @@ -59,6 +59,11 @@ XMLS= \ |
| 60 | CLEANFILES = core tmp.xml *.pyc |
| 61 | |
| 62 | if WITH_PYTHON |
| 63 | +install-ptest: |
| 64 | + cp -r $(srcdir) $(DESTDIR)/python |
| 65 | + sed -e 's|^Makefile:|_Makefile:|' \ |
| 66 | + -e 's|^\(srcdir = \).*|\1.|' Makefile >$(DESTDIR)/python/tests/Makefile |
| 67 | + |
| 68 | tests: $(PYTESTS) |
| 69 | @for f in $(XMLS) ; do test -f $$f || $(LN_S) $(srcdir)/$$f . ; done |
| 70 | @echo "## running Python regression tests" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 71 | @@ -70,9 +75,14 @@ tests: $(PYTESTS) |
| 72 | if [ "$$?" -ne 0 ] ; then \ |
| 73 | echo "-- $$test" ; \ |
| 74 | echo "$$log" ; \ |
| 75 | + echo "FAIL: $$test"; \ |
| 76 | exit 1 ; \ |
| 77 | + else \ |
| 78 | + echo "PASS: $$test"; \ |
| 79 | fi ; \ |
| 80 | done) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 81 | else |
| 82 | +install-ptest: |
| 83 | + |
| 84 | tests: |
| 85 | endif |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 86 | diff --git a/python/tests/tstLastError.py b/python/tests/tstLastError.py |
| 87 | index 81d0acc..162c8db 100755 |
| 88 | --- a/python/tests/tstLastError.py |
| 89 | +++ b/python/tests/tstLastError.py |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 90 | @@ -25,7 +25,7 @@ class TestCase(unittest.TestCase): |
| 91 | when the exception is raised, check the libxml2.lastError for |
| 92 | expected values.""" |
| 93 | # disable the default error handler |
| 94 | - libxml2.registerErrorHandler(None,None) |
| 95 | + libxml2.registerErrorHandler(lambda ctx,str: None,None) |
| 96 | try: |
| 97 | f(*args) |
| 98 | except exc: |