From ff3b8957409b339211e64d10eb2439558fa64fac Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Tue, 30 May 2017 09:30:14 +0200 Subject: [PATCH] Cherry-pick same changes for release 1.2.1 --- pyext/Makefile.am | 8 +++++++- src/ctexpcube/main.cpp | 3 --- test/Makefile.am | 10 +++++++++- test/test_examples.py.in | 4 +++- test/test_python_cscripts.py | 17 +++++++++-------- test/test_python_ctools.py | 17 +++++++++-------- 6 files changed, 37 insertions(+), 22 deletions(-) diff --git a/pyext/Makefile.am b/pyext/Makefile.am index 1326dab..8aa5856 100755 --- a/pyext/Makefile.am +++ b/pyext/Makefile.am @@ -65,7 +65,9 @@ testdata = $(top_srcdir)/test/data/crab.xml \ $(top_srcdir)/test/data/crab_events.fits.gz \ $(top_srcdir)/test/data/crab_cntmap.fits.gz \ $(top_srcdir)/test/data/invalid_event_list.fits.gz \ - $(top_srcdir)/test/data/exclusion.reg + $(top_srcdir)/test/data/obs_unbinned.xml \ + $(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) @@ -119,6 +121,9 @@ EXTRA_DIST = ctools/tests \ $(testscripts) \ $(testdata) \ $(testirf) +dist-hook: + cp -r $(srcdir)/*.i $(distdir) + cp -r $(srcdir)/ctools/*.i $(distdir)/ctools # Dependencies. Obtain the list of dependencies by executing ls. DEPFILES = $(shell ls *.Pi 2> /dev/null) @@ -161,6 +166,7 @@ uninstall-local: rm -rf $(DESTDIR)$(pyexecdir)/ctools/tests/*.pyc rm -rf $(DESTDIR)$(pyexecdir)/ctools/tests/__pycache__ rm -rf $(DESTDIR)$(pyexecdir)/ctools-@VERSION@*.egg-info + rm -rf $(DESTDIR)$(datarootdir)/ctools # Set files to be removed in 'make clean' CLEANFILES = $(CLEAN_FILES) $(DEPFILES) diff --git a/src/ctexpcube/main.cpp b/src/ctexpcube/main.cpp index a4784d1..86c1803 100644 --- a/src/ctexpcube/main.cpp +++ b/src/ctexpcube/main.cpp @@ -57,9 +57,6 @@ int main (int argc, char *argv[]) // Create instance of application application = new ctexpcube(argc, argv); - // Execute application - application->execute(); - // Execute ctool rc = execute_ctool(application); diff --git a/test/Makefile.am b/test/Makefile.am index c5d23fa..0ce822b 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_examples.py.in b/test/test_examples.py.in index 8dde648..6982f3e 100755 --- a/test/test_examples.py.in +++ b/test/test_examples.py.in @@ -517,4 +517,6 @@ if __name__ == '__main__': rc = 1 # Exit with return code - sys.exit(rc) + if not success: + raise RuntimeError('At least one error occured during the test.') + #sys.exit(rc) diff --git a/test/test_python_cscripts.py b/test/test_python_cscripts.py index 177dd47..aeb1888 100755 --- a/test/test_python_cscripts.py +++ b/test/test_python_cscripts.py @@ -164,26 +164,27 @@ 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)) # Exit with return code - sys.exit(rc) + if not success: + raise RuntimeError('At least one error occured during the test.') + #sys.exit(rc) + + # Return + return # ======================== # diff --git a/test/test_python_ctools.py b/test/test_python_ctools.py index 37ecbf9..0a3a723 100755 --- a/test/test_python_ctools.py +++ b/test/test_python_ctools.py @@ -129,22 +129,23 @@ 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: os.system('rm -rf %s' % (path)) - # Exit with return code - sys.exit(rc) + # Throw an exception in case of failure + if not success: + raise RuntimeError('At least one error occured during the test.') + #sys.exit(rc) + + # Return + return # ======================== # -- libgit2 0.21.4