Commit 4b0d55235cffdf9fef4ebad233d26a67db7d5c2e

Authored by Jürgen Knödlseder
1 parent 4dc72cd8

Fixed installed unit test

pyext/Makefile.am
@@ -69,8 +69,10 @@ testdata = $(top_srcdir)/test/data/crab.xml \ @@ -69,8 +69,10 @@ testdata = $(top_srcdir)/test/data/crab.xml \
69 $(top_srcdir)/test/data/phased_events.fits.gz \ 69 $(top_srcdir)/test/data/phased_events.fits.gz \
70 $(top_srcdir)/test/data/invalid_event_list.fits.gz \ 70 $(top_srcdir)/test/data/invalid_event_list.fits.gz \
71 $(top_srcdir)/test/data/model_temporal_phasecurve.xml \ 71 $(top_srcdir)/test/data/model_temporal_phasecurve.xml \
  72 + $(top_srcdir)/test/data/model_temporal_phasecurve.fits \
72 $(top_srcdir)/test/data/obs_unbinned.xml \ 73 $(top_srcdir)/test/data/obs_unbinned.xml \
73 - $(top_srcdir)/test/data/exclusion.reg 74 + $(top_srcdir)/test/data/exclusion.reg \
  75 + $(top_srcdir)/test/data/irf_file.fits.gz
74 76
75 # Install test scripts and test data. Note that we don't need to prepend 77 # Install test scripts and test data. Note that we don't need to prepend
76 # $(DESTDIR) here (not fully clear why, but that's the way it is) 78 # $(DESTDIR) here (not fully clear why, but that's the way it is)
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_python_cscripts.py
@@ -168,20 +168,16 @@ def test(installed=False, debug=False): @@ -168,20 +168,16 @@ def test(installed=False, debug=False):
168 # Run test suite 168 # Run test suite
169 success = suites.run() 169 success = suites.run()
170 170
171 - # If we have a non-installed version then save test results 171 + # Save test results
172 if not installed: 172 if not installed:
173 suites.save('reports/cscripts.xml') 173 suites.save('reports/cscripts.xml')
  174 + else:
  175 + suites.save('cscripts_reports.xml')
174 176
175 # If debuging is requested then print test suites 177 # If debuging is requested then print test suites
176 if debug: 178 if debug:
177 print(suites) 179 print(suites)
178 180
179 - # Set return code  
180 - if success:  
181 - rc = 0  
182 - else:  
183 - rc = 1  
184 -  
185 # Remove temporary direction 181 # Remove temporary direction
186 if installed: 182 if installed:
187 os.system('rm -rf %s' % (path)) 183 os.system('rm -rf %s' % (path))
@@ -190,6 +186,9 @@ def test(installed=False, debug=False): @@ -190,6 +186,9 @@ def test(installed=False, debug=False):
190 if not success: 186 if not success:
191 raise RuntimeError('At least one error occured during the test.') 187 raise RuntimeError('At least one error occured during the test.')
192 188
  189 + # Return
  190 + return
  191 +
193 192
194 # ======================== # 193 # ======================== #
195 # Main routine entry point # 194 # Main routine entry point #
test/test_python_ctools.py
@@ -133,15 +133,11 @@ def test(installed=False): @@ -133,15 +133,11 @@ def test(installed=False):
133 # Run test suite 133 # Run test suite
134 success = suites.run() 134 success = suites.run()
135 135
136 - # If we have a non-installed version then save test results 136 + # Save test results
137 if not installed: 137 if not installed:
138 suites.save('reports/ctools.xml') 138 suites.save('reports/ctools.xml')
139 -  
140 - # Set return code  
141 - if success:  
142 - rc = 0  
143 else: 139 else:
144 - rc = 1 140 + suites.save('ctools_reports.xml')
145 141
146 # Remove temporary direction 142 # Remove temporary direction
147 if installed: 143 if installed:
@@ -151,6 +147,9 @@ def test(installed=False): @@ -151,6 +147,9 @@ def test(installed=False):
151 if not success: 147 if not success:
152 raise RuntimeError('At least one error occured during the test.') 148 raise RuntimeError('At least one error occured during the test.')
153 149
  150 + # Return
  151 + return
  152 +
154 153
155 # ======================== # 154 # ======================== #
156 # Main routine entry point # 155 # Main routine entry point #