diff --git a/.gitignore b/.gitignore index a37cb2d..55997f7 100644 --- a/.gitignore +++ b/.gitignore @@ -5,9 +5,6 @@ depcomp pyext/build/ .libs .deps -test/*.fits -test/.samp -examples/python/*.fits inst/cta/test/*.xml inst/cta/test/*.fits inst/cta/test/*.fits.gz @@ -81,29 +78,7 @@ src/template/test_GClass doc/Doxyfile.bak testconf.sh -test/test_url.dat -test/*.xml -test/reports/*.xml -test/*.trs -test/region.reg -test/test_python.sh -test/test_examples.sh -test/test_csv*.dat -test/dev/*.fits -test/dev/*.xml - -examples/python/*.xml -examples/python/*.html -examples/cpp/createfits -examples/cpp/createskymap -examples/cpp/createxml -examples/cpp/readmodel -examples/cpp/numerics -examples/cpp/optimize -examples/cpp/interpolate -examples/cpp/readmodel - -# Binaries +# Test folder test/test_GApplication test/test_GFits test/test_GMatrix @@ -123,4 +98,26 @@ test/test_LAT test/test_MWL test/test_CTA test/test_COM +test/region.reg +test/.samp test/test_python.sh +test/test_examples.sh +test/*.fits +test/*.xml +test/*.trs +test/*.html +test/test_csv*.dat +test/test_url.dat +test/reports/*.xml +test/dev/*.fits +test/dev/*.xml + +# Examples folder +examples/cpp/createfits +examples/cpp/createskymap +examples/cpp/createxml +examples/cpp/readmodel +examples/cpp/numerics +examples/cpp/optimize +examples/cpp/interpolate +examples/cpp/readmodel diff --git a/ChangeLog b/ChangeLog index b831fc1..0f2424e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,10 @@ -2016-06-23 Juergen Knoedlseder +2016-06-24 Juergen Knoedlseder * Version 1.1.0 released ========================= Correct Makefile for example executables (#1806) + Include examples in unit tests (#1803) Handle additional columns in GArf class GCTAAeff2D no longer extrapolates beyond response table (#1784) Add GWcsSIN projection class (#1798) diff --git a/NEWS b/NEWS index 636deba..c097aad 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,7 @@ New Features and Important Changes in GammaLib 1.1.0 Author(s) : Juergen Knoedlseder -23 June 2016 +24 June 2016 1. Introduction diff --git a/README.md b/README.md index 36f4a5e..620daa4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ GammaLib information ==================== -* Version: 1.1.0.dev1 (23 June 2016) +* Version: 1.1.0.dev1 (24 June 2016) * Author: Juergen Knoedlseder (jurgen.knodlseder@irap.omp.eu) [![Build Status](https://cta-jenkins.irap.omp.eu/buildStatus/icon?job=gammalib-integrate-os)](https://cta-jenkins.irap.omp.eu/job/gammalib-integrate-os/) @@ -178,7 +178,7 @@ extensive unit test by typing: If everything works successfully you should see =================== - All 20 tests passed + All 21 tests passed =================== or @@ -186,8 +186,8 @@ or ============================================================================ Testsuite summary for gammalib 1.1.0.dev1 ============================================================================ - # TOTAL: 20 - # PASS: 20 + # TOTAL: 21 + # PASS: 21 # SKIP: 0 # XFAIL: 0 # FAIL: 0 diff --git a/examples/python/xml_html_create.py b/examples/python/xml_html_create.py index 1205d95..2dfaa6c 100755 --- a/examples/python/xml_html_create.py +++ b/examples/python/xml_html_create.py @@ -1,15 +1,8 @@ #! /usr/bin/env python # ========================================================================== -# Scope +# Creates a simple HTML Web page using GammaLib's xml module # -# This script creates a simple HTML Web page using GammaLib's xml module -# -# Usage -# ./xml_html_create.py -# -# ------------------------------------------------------------------------- -# -# Copyright (C) 2013 Juergen Knoedlseder +# Copyright (C) 2013-2016 Juergen Knoedlseder # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -100,9 +93,7 @@ def show_xml(xml): # Main routine entry point # # ======================== # if __name__ == '__main__': - """ - This script creates a simple HTML Web page using GammaLib's xml module. - """ + # Create HTML XML document xml = create_html() @@ -110,4 +101,4 @@ if __name__ == '__main__': show_xml(xml) # Save HTML document - xml.save("gammalib.html") + xml.save('example_html_create.html') diff --git a/test/test_examples.py b/test/test_examples.py index 3e95d22..0b3ebb8 100755 --- a/test/test_examples.py +++ b/test/test_examples.py @@ -39,7 +39,8 @@ class Test(gammalib.GPythonTestSuite): gammalib.GPythonTestSuite.__init__(self) # Examples directory - self._dir = '../examples/cpp/' + self._cpp_dir = '../examples/cpp/' + self._python_dir = '../examples/python/' # Return return @@ -55,11 +56,11 @@ class Test(gammalib.GPythonTestSuite): Binary executable name. """ # Setup command - cmd = self._dir + name + cmd = self._cpp_dir + name # Execute binary, make sure we catch any exception try: - rc = os.system(cmd+' >/dev/null 2>&1') + rc = os.system(cmd+' > example_'+name+'.log 2>&1') except: pass @@ -69,6 +70,31 @@ class Test(gammalib.GPythonTestSuite): # Return return + # Execute Python script + def _execute_python(self, name): + """ + Execute Python script + + Parameters + ---------- + name : str + Python script name with .py extension. + """ + # Setup command + cmd = self._python_dir + name + '.py' + + # Execute Python script, make sure we catch any exception + try: + rc = os.system(cmd+' > example_'+name+'.log 2>&1') + except: + pass + + # Check if execution was successful + self.test_assert(rc == 0, 'Check "'+name+'" script from command line') + + # Return + return + # Set test functions def set(self): """ @@ -85,6 +111,10 @@ class Test(gammalib.GPythonTestSuite): self.append(self.test_numerics, "Test numerics") self.append(self.test_optimize, "Test optimize") self.append(self.test_readmodel, "Test readmodel") + self.append(self.test_matrix_howto, "Test matrix howto") + self.append(self.test_models_howto, "Test models howto") + self.append(self.test_xml_howto, "Test XML howto") + self.append(self.test_xml_html_create, "Test HTML creation") # Return return @@ -180,6 +210,58 @@ class Test(gammalib.GPythonTestSuite): # Return return + # Test matrix howto + def test_matrix_howto(self): + """ + Test matrix howto + """ + # Execute python script + self._execute_python('matrix_howto') + + #TODO: Do any testing + + # Return + return + + # Test models howto + def test_models_howto(self): + """ + Test models howto + """ + # Execute python script + self._execute_python('models_howto') + + #TODO: Do any testing + + # Return + return + + # Test XML howto + def test_xml_howto(self): + """ + Test XML howto + """ + # Execute python script + self._execute_python('xml_howto') + + #TODO: Do any testing + + # Return + return + + # Test HTML creation + def test_xml_html_create(self): + """ + Test HTML creation + """ + # Execute python script + self._execute_python('xml_html_create') + + #TODO: Do any testing + + # Return + return + # ======================== # # Main routine entry point # diff --git a/testall.sh b/testall.sh index 66b15e2..3dc6b97 100755 --- a/testall.sh +++ b/testall.sh @@ -28,19 +28,6 @@ cd test/dev ./example_radial_models.py cd $base - -# examples/python -# =============== -echo -echo "=====> examples/python" -cd examples/python -./matrix_howto.py -./models_howto.py -./xml_howto.py -./xml_html_create.py -cd $base - - # inst/cta/test/dev # ================= echo @@ -55,7 +42,6 @@ cd inst/cta/test/dev ./test_sim_edisp.py cd $base - # inst/lat/test/dev # ================= echo @@ -64,7 +50,6 @@ cd inst/lat/test/dev #./test_python.py cd $base - # inst/mwl/test/dev # ================= echo @@ -73,7 +58,6 @@ cd inst/mwl/test/dev ./test_python.py cd $base - # Signal completion # ================= echo