From 47c8300023b7fb387cbb65d90d7153b4cb907484 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Mon, 21 Oct 2019 11:57:47 +0200 Subject: [PATCH] Make sure that Python tests exit with error code --- python/tests/Makefile.am | 11 ++++++++--- python/tests/basic.py | 1 + python/tests/exslt.py | 1 + python/tests/extelem.py | 1 + python/tests/extfunc.py | 1 + 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am index f757774f..cb186745 100644 --- a/python/tests/Makefile.am +++ b/python/tests/Makefile.am @@ -19,10 +19,15 @@ CLEANFILES = *.pyc core if WITH_PYTHON tests: $(TESTSPY) - -@(PYTHONPATH="`pwd`/..:`pwd`/../.libs:$(srcdir)/.."; \ - if test "x$(LIBXML_SRC)" != "x" ; then PYTHONPATH="$$PYTHONPATH:$(LIBXML_SRC)/python:$(LIBXML_SRC)/python/.libs"; fi; \ + @(PYTHONPATH="`pwd`/..:`pwd`/../.libs:$(srcdir)/.."; \ + if test "x$(LIBXML_SRC)" != "x" ; then \ + PYTHONPATH="$$PYTHONPATH:$(LIBXML_SRC)/python:$(LIBXML_SRC)/python/.libs"; \ + fi; \ export PYTHONPATH; \ - for test in $(TESTSPY) ; do echo "-- $$test" ; (cd $(srcdir) && $(PYTHON) $$test ); done) + for test in $(TESTSPY) ; do \ + echo "-- $$test" ; \ + (cd $(srcdir) && $(PYTHON) $$test ) || exit 1; \ + done) else tests: endif diff --git a/python/tests/basic.py b/python/tests/basic.py index 89a57ac1..4a60590b 100755 --- a/python/tests/basic.py +++ b/python/tests/basic.py @@ -27,3 +27,4 @@ if libxml2.debugMemory(1) == 0: else: print "Memory leak %d bytes" % (libxml2.debugMemory(1)) libxml2.dumpMemory() + sys.exit(255) diff --git a/python/tests/exslt.py b/python/tests/exslt.py index c64b2e43..c7333efb 100755 --- a/python/tests/exslt.py +++ b/python/tests/exslt.py @@ -54,3 +54,4 @@ if libxml2.debugMemory(1) == 0: else: print "Memory leak %d bytes" % (libxml2.debugMemory(1)) libxml2.dumpMemory() + sys.exit(255) diff --git a/python/tests/extelem.py b/python/tests/extelem.py index 3364d01a..16635174 100644 --- a/python/tests/extelem.py +++ b/python/tests/extelem.py @@ -87,3 +87,4 @@ if libxml2.debugMemory(1) == 0: else: print "Memory leak %d bytes" % (libxml2.debugMemory(1)) libxml2.dumpMemory() + sys.exit(255) diff --git a/python/tests/extfunc.py b/python/tests/extfunc.py index 0a559531..fc6040b3 100755 --- a/python/tests/extfunc.py +++ b/python/tests/extfunc.py @@ -64,3 +64,4 @@ if libxml2.debugMemory(1) == 0: else: print "Memory leak %d bytes" % (libxml2.debugMemory(1)) libxml2.dumpMemory() + sys.exit(255)