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