Commit ff3b8957409b339211e64d10eb2439558fa64fac

Authored by Jürgen Knödlseder
1 parent 25ca02b7

Cherry-pick same changes for release 1.2.1

pyext/Makefile.am
@@ -65,7 +65,9 @@ testdata = $(top_srcdir)/test/data/crab.xml \ @@ -65,7 +65,9 @@ testdata = $(top_srcdir)/test/data/crab.xml \
65 $(top_srcdir)/test/data/crab_events.fits.gz \ 65 $(top_srcdir)/test/data/crab_events.fits.gz \
66 $(top_srcdir)/test/data/crab_cntmap.fits.gz \ 66 $(top_srcdir)/test/data/crab_cntmap.fits.gz \
67 $(top_srcdir)/test/data/invalid_event_list.fits.gz \ 67 $(top_srcdir)/test/data/invalid_event_list.fits.gz \
68 - $(top_srcdir)/test/data/exclusion.reg 68 + $(top_srcdir)/test/data/obs_unbinned.xml \
  69 + $(top_srcdir)/test/data/exclusion.reg \
  70 + $(top_srcdir)/test/data/irf_file.fits.gz
69 71
70 # Install test scripts and test data. Note that we don't need to prepend 72 # Install test scripts and test data. Note that we don't need to prepend
71 # $(DESTDIR) here (not fully clear why, but that's the way it is) 73 # $(DESTDIR) here (not fully clear why, but that's the way it is)
@@ -119,6 +121,9 @@ EXTRA_DIST = ctools/tests \ @@ -119,6 +121,9 @@ EXTRA_DIST = ctools/tests \
119 $(testscripts) \ 121 $(testscripts) \
120 $(testdata) \ 122 $(testdata) \
121 $(testirf) 123 $(testirf)
  124 +dist-hook:
  125 + cp -r $(srcdir)/*.i $(distdir)
  126 + cp -r $(srcdir)/ctools/*.i $(distdir)/ctools
122 127
123 # Dependencies. Obtain the list of dependencies by executing ls. 128 # Dependencies. Obtain the list of dependencies by executing ls.
124 DEPFILES = $(shell ls *.Pi 2> /dev/null) 129 DEPFILES = $(shell ls *.Pi 2> /dev/null)
@@ -161,6 +166,7 @@ uninstall-local: @@ -161,6 +166,7 @@ uninstall-local:
161 rm -rf $(DESTDIR)$(pyexecdir)/ctools/tests/*.pyc 166 rm -rf $(DESTDIR)$(pyexecdir)/ctools/tests/*.pyc
162 rm -rf $(DESTDIR)$(pyexecdir)/ctools/tests/__pycache__ 167 rm -rf $(DESTDIR)$(pyexecdir)/ctools/tests/__pycache__
163 rm -rf $(DESTDIR)$(pyexecdir)/ctools-@VERSION@*.egg-info 168 rm -rf $(DESTDIR)$(pyexecdir)/ctools-@VERSION@*.egg-info
  169 + rm -rf $(DESTDIR)$(datarootdir)/ctools
164 170
165 # Set files to be removed in 'make clean' 171 # Set files to be removed in 'make clean'
166 CLEANFILES = $(CLEAN_FILES) $(DEPFILES) 172 CLEANFILES = $(CLEAN_FILES) $(DEPFILES)
src/ctexpcube/main.cpp
@@ -57,9 +57,6 @@ int main (int argc, char *argv[]) @@ -57,9 +57,6 @@ int main (int argc, char *argv[])
57 // Create instance of application 57 // Create instance of application
58 application = new ctexpcube(argc, argv); 58 application = new ctexpcube(argc, argv);
59 59
60 - // Execute application  
61 - application->execute();  
62 -  
63 // Execute ctool 60 // Execute ctool
64 rc = execute_ctool(application); 61 rc = execute_ctool(application);
65 62
test/Makefile.am
@@ -71,7 +71,15 @@ installcheck-local: @@ -71,7 +71,15 @@ installcheck-local:
71 @export CTOOLS=$(DESTDIR)$(prefix); \ 71 @export CTOOLS=$(DESTDIR)$(prefix); \
72 . $(DESTDIR)$(prefix)/bin/ctools-init.sh; \ 72 . $(DESTDIR)$(prefix)/bin/ctools-init.sh; \
73 python -c 'import ctools; ctools.test()'; \ 73 python -c 'import ctools; ctools.test()'; \
74 - python -c 'import cscripts; cscripts.test()' 74 + if test "x$$?" != "x0"; then \
  75 + echo "*** ctools unit test failure!"; \
  76 + exit 1; \
  77 + fi; \
  78 + python -c 'import cscripts; cscripts.test()'; \
  79 + if test "x$$?" != "x0"; then \
  80 + echo "*** cscripts unit test failure!"; \
  81 + exit 1; \
  82 + fi
75 endif 83 endif
76 84
77 # Add Valgrind rule 85 # Add Valgrind rule
test/test_examples.py.in
@@ -517,4 +517,6 @@ if __name__ == '__main__': @@ -517,4 +517,6 @@ if __name__ == '__main__':
517 rc = 1 517 rc = 1
518 518
519 # Exit with return code 519 # Exit with return code
520 - sys.exit(rc) 520 + if not success:
  521 + raise RuntimeError('At least one error occured during the test.')
  522 + #sys.exit(rc)
test/test_python_cscripts.py
@@ -164,26 +164,27 @@ def test(installed=False, debug=False): @@ -164,26 +164,27 @@ def test(installed=False, debug=False):
164 # Run test suite 164 # Run test suite
165 success = suites.run() 165 success = suites.run()
166 166
167 - # If we have a non-installed version then save test results 167 + # Save test results
168 if not installed: 168 if not installed:
169 suites.save('reports/cscripts.xml') 169 suites.save('reports/cscripts.xml')
  170 + else:
  171 + suites.save('cscripts_reports.xml')
170 172
171 # If debuging is requested then print test suites 173 # If debuging is requested then print test suites
172 if debug: 174 if debug:
173 print(suites) 175 print(suites)
174 176
175 - # Set return code  
176 - if success:  
177 - rc = 0  
178 - else:  
179 - rc = 1  
180 -  
181 # Remove temporary direction 177 # Remove temporary direction
182 if installed: 178 if installed:
183 os.system('rm -rf %s' % (path)) 179 os.system('rm -rf %s' % (path))
184 180
185 # Exit with return code 181 # Exit with return code
186 - sys.exit(rc) 182 + if not success:
  183 + raise RuntimeError('At least one error occured during the test.')
  184 + #sys.exit(rc)
  185 +
  186 + # Return
  187 + return
187 188
188 189
189 # ======================== # 190 # ======================== #
test/test_python_ctools.py
@@ -129,22 +129,23 @@ def test(installed=False): @@ -129,22 +129,23 @@ def test(installed=False):
129 # Run test suite 129 # Run test suite
130 success = suites.run() 130 success = suites.run()
131 131
132 - # If we have a non-installed version then save test results 132 + # Save test results
133 if not installed: 133 if not installed:
134 suites.save('reports/ctools.xml') 134 suites.save('reports/ctools.xml')
135 -  
136 - # Set return code  
137 - if success:  
138 - rc = 0  
139 else: 135 else:
140 - rc = 1 136 + suites.save('ctools_reports.xml')
141 137
142 # Remove temporary direction 138 # Remove temporary direction
143 if installed: 139 if installed:
144 os.system('rm -rf %s' % (path)) 140 os.system('rm -rf %s' % (path))
145 141
146 - # Exit with return code  
147 - sys.exit(rc) 142 + # Throw an exception in case of failure
  143 + if not success:
  144 + raise RuntimeError('At least one error occured during the test.')
  145 + #sys.exit(rc)
  146 +
  147 + # Return
  148 + return
148 149
149 150
150 # ======================== # 151 # ======================== #