From 4b0d55235cffdf9fef4ebad233d26a67db7d5c2e Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Tue, 23 May 2017 18:07:50 +0200 Subject: [PATCH] Fixed installed unit test --- pyext/Makefile.am | 4 +++- test/Makefile.am | 10 +++++++++- test/test_python_cscripts.py | 13 ++++++------- test/test_python_ctools.py | 11 +++++------ 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/pyext/Makefile.am b/pyext/Makefile.am index 74a6e94..434c721 100755 --- a/pyext/Makefile.am +++ b/pyext/Makefile.am @@ -69,8 +69,10 @@ testdata = $(top_srcdir)/test/data/crab.xml \ $(top_srcdir)/test/data/phased_events.fits.gz \ $(top_srcdir)/test/data/invalid_event_list.fits.gz \ $(top_srcdir)/test/data/model_temporal_phasecurve.xml \ + $(top_srcdir)/test/data/model_temporal_phasecurve.fits \ $(top_srcdir)/test/data/obs_unbinned.xml \ - $(top_srcdir)/test/data/exclusion.reg + $(top_srcdir)/test/data/exclusion.reg \ + $(top_srcdir)/test/data/irf_file.fits.gz # Install test scripts and test data. Note that we don't need to prepend # $(DESTDIR) here (not fully clear why, but that's the way it is) diff --git a/test/Makefile.am b/test/Makefile.am index ccbe4e3..315fac9 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -71,7 +71,15 @@ installcheck-local: @export CTOOLS=$(DESTDIR)$(prefix); \ . $(DESTDIR)$(prefix)/bin/ctools-init.sh; \ python -c 'import ctools; ctools.test()'; \ - python -c 'import cscripts; cscripts.test()' + if test "x$$?" != "x0"; then \ + echo "*** ctools unit test failure!"; \ + exit 1; \ + fi; \ + python -c 'import cscripts; cscripts.test()'; \ + if test "x$$?" != "x0"; then \ + echo "*** cscripts unit test failure!"; \ + exit 1; \ + fi endif # Add Valgrind rule diff --git a/test/test_python_cscripts.py b/test/test_python_cscripts.py index 1daaf4d..b674df8 100755 --- a/test/test_python_cscripts.py +++ b/test/test_python_cscripts.py @@ -168,20 +168,16 @@ def test(installed=False, debug=False): # Run test suite success = suites.run() - # If we have a non-installed version then save test results + # Save test results if not installed: suites.save('reports/cscripts.xml') + else: + suites.save('cscripts_reports.xml') # If debuging is requested then print test suites if debug: print(suites) - # Set return code - if success: - rc = 0 - else: - rc = 1 - # Remove temporary direction if installed: os.system('rm -rf %s' % (path)) @@ -190,6 +186,9 @@ def test(installed=False, debug=False): if not success: raise RuntimeError('At least one error occured during the test.') + # Return + return + # ======================== # # Main routine entry point # diff --git a/test/test_python_ctools.py b/test/test_python_ctools.py index 18c98d5..48771af 100755 --- a/test/test_python_ctools.py +++ b/test/test_python_ctools.py @@ -133,15 +133,11 @@ def test(installed=False): # Run test suite success = suites.run() - # If we have a non-installed version then save test results + # Save test results if not installed: suites.save('reports/ctools.xml') - - # Set return code - if success: - rc = 0 else: - rc = 1 + suites.save('ctools_reports.xml') # Remove temporary direction if installed: @@ -151,6 +147,9 @@ def test(installed=False): if not success: raise RuntimeError('At least one error occured during the test.') + # Return + return + # ======================== # # Main routine entry point # -- libgit2 0.21.4