From 443151637732c0810bf18263057e5ffe9877df56 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Sat, 13 Aug 2016 21:38:36 +0200 Subject: [PATCH] Test all ctools for help text --- dev/testreport.py | 2 +- src/support/ctool.cpp | 4 ++-- test/test_ctbin.py | 13 ++++++++++--- test/test_ctbkgcube.py | 14 ++++++++++++++ test/test_ctbutterfly.py | 15 +++++++++++++++ test/test_ctcubemask.py | 14 ++++++++++++++ test/test_ctedispcube.py | 14 ++++++++++++++ test/test_cterror.py | 15 +++++++++++++++ test/test_ctexpcube.py | 14 ++++++++++++++ test/test_ctlike.py | 15 +++++++++++++++ test/test_ctmapcube.py | 14 ++++++++++++++ test/test_ctmodel.py | 14 ++++++++++++++ test/test_ctobssim.py | 14 ++++++++++++++ test/test_ctpsfcube.py | 14 ++++++++++++++ test/test_ctselect.py | 14 ++++++++++++++ test/test_ctskymap.py | 14 ++++++++++++++ test/test_cttsmap.py | 14 ++++++++++++++ test/test_ctulimit.py | 15 +++++++++++++++ 18 files changed, 227 insertions(+), 6 deletions(-) diff --git a/dev/testreport.py b/dev/testreport.py index 3682da1..01e2277 100755 --- a/dev/testreport.py +++ b/dev/testreport.py @@ -66,7 +66,7 @@ def report_one_failure(name, xml): type = xml.attribute('type') # Print failure information - print(' Failure in %s:\n "%s" (%s)' % (name, message, type)) + print(' Failure in "%s":\n "%s" (%s)' % (name, message, type)) # Return return diff --git a/src/support/ctool.cpp b/src/support/ctool.cpp index 9d2566e..ae5c8cb 100644 --- a/src/support/ctool.cpp +++ b/src/support/ctool.cpp @@ -1777,8 +1777,8 @@ std::string ctool::warn_xml_suffix(const GFilename& filename) const * * $CTOOLS//share/help/ * - * of the ctools installation and the help file has the name ".txt", - * where stands for the name of the ctool. + * of the ctools installation and the help file has the name "name().txt", + * where name() stands for the name of the ctool. ***************************************************************************/ void ctool::provide_help(void) const { diff --git a/test/test_ctbin.py b/test/test_ctbin.py index f016a77..68d1425 100755 --- a/test/test_ctbin.py +++ b/test/test_ctbin.py @@ -104,9 +104,16 @@ class Test(test): # Setup ctbin --help option cmd = ctbin+' --help' - # Check if execution was successful - self.test_assert(self._execute(cmd) == 0, - 'Check successful execution from command line with --help option') + # Check if execution was successful in case that the CTOOLS + # environment variable was set or failed otherwise + if 'CTOOLS' in os.environ: + rc = 0 + what = 'success' + else: + rc = 1 + what = 'failure' + self.test_value(self._execute(cmd), rc, + 'Check execution %s from command line with --help option' % what) # Return return diff --git a/test/test_ctbkgcube.py b/test/test_ctbkgcube.py index 58dd581..4b43888 100755 --- a/test/test_ctbkgcube.py +++ b/test/test_ctbkgcube.py @@ -104,6 +104,20 @@ class Test(test): self.test_assert(self._execute(cmd) != 0, 'Check invalid input file when executed from command line') + # Setup ctbkgcube --help option + cmd = ctbkgcube+' --help' + + # Check if execution was successful in case that the CTOOLS + # environment variable was set or failed otherwise + if 'CTOOLS' in os.environ: + rc = 0 + what = 'success' + else: + rc = 1 + what = 'failure' + self.test_value(self._execute(cmd), rc, + 'Check execution %s from command line with --help option' % what) + # Return return diff --git a/test/test_ctbutterfly.py b/test/test_ctbutterfly.py index 46e971f..2bd641f 100755 --- a/test/test_ctbutterfly.py +++ b/test/test_ctbutterfly.py @@ -18,6 +18,7 @@ # along with this program. If not, see . # # ========================================================================== +import os import gammalib import ctools from testing import test @@ -95,6 +96,20 @@ class Test(test): self.test_assert(self._execute(cmd) != 0, 'Check invalid input file when executed from command line') + # Setup ctbutterfly --help option + cmd = ctbutterfly+' --help' + + # Check if execution was successful in case that the CTOOLS + # environment variable was set or failed otherwise + if 'CTOOLS' in os.environ: + rc = 0 + what = 'success' + else: + rc = 1 + what = 'failure' + self.test_value(self._execute(cmd), rc, + 'Check execution %s from command line with --help option' % what) + # Return return diff --git a/test/test_ctcubemask.py b/test/test_ctcubemask.py index 3627237..9ffbc17 100755 --- a/test/test_ctcubemask.py +++ b/test/test_ctcubemask.py @@ -99,6 +99,20 @@ class Test(test): self.test_assert(self._execute(cmd) != 0, 'Check invalid input file when executed from command line') + # Setup ctcubemask --help option + cmd = ctcubemask+' --help' + + # Check if execution was successful in case that the CTOOLS + # environment variable was set or failed otherwise + if 'CTOOLS' in os.environ: + rc = 0 + what = 'success' + else: + rc = 1 + what = 'failure' + self.test_value(self._execute(cmd), rc, + 'Check execution %s from command line with --help option' % what) + # Return return diff --git a/test/test_ctedispcube.py b/test/test_ctedispcube.py index 3fdc0c0..4b0e90c 100755 --- a/test/test_ctedispcube.py +++ b/test/test_ctedispcube.py @@ -102,6 +102,20 @@ class Test(test): self.test_assert(self._execute(cmd) != 0, 'Check invalid input file when executed from command line') + # Setup ctedispcube --help option + cmd = ctedispcube+' --help' + + # Check if execution was successful in case that the CTOOLS + # environment variable was set or failed otherwise + if 'CTOOLS' in os.environ: + rc = 0 + what = 'success' + else: + rc = 1 + what = 'failure' + self.test_value(self._execute(cmd), rc, + 'Check execution %s from command line with --help option' % what) + # Return return diff --git a/test/test_cterror.py b/test/test_cterror.py index 1a86fb2..d427962 100755 --- a/test/test_cterror.py +++ b/test/test_cterror.py @@ -18,6 +18,7 @@ # along with this program. If not, see . # # ========================================================================== +import os import gammalib import ctools from testing import test @@ -93,6 +94,20 @@ class Test(test): self.test_assert(self._execute(cmd) != 0, 'Check invalid input file when executed from command line') + # Setup cterror --help option + cmd = cterror+' --help' + + # Check if execution was successful in case that the CTOOLS + # environment variable was set or failed otherwise + if 'CTOOLS' in os.environ: + rc = 0 + what = 'success' + else: + rc = 1 + what = 'failure' + self.test_value(self._execute(cmd), rc, + 'Check execution %s from command line with --help option' % what) + # Return return diff --git a/test/test_ctexpcube.py b/test/test_ctexpcube.py index 7783e09..fda3b8e 100755 --- a/test/test_ctexpcube.py +++ b/test/test_ctexpcube.py @@ -100,6 +100,20 @@ class Test(test): self.test_assert(self._execute(cmd) != 0, 'Check invalid input file when executed from command line') + # Setup ctexpcube --help option + cmd = ctexpcube+' --help' + + # Check if execution was successful in case that the CTOOLS + # environment variable was set or failed otherwise + if 'CTOOLS' in os.environ: + rc = 0 + what = 'success' + else: + rc = 1 + what = 'failure' + self.test_value(self._execute(cmd), rc, + 'Check execution %s from command line with --help option' % what) + # Return return diff --git a/test/test_ctlike.py b/test/test_ctlike.py index 85cc77e..29fbca2 100755 --- a/test/test_ctlike.py +++ b/test/test_ctlike.py @@ -18,6 +18,7 @@ # along with this program. If not, see . # # ========================================================================== +import os import gammalib import ctools from testing import test @@ -93,6 +94,20 @@ class Test(test): self.test_assert(self._execute(cmd) != 0, 'Check invalid input file when executed from command line') + # Setup ctlike --help option + cmd = ctlike+' --help' + + # Check if execution was successful in case that the CTOOLS + # environment variable was set or failed otherwise + if 'CTOOLS' in os.environ: + rc = 0 + what = 'success' + else: + rc = 1 + what = 'failure' + self.test_value(self._execute(cmd), rc, + 'Check execution %s from command line with --help option' % what) + # Return return diff --git a/test/test_ctmapcube.py b/test/test_ctmapcube.py index 384f9c2..d2b078f 100644 --- a/test/test_ctmapcube.py +++ b/test/test_ctmapcube.py @@ -100,6 +100,20 @@ class Test(test): self.test_assert(self._execute(cmd) != 0, 'Check invalid input file when executed from command line') + # Setup ctmapcube --help option + cmd = ctmapcube+' --help' + + # Check if execution was successful in case that the CTOOLS + # environment variable was set or failed otherwise + if 'CTOOLS' in os.environ: + rc = 0 + what = 'success' + else: + rc = 1 + what = 'failure' + self.test_value(self._execute(cmd), rc, + 'Check execution %s from command line with --help option' % what) + # Return return diff --git a/test/test_ctmodel.py b/test/test_ctmodel.py index 48f6616..1415462 100755 --- a/test/test_ctmodel.py +++ b/test/test_ctmodel.py @@ -104,6 +104,20 @@ class Test(test): self.test_assert(self._execute(cmd) != 0, 'Check invalid input file when executed from command line') + # Setup ctmodel --help option + cmd = ctmodel+' --help' + + # Check if execution was successful in case that the CTOOLS + # environment variable was set or failed otherwise + if 'CTOOLS' in os.environ: + rc = 0 + what = 'success' + else: + rc = 1 + what = 'failure' + self.test_value(self._execute(cmd), rc, + 'Check execution %s from command line with --help option' % what) + # Return return diff --git a/test/test_ctobssim.py b/test/test_ctobssim.py index ef3eb4e..79ee063 100755 --- a/test/test_ctobssim.py +++ b/test/test_ctobssim.py @@ -102,6 +102,20 @@ class Test(test): self.test_assert(self._execute(cmd) != 0, 'Check invalid input file when executed from command line') + # Setup ctobssim --help option + cmd = ctobssim+' --help' + + # Check if execution was successful in case that the CTOOLS + # environment variable was set or failed otherwise + if 'CTOOLS' in os.environ: + rc = 0 + what = 'success' + else: + rc = 1 + what = 'failure' + self.test_value(self._execute(cmd), rc, + 'Check execution %s from command line with --help option' % what) + # Return return diff --git a/test/test_ctpsfcube.py b/test/test_ctpsfcube.py index d3ab873..e8f0e98 100755 --- a/test/test_ctpsfcube.py +++ b/test/test_ctpsfcube.py @@ -102,6 +102,20 @@ class Test(test): self.test_assert(self._execute(cmd) != 0, 'Check invalid input file when executed from command line') + # Setup ctpsfcube --help option + cmd = ctpsfcube+' --help' + + # Check if execution was successful in case that the CTOOLS + # environment variable was set or failed otherwise + if 'CTOOLS' in os.environ: + rc = 0 + what = 'success' + else: + rc = 1 + what = 'failure' + self.test_value(self._execute(cmd), rc, + 'Check execution %s from command line with --help option' % what) + # Return return diff --git a/test/test_ctselect.py b/test/test_ctselect.py index 34efcaa..df04fbb 100755 --- a/test/test_ctselect.py +++ b/test/test_ctselect.py @@ -99,6 +99,20 @@ class Test(test): self.test_assert(self._execute(cmd) != 0, 'Check invalid input file when executed from command line') + # Setup ctselect --help option + cmd = ctselect+' --help' + + # Check if execution was successful in case that the CTOOLS + # environment variable was set or failed otherwise + if 'CTOOLS' in os.environ: + rc = 0 + what = 'success' + else: + rc = 1 + what = 'failure' + self.test_value(self._execute(cmd), rc, + 'Check execution %s from command line with --help option' % what) + # Return return diff --git a/test/test_ctskymap.py b/test/test_ctskymap.py index e68b268..d160b59 100755 --- a/test/test_ctskymap.py +++ b/test/test_ctskymap.py @@ -96,6 +96,20 @@ class Test(test): self.test_assert(self._execute(cmd) != 0, 'Check invalid input file when executed from command line') + # Setup ctskymap --help option + cmd = ctskymap+' --help' + + # Check if execution was successful in case that the CTOOLS + # environment variable was set or failed otherwise + if 'CTOOLS' in os.environ: + rc = 0 + what = 'success' + else: + rc = 1 + what = 'failure' + self.test_value(self._execute(cmd), rc, + 'Check execution %s from command line with --help option' % what) + # Return return diff --git a/test/test_cttsmap.py b/test/test_cttsmap.py index 5b3890d..5c860f1 100755 --- a/test/test_cttsmap.py +++ b/test/test_cttsmap.py @@ -98,6 +98,20 @@ class Test(test): self.test_assert(self._execute(cmd) != 0, 'Check invalid input file when executed from command line') + # Setup cttsmap --help option + cmd = cttsmap+' --help' + + # Check if execution was successful in case that the CTOOLS + # environment variable was set or failed otherwise + if 'CTOOLS' in os.environ: + rc = 0 + what = 'success' + else: + rc = 1 + what = 'failure' + self.test_value(self._execute(cmd), rc, + 'Check execution %s from command line with --help option' % what) + # Return return diff --git a/test/test_ctulimit.py b/test/test_ctulimit.py index 73a0b66..25ba38c 100755 --- a/test/test_ctulimit.py +++ b/test/test_ctulimit.py @@ -18,6 +18,7 @@ # along with this program. If not, see . # # ========================================================================== +import os import gammalib import ctools from testing import test @@ -91,6 +92,20 @@ class Test(test): self.test_assert(self._execute(cmd) != 0, 'Check invalid input file when executed from command line') + # Setup ctulimit --help option + cmd = ctulimit+' --help' + + # Check if execution was successful in case that the CTOOLS + # environment variable was set or failed otherwise + if 'CTOOLS' in os.environ: + rc = 0 + what = 'success' + else: + rc = 1 + what = 'failure' + self.test_value(self._execute(cmd), rc, + 'Check execution %s from command line with --help option' % what) + # Return return -- libgit2 0.21.4