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