Commit d9f9f2bdde43285620410d060868cd2baecff281

Authored by Jürgen Knödlseder
1 parent 84c6461f

Use support function in main.cpp code of ctools

src/ctbin/main.cpp
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 -#include <cstdio> 31 +#include "support.hpp"
32 #include "ctbin.hpp" 32 #include "ctbin.hpp"
33 33
34 34
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 * This is the main entry point of the ctbin application. It allocates a 41 * This is the main entry point of the ctbin application. It allocates a
42 * ctbin object and executes the application. Any exceptions that occur 42 * ctbin object and executes the application. Any exceptions that occur
43 * will be catched and corresponding error messages written in the 43 * will be catched and corresponding error messages written in the
44 - * application logger and on the standard output. 44 + * application logger and into the standard output.
45 ***************************************************************************/ 45 ***************************************************************************/
46 int main (int argc, char *argv[]) 46 int main (int argc, char *argv[])
47 { 47 {
@@ -51,41 +51,26 @@ int main (int argc, char *argv[]) @@ -51,41 +51,26 @@ int main (int argc, char *argv[])
51 // Initialise pointer on application 51 // Initialise pointer on application
52 ctbin* application = NULL; 52 ctbin* application = NULL;
53 53
54 - // Execute application 54 + // Try creating an instance of the application and executing the instance
55 try { 55 try {
56 56
57 // Create instance of application 57 // Create instance of application
58 application = new ctbin(argc, argv); 58 application = new ctbin(argc, argv);
59 59
60 - // Execute application  
61 - application->execute(); 60 + // Execute ctool
  61 + rc = execute_ctool(application);
62 62
63 - // Delete application  
64 - delete application;  
65 -  
66 - // Signal success  
67 - rc = 0;  
68 } 63 }
69 - catch (std::exception &e) {  
70 64
71 - // Extract error message  
72 - std::string message = e.what();  
73 - std::string signal = "*** ERROR encounterted in the execution of "  
74 - "ctbin. Run aborted ..."; 65 + catch (std::exception &e) {
75 66
76 - // If application exists then write error in logger and delete  
77 - // application  
78 - if (application != NULL) {  
79 - application->log << signal << std::endl;  
80 - application->log << message << std::endl;  
81 - delete application;  
82 - } 67 + // Report exception
  68 + report_ctool_failure("ctbin", e.what());
83 69
84 - // Write error on standard output  
85 - std::cout << signal << std::endl;  
86 - std::cout << message << std::endl; 70 + }
87 71
88 - } // endcatch: catched any application error 72 + // Delete application
  73 + delete application;
89 74
90 // Return 75 // Return
91 return rc; 76 return rc;
src/ctbkgcube/main.cpp
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 -#include <cstdio> 31 +#include "support.hpp"
32 #include "ctbkgcube.hpp" 32 #include "ctbkgcube.hpp"
33 33
34 34
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 * This is the main entry point of the ctbkgcube application. It allocates a 41 * This is the main entry point of the ctbkgcube application. It allocates a
42 * ctbkgcube object and executes the application. Any exceptions that occur 42 * ctbkgcube object and executes the application. Any exceptions that occur
43 * will be catched and corresponding error messages written in the 43 * will be catched and corresponding error messages written in the
44 - * application logger and on the standard output. 44 + * application logger and into the standard output.
45 ***************************************************************************/ 45 ***************************************************************************/
46 int main (int argc, char *argv[]) 46 int main (int argc, char *argv[])
47 { 47 {
@@ -57,35 +57,20 @@ int main (int argc, char *argv[]) @@ -57,35 +57,20 @@ int main (int argc, char *argv[])
57 // Create instance of application 57 // Create instance of application
58 application = new ctbkgcube(argc, argv); 58 application = new ctbkgcube(argc, argv);
59 59
60 - // Execute application  
61 - application->execute(); 60 + // Execute ctool
  61 + rc = execute_ctool(application);
62 62
63 - // Delete application  
64 - delete application;  
65 -  
66 - // Signal success  
67 - rc = 0;  
68 } 63 }
69 - catch (std::exception &e) {  
70 64
71 - // Extract error message  
72 - std::string message = e.what();  
73 - std::string signal = "*** ERROR encounterted in the execution of "  
74 - "ctbkgcube. Run aborted ..."; 65 + catch (std::exception &e) {
75 66
76 - // If application exists then write error in logger and delete  
77 - // application  
78 - if (application != NULL) {  
79 - application->log << signal << std::endl;  
80 - application->log << message << std::endl;  
81 - delete application;  
82 - } 67 + // Report exception
  68 + report_ctool_failure("ctbkgcube", e.what());
83 69
84 - // Write error on standard output  
85 - std::cout << signal << std::endl;  
86 - std::cout << message << std::endl; 70 + }
87 71
88 - } // endcatch: catched any application error 72 + // Delete application
  73 + delete application;
89 74
90 // Return 75 // Return
91 return rc; 76 return rc;
src/ctbutterfly/main.cpp
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 -#include <cstdio> 31 +#include "support.hpp"
32 #include "ctbutterfly.hpp" 32 #include "ctbutterfly.hpp"
33 33
34 34
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 * This is the main entry point of the ctbutterfly application. It allocates 41 * This is the main entry point of the ctbutterfly application. It allocates
42 * a ctbutterfly object and executes the application. Any exceptions that 42 * a ctbutterfly object and executes the application. Any exceptions that
43 * occur will be catched and corresponding error messages written in the 43 * occur will be catched and corresponding error messages written in the
44 - * application logger and on the standard output. 44 + * application logger and into the standard output.
45 ***************************************************************************/ 45 ***************************************************************************/
46 int main (int argc, char *argv[]) 46 int main (int argc, char *argv[])
47 { 47 {
@@ -57,35 +57,20 @@ int main (int argc, char *argv[]) @@ -57,35 +57,20 @@ int main (int argc, char *argv[])
57 // Create instance of application 57 // Create instance of application
58 application = new ctbutterfly(argc, argv); 58 application = new ctbutterfly(argc, argv);
59 59
60 - // Execute application  
61 - application->execute(); 60 + // Execute ctool
  61 + rc = execute_ctool(application);
62 62
63 - // Delete application  
64 - delete application;  
65 -  
66 - // Signal success  
67 - rc = 0;  
68 } 63 }
69 - catch (std::exception &e) {  
70 64
71 - // Extract error message  
72 - std::string message = e.what();  
73 - std::string signal = "*** ERROR encounterted in the execution of "  
74 - "ctbutterfly. Run aborted ..."; 65 + catch (std::exception &e) {
75 66
76 - // If application exists then write error in logger and delete  
77 - // application  
78 - if (application != NULL) {  
79 - application->log << signal << std::endl;  
80 - application->log << message << std::endl;  
81 - delete application;  
82 - } 67 + // Report exception
  68 + report_ctool_failure("ctbutterfly", e.what());
83 69
84 - // Write error on standard output  
85 - std::cout << signal << std::endl;  
86 - std::cout << message << std::endl; 70 + }
87 71
88 - } // endcatch: catched any application error 72 + // Delete application
  73 + delete application;
89 74
90 // Return 75 // Return
91 return rc; 76 return rc;
src/ctcubemask/main.cpp
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 -#include <cstdio> 31 +#include "support.hpp"
32 #include "ctcubemask.hpp" 32 #include "ctcubemask.hpp"
33 33
34 34
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 * This is the main entry point of the ctcubemask application. It allocates 41 * This is the main entry point of the ctcubemask application. It allocates
42 * a ctcubemask object and executes the application. Any exceptions that 42 * a ctcubemask object and executes the application. Any exceptions that
43 * occur will be catched and corresponding error messages written in the 43 * occur will be catched and corresponding error messages written in the
44 - * application logger and on the standard output. 44 + * application logger and into the standard output.
45 ***************************************************************************/ 45 ***************************************************************************/
46 int main (int argc, char *argv[]) 46 int main (int argc, char *argv[])
47 { 47 {
@@ -57,35 +57,20 @@ int main (int argc, char *argv[]) @@ -57,35 +57,20 @@ int main (int argc, char *argv[])
57 // Create instance of application 57 // Create instance of application
58 application = new ctcubemask(argc, argv); 58 application = new ctcubemask(argc, argv);
59 59
60 - // Execute application  
61 - application->execute(); 60 + // Execute ctool
  61 + rc = execute_ctool(application);
62 62
63 - // Delete application  
64 - delete application;  
65 -  
66 - // Signal success  
67 - rc = 0;  
68 } 63 }
69 - catch (std::exception &e) {  
70 64
71 - // Extract error message  
72 - std::string message = e.what();  
73 - std::string signal = "*** ERROR encounterted in the execution of "  
74 - "ctcubemask. Run aborted ..."; 65 + catch (std::exception &e) {
75 66
76 - // If application exists then write error in logger and delete  
77 - // application  
78 - if (application != NULL) {  
79 - application->log << signal << std::endl;  
80 - application->log << message << std::endl;  
81 - delete application;  
82 - } 67 + // Report exception
  68 + report_ctool_failure("ctcubemask", e.what());
83 69
84 - // Write error on standard output  
85 - std::cout << message << std::endl;  
86 - std::cout << signal << std::endl; 70 + }
87 71
88 - } // endcatch: catched any application error 72 + // Delete application
  73 + delete application;
89 74
90 // Return 75 // Return
91 return rc; 76 return rc;
src/ctedispcube/main.cpp
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 -#include <cstdio> 31 +#include "support.hpp"
32 #include "ctedispcube.hpp" 32 #include "ctedispcube.hpp"
33 33
34 34
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 * This is the main entry point of the ctedispcube application. It allocates 41 * This is the main entry point of the ctedispcube application. It allocates
42 * a ctedispcube object and executes the application. Any exceptions that 42 * a ctedispcube object and executes the application. Any exceptions that
43 * occur will be catched and corresponding error messages written in the 43 * occur will be catched and corresponding error messages written in the
44 - * application logger and on the standard output. 44 + * application logger and into the standard output.
45 ***************************************************************************/ 45 ***************************************************************************/
46 int main (int argc, char *argv[]) 46 int main (int argc, char *argv[])
47 { 47 {
@@ -57,35 +57,20 @@ int main (int argc, char *argv[]) @@ -57,35 +57,20 @@ int main (int argc, char *argv[])
57 // Create instance of application 57 // Create instance of application
58 application = new ctedispcube(argc, argv); 58 application = new ctedispcube(argc, argv);
59 59
60 - // Execute application  
61 - application->execute(); 60 + // Execute ctool
  61 + rc = execute_ctool(application);
62 62
63 - // Delete application  
64 - delete application;  
65 -  
66 - // Signal success  
67 - rc = 0;  
68 } 63 }
69 - catch (std::exception &e) {  
70 64
71 - // Extract error message  
72 - std::string message = e.what();  
73 - std::string signal = "*** ERROR encounterted in the execution of "  
74 - "ctedispcube. Run aborted ..."; 65 + catch (std::exception &e) {
75 66
76 - // If application exists then write error in logger and delete  
77 - // application  
78 - if (application != NULL) {  
79 - application->log << signal << std::endl;  
80 - application->log << message << std::endl;  
81 - delete application;  
82 - } 67 + // Report exception
  68 + report_ctool_failure("ctedispcube", e.what());
83 69
84 - // Write error on standard output  
85 - std::cout << signal << std::endl;  
86 - std::cout << message << std::endl; 70 + }
87 71
88 - } // endcatch: catched any application error 72 + // Delete application
  73 + delete application;
89 74
90 // Return 75 // Return
91 return rc; 76 return rc;
src/cterror/main.cpp
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 -#include <iostream> 31 +#include "support.hpp"
32 #include "cterror.hpp" 32 #include "cterror.hpp"
33 33
34 34
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 * This is the main entry point of the cterror application. It allocates a 41 * This is the main entry point of the cterror application. It allocates a
42 * cterror object and executes the application. Any exceptions that occur 42 * cterror object and executes the application. Any exceptions that occur
43 * will be catched and corresponding error messages written in the 43 * will be catched and corresponding error messages written in the
44 - * application logger and on the standard output. 44 + * application logger and into the standard output.
45 ***************************************************************************/ 45 ***************************************************************************/
46 int main (int argc, char *argv[]) 46 int main (int argc, char *argv[])
47 { 47 {
@@ -57,35 +57,20 @@ int main (int argc, char *argv[]) @@ -57,35 +57,20 @@ int main (int argc, char *argv[])
57 // Create instance of application 57 // Create instance of application
58 application = new cterror(argc, argv); 58 application = new cterror(argc, argv);
59 59
60 - // Execute application  
61 - application->execute(); 60 + // Execute ctool
  61 + rc = execute_ctool(application);
62 62
63 - // Delete application  
64 - delete application;  
65 -  
66 - // Signal success  
67 - rc = 0;  
68 } 63 }
69 - catch (std::exception &e) {  
70 64
71 - // Extract error message  
72 - std::string message = e.what();  
73 - std::string signal = "*** ERROR encounterted in the execution of "  
74 - "cterror. Run aborted ..."; 65 + catch (std::exception &e) {
75 66
76 - // If application exists then write error in logger and delete  
77 - // application  
78 - if (application != NULL) {  
79 - application->log << signal << std::endl;  
80 - application->log << message << std::endl;  
81 - delete application;  
82 - } 67 + // Report exception
  68 + report_ctool_failure("cterror", e.what());
83 69
84 - // Write error on standard output  
85 - std::cout << signal << std::endl;  
86 - std::cout << message << std::endl; 70 + }
87 71
88 - } // endcatch: catched any application error 72 + // Delete application
  73 + delete application;
89 74
90 // Return 75 // Return
91 return rc; 76 return rc;
src/ctexpcube/main.cpp
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 -#include <cstdio> 31 +#include "support.hpp"
32 #include "ctexpcube.hpp" 32 #include "ctexpcube.hpp"
33 33
34 34
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 * This is the main entry point of the ctexpcube application. It allocates a 41 * This is the main entry point of the ctexpcube application. It allocates a
42 * ctexpcube object and executes the application. Any exceptions that occur 42 * ctexpcube object and executes the application. Any exceptions that occur
43 * will be catched and corresponding error messages written in the 43 * will be catched and corresponding error messages written in the
44 - * application logger and on the standard output. 44 + * application logger and into the standard output.
45 ***************************************************************************/ 45 ***************************************************************************/
46 int main (int argc, char *argv[]) 46 int main (int argc, char *argv[])
47 { 47 {
@@ -60,32 +60,20 @@ int main (int argc, char *argv[]) @@ -60,32 +60,20 @@ int main (int argc, char *argv[])
60 // Execute application 60 // Execute application
61 application->execute(); 61 application->execute();
62 62
63 - // Delete application  
64 - delete application; 63 + // Execute ctool
  64 + rc = execute_ctool(application);
65 65
66 - // Signal success  
67 - rc = 0;  
68 } 66 }
69 - catch (std::exception &e) {  
70 67
71 - // Extract error message  
72 - std::string message = e.what();  
73 - std::string signal = "*** ERROR encounterted in the execution of "  
74 - "ctexpcube. Run aborted ..."; 68 + catch (std::exception &e) {
75 69
76 - // If application exists then write error in logger and delete  
77 - // application  
78 - if (application != NULL) {  
79 - application->log << signal << std::endl;  
80 - application->log << message << std::endl;  
81 - delete application;  
82 - } 70 + // Report exception
  71 + report_ctool_failure("ctexpcube", e.what());
83 72
84 - // Write error on standard output  
85 - std::cout << signal << std::endl;  
86 - std::cout << message << std::endl; 73 + }
87 74
88 - } // endcatch: catched any application error 75 + // Delete application
  76 + delete application;
89 77
90 // Return 78 // Return
91 return rc; 79 return rc;
src/ctlike/main.cpp
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 -#include <cstdio> 31 +#include "support.hpp"
32 #include "ctlike.hpp" 32 #include "ctlike.hpp"
33 33
34 34
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 * This is the main entry point of the ctlike application. It allocates a 41 * This is the main entry point of the ctlike application. It allocates a
42 * ctlike object and executes the application. Any exceptions that occur 42 * ctlike object and executes the application. Any exceptions that occur
43 * will be catched and corresponding error messages written in the 43 * will be catched and corresponding error messages written in the
44 - * application logger and on the standard output. 44 + * application logger and into the standard output.
45 ***************************************************************************/ 45 ***************************************************************************/
46 int main (int argc, char *argv[]) 46 int main (int argc, char *argv[])
47 { 47 {
@@ -57,35 +57,20 @@ int main (int argc, char *argv[]) @@ -57,35 +57,20 @@ int main (int argc, char *argv[])
57 // Create instance of application 57 // Create instance of application
58 application = new ctlike(argc, argv); 58 application = new ctlike(argc, argv);
59 59
60 - // Execute application  
61 - application->execute(); 60 + // Execute ctool
  61 + rc = execute_ctool(application);
62 62
63 - // Delete application  
64 - delete application;  
65 -  
66 - // Signal success  
67 - rc = 0;  
68 } 63 }
69 - catch (std::exception &e) {  
70 64
71 - // Extract error message  
72 - std::string message = e.what();  
73 - std::string signal = "*** ERROR encounterted in the execution of "  
74 - "ctlike. Run aborted ..."; 65 + catch (std::exception &e) {
75 66
76 - // If application exists then write error in logger and delete  
77 - // application  
78 - if (application != NULL) {  
79 - application->log << signal << std::endl;  
80 - application->log << message << std::endl;  
81 - delete application;  
82 - } 67 + // Report exception
  68 + report_ctool_failure("ctlike", e.what());
83 69
84 - // Write error on standard output  
85 - std::cout << signal << std::endl;  
86 - std::cout << message << std::endl; 70 + }
87 71
88 - } // endcatch: catched any application error 72 + // Delete application
  73 + delete application;
89 74
90 // Return 75 // Return
91 return rc; 76 return rc;
src/ctmapcube/main.cpp
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 -#include <cstdio> 31 +#include "support.hpp"
32 #include "ctmapcube.hpp" 32 #include "ctmapcube.hpp"
33 33
34 34
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 * This is the main entry point of the ctmapcube application. It allocates a 41 * This is the main entry point of the ctmapcube application. It allocates a
42 * ctmapcube object and executes the application. Any exceptions that occur 42 * ctmapcube object and executes the application. Any exceptions that occur
43 * will be catched and corresponding error messages written in the 43 * will be catched and corresponding error messages written in the
44 - * application logger and on the standard output. 44 + * application logger and into the standard output.
45 ***************************************************************************/ 45 ***************************************************************************/
46 int main (int argc, char *argv[]) 46 int main (int argc, char *argv[])
47 { 47 {
@@ -57,35 +57,20 @@ int main (int argc, char *argv[]) @@ -57,35 +57,20 @@ int main (int argc, char *argv[])
57 // Create instance of application 57 // Create instance of application
58 application = new ctmapcube(argc, argv); 58 application = new ctmapcube(argc, argv);
59 59
60 - // Execute application  
61 - application->execute(); 60 + // Execute ctool
  61 + rc = execute_ctool(application);
62 62
63 - // Delete application  
64 - delete application;  
65 -  
66 - // Signal success  
67 - rc = 0;  
68 } 63 }
69 - catch (std::exception &e) {  
70 64
71 - // Extract error message  
72 - std::string message = e.what();  
73 - std::string signal = "*** ERROR encounterted in the execution of "  
74 - "ctmapcube. Run aborted ..."; 65 + catch (std::exception &e) {
75 66
76 - // If application exists then write error in logger and delete  
77 - // application  
78 - if (application != NULL) {  
79 - application->log << signal << std::endl;  
80 - application->log << message << std::endl;  
81 - delete application;  
82 - } 67 + // Report exception
  68 + report_ctool_failure("ctmapcube", e.what());
83 69
84 - // Write error on standard output  
85 - std::cout << signal << std::endl;  
86 - std::cout << message << std::endl; 70 + }
87 71
88 - } // endcatch: catched any application error 72 + // Delete application
  73 + delete application;
89 74
90 // Return 75 // Return
91 return rc; 76 return rc;
src/ctmodel/main.cpp
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 -#include <cstdio> 31 +#include "support.hpp"
32 #include "ctmodel.hpp" 32 #include "ctmodel.hpp"
33 33
34 34
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 * This is the main entry point of the ctmodel application. It allocates a 41 * This is the main entry point of the ctmodel application. It allocates a
42 * ctmodel object and executes the application. Any exceptions that occur 42 * ctmodel object and executes the application. Any exceptions that occur
43 * will be catched and corresponding error messages written in the 43 * will be catched and corresponding error messages written in the
44 - * application logger and on the standard output. 44 + * application logger and into the standard output.
45 ***************************************************************************/ 45 ***************************************************************************/
46 int main (int argc, char *argv[]) 46 int main (int argc, char *argv[])
47 { 47 {
@@ -57,34 +57,20 @@ int main (int argc, char *argv[]) @@ -57,34 +57,20 @@ int main (int argc, char *argv[])
57 // Create instance of application 57 // Create instance of application
58 application = new ctmodel(argc, argv); 58 application = new ctmodel(argc, argv);
59 59
60 - // Execute application  
61 - application->execute(); 60 + // Execute ctool
  61 + rc = execute_ctool(application);
62 62
63 - // Delete application  
64 - delete application;  
65 -  
66 - // Signal success  
67 - rc = 0;  
68 } 63 }
  64 +
69 catch (std::exception &e) { 65 catch (std::exception &e) {
70 66
71 - // Extract error message  
72 - std::string message = e.what();  
73 - std::string signal = "*** ERROR encounterted in the execution of "  
74 - "ctmodel. Run aborted ..."; 67 + // Report exception
  68 + report_ctool_failure("ctmodel", e.what());
75 69
76 - // If application exists then write error in logger and delete  
77 - // application  
78 - if (application != NULL) {  
79 - application->log << signal << std::endl;  
80 - application->log << message << std::endl;  
81 - delete application;  
82 - }  
83 - // Write error on standard output  
84 - std::cout << signal << std::endl;  
85 - std::cout << message << std::endl; 70 + }
86 71
87 - } // endcatch: catched any application error 72 + // Delete application
  73 + delete application;
88 74
89 // Return 75 // Return
90 return rc; 76 return rc;
src/ctobssim/main.cpp
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 -#include <cstdio> 31 +#include "support.hpp"
32 #include "ctobssim.hpp" 32 #include "ctobssim.hpp"
33 33
34 34
@@ -57,35 +57,20 @@ int main (int argc, char *argv[]) @@ -57,35 +57,20 @@ int main (int argc, char *argv[])
57 // Create instance of application 57 // Create instance of application
58 application = new ctobssim(argc, argv); 58 application = new ctobssim(argc, argv);
59 59
60 - // Execute application  
61 - application->execute(); 60 + // Execute ctool
  61 + rc = execute_ctool(application);
62 62
63 - // Delete application  
64 - delete application;  
65 -  
66 - // Signal success  
67 - rc = 0;  
68 } 63 }
69 - catch (std::exception &e) {  
70 64
71 - // Extract error message  
72 - std::string message = e.what();  
73 - std::string signal = "*** ERROR encounterted in the execution of "  
74 - "ctobssim. Run aborted ..."; 65 + catch (std::exception &e) {
75 66
76 - // If application exists then write error in logger and delete  
77 - // application  
78 - if (application != NULL) {  
79 - application->log << signal << std::endl;  
80 - application->log << message << std::endl;  
81 - delete application;  
82 - } 67 + // Report exception
  68 + report_ctool_failure("ctobssim", e.what());
83 69
84 - // Write error on standard output  
85 - std::cout << signal << std::endl;  
86 - std::cout << message << std::endl; 70 + }
87 71
88 - } // endcatch: catched any application error 72 + // Delete application
  73 + delete application;
89 74
90 // Return 75 // Return
91 return rc; 76 return rc;
src/ctpsfcube/main.cpp
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 -#include <cstdio> 31 +#include "support.hpp"
32 #include "ctpsfcube.hpp" 32 #include "ctpsfcube.hpp"
33 33
34 34
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 * This is the main entry point of the ctpsfcube application. It allocates a 41 * This is the main entry point of the ctpsfcube application. It allocates a
42 * ctpsfcube object and executes the application. Any exceptions that occur 42 * ctpsfcube object and executes the application. Any exceptions that occur
43 * will be catched and corresponding error messages written in the 43 * will be catched and corresponding error messages written in the
44 - * application logger and on the standard output. 44 + * application logger and into the standard output.
45 ***************************************************************************/ 45 ***************************************************************************/
46 int main (int argc, char *argv[]) 46 int main (int argc, char *argv[])
47 { 47 {
@@ -57,35 +57,20 @@ int main (int argc, char *argv[]) @@ -57,35 +57,20 @@ int main (int argc, char *argv[])
57 // Create instance of application 57 // Create instance of application
58 application = new ctpsfcube(argc, argv); 58 application = new ctpsfcube(argc, argv);
59 59
60 - // Execute application  
61 - application->execute(); 60 + // Execute ctool
  61 + rc = execute_ctool(application);
62 62
63 - // Delete application  
64 - delete application;  
65 -  
66 - // Signal success  
67 - rc = 0;  
68 } 63 }
69 - catch (std::exception &e) {  
70 64
71 - // Extract error message  
72 - std::string message = e.what();  
73 - std::string signal = "*** ERROR encounterted in the execution of "  
74 - "ctpsfcube. Run aborted ..."; 65 + catch (std::exception &e) {
75 66
76 - // If application exists then write error in logger and delete  
77 - // application  
78 - if (application != NULL) {  
79 - application->log << signal << std::endl;  
80 - application->log << message << std::endl;  
81 - delete application;  
82 - } 67 + // Report exception
  68 + report_ctool_failure("ctpsfcube", e.what());
83 69
84 - // Write error on standard output  
85 - std::cout << signal << std::endl;  
86 - std::cout << message << std::endl; 70 + }
87 71
88 - } // endcatch: catched any application error 72 + // Delete application
  73 + delete application;
89 74
90 // Return 75 // Return
91 return rc; 76 return rc;
src/ctselect/main.cpp
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 -#include <cstdio> 31 +#include "support.hpp"
32 #include "ctselect.hpp" 32 #include "ctselect.hpp"
33 33
34 34
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 * This is the main entry point of the ctselect application. It allocates a 41 * This is the main entry point of the ctselect application. It allocates a
42 * ctselect object and executes the application. Any exceptions that occur 42 * ctselect object and executes the application. Any exceptions that occur
43 * will be catched and corresponding error messages written in the 43 * will be catched and corresponding error messages written in the
44 - * application logger and on the standard output. 44 + * application logger and into the standard output.
45 ***************************************************************************/ 45 ***************************************************************************/
46 int main (int argc, char *argv[]) 46 int main (int argc, char *argv[])
47 { 47 {
@@ -57,35 +57,20 @@ int main (int argc, char *argv[]) @@ -57,35 +57,20 @@ int main (int argc, char *argv[])
57 // Create instance of application 57 // Create instance of application
58 application = new ctselect(argc, argv); 58 application = new ctselect(argc, argv);
59 59
60 - // Execute application  
61 - application->execute(); 60 + // Execute ctool
  61 + rc = execute_ctool(application);
62 62
63 - // Delete application  
64 - delete application;  
65 -  
66 - // Signal success  
67 - rc = 0;  
68 } 63 }
69 - catch (std::exception &e) {  
70 64
71 - // Extract error message  
72 - std::string message = e.what();  
73 - std::string signal = "*** ERROR encounterted in the execution of "  
74 - "ctselect. Run aborted ..."; 65 + catch (std::exception &e) {
75 66
76 - // If application exists then write error in logger and delete  
77 - // application  
78 - if (application != NULL) {  
79 - application->log << signal << std::endl;  
80 - application->log << message << std::endl;  
81 - delete application;  
82 - } 67 + // Report exception
  68 + report_ctool_failure("ctselect", e.what());
83 69
84 - // Write error on standard output  
85 - std::cout << message << std::endl;  
86 - std::cout << signal << std::endl; 70 + }
87 71
88 - } // endcatch: catched any application error 72 + // Delete application
  73 + delete application;
89 74
90 // Return 75 // Return
91 return rc; 76 return rc;
src/ctskymap/main.cpp
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 -#include <cstdio> 31 +#include "support.hpp"
32 #include "ctskymap.hpp" 32 #include "ctskymap.hpp"
33 33
34 34
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 * This is the main entry point of the ctskymap application. It allocates a 41 * This is the main entry point of the ctskymap application. It allocates a
42 * ctskymap object and executes the application. Any exceptions that occur 42 * ctskymap object and executes the application. Any exceptions that occur
43 * will be catched and corresponding error messages written in the 43 * will be catched and corresponding error messages written in the
44 - * application logger and on the standard output. 44 + * application logger and into the standard output.
45 ***************************************************************************/ 45 ***************************************************************************/
46 int main (int argc, char *argv[]) 46 int main (int argc, char *argv[])
47 { 47 {
@@ -57,35 +57,20 @@ int main (int argc, char *argv[]) @@ -57,35 +57,20 @@ int main (int argc, char *argv[])
57 // Create instance of application 57 // Create instance of application
58 application = new ctskymap(argc, argv); 58 application = new ctskymap(argc, argv);
59 59
60 - // Execute application  
61 - application->execute(); 60 + // Execute ctool
  61 + rc = execute_ctool(application);
62 62
63 - // Delete application  
64 - delete application;  
65 -  
66 - // Signal success  
67 - rc = 0;  
68 } 63 }
69 - catch (std::exception &e) {  
70 64
71 - // Extract error message  
72 - std::string message = e.what();  
73 - std::string signal = "*** ERROR encounterted in the execution of "  
74 - "ctskymap. Run aborted ..."; 65 + catch (std::exception &e) {
75 66
76 - // If application exists then write error in logger and delete  
77 - // application  
78 - if (application != NULL) {  
79 - application->log << signal << std::endl;  
80 - application->log << message << std::endl;  
81 - delete application;  
82 - } 67 + // Report exception
  68 + report_ctool_failure("ctskymap", e.what());
83 69
84 - // Write error on standard output  
85 - std::cout << signal << std::endl;  
86 - std::cout << message << std::endl; 70 + }
87 71
88 - } // endcatch: catched any application error 72 + // Delete application
  73 + delete application;
89 74
90 // Return 75 // Return
91 return rc; 76 return rc;
src/cttsmap/main.cpp
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 -#include <cstdio> 31 +#include "support.hpp"
32 #include "cttsmap.hpp" 32 #include "cttsmap.hpp"
33 33
34 34
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 * This is the main entry point of the cttsmap application. It allocates a 41 * This is the main entry point of the cttsmap application. It allocates a
42 * cttsmap object and executes the application. Any exceptions that occur 42 * cttsmap object and executes the application. Any exceptions that occur
43 * will be catched and corresponding error messages written in the 43 * will be catched and corresponding error messages written in the
44 - * application logger and on the standard output. 44 + * application logger and into the standard output.
45 ***************************************************************************/ 45 ***************************************************************************/
46 int main (int argc, char *argv[]) 46 int main (int argc, char *argv[])
47 { 47 {
@@ -57,35 +57,20 @@ int main (int argc, char *argv[]) @@ -57,35 +57,20 @@ int main (int argc, char *argv[])
57 // Create instance of application 57 // Create instance of application
58 application = new cttsmap(argc, argv); 58 application = new cttsmap(argc, argv);
59 59
60 - // Execute application  
61 - application->execute(); 60 + // Execute ctool
  61 + rc = execute_ctool(application);
62 62
63 - // Delete application  
64 - delete application;  
65 -  
66 - // Signal success  
67 - rc = 0;  
68 } 63 }
69 - catch (std::exception &e) {  
70 64
71 - // Extract error message  
72 - std::string message = e.what();  
73 - std::string signal = "*** ERROR encounterted in the execution of "  
74 - "cttsmap. Run aborted ..."; 65 + catch (std::exception &e) {
75 66
76 - // If application exists then write error in logger and delete  
77 - // application  
78 - if (application != NULL) {  
79 - application->log << signal << std::endl;  
80 - application->log << message << std::endl;  
81 - delete application;  
82 - } 67 + // Report exception
  68 + report_ctool_failure("cttsmap", e.what());
83 69
84 - // Write error on standard output  
85 - std::cout << signal << std::endl;  
86 - std::cout << message << std::endl; 70 + }
87 71
88 - } // endcatch: catched any application error 72 + // Delete application
  73 + delete application;
89 74
90 // Return 75 // Return
91 return rc; 76 return rc;
src/ctulimit/main.cpp
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 -#include <cstdio> 31 +#include "support.hpp"
32 #include "ctulimit.hpp" 32 #include "ctulimit.hpp"
33 33
34 34
@@ -39,7 +39,9 @@ @@ -39,7 +39,9 @@
39 * @param[in] argv Command line arguments. 39 * @param[in] argv Command line arguments.
40 * 40 *
41 * This is the main entry point of the ctulimit application. It allocates a 41 * This is the main entry point of the ctulimit application. It allocates a
42 - * ctupperlimit object and runs the application. 42 + * ctulimit object and executes the application. Any exceptions that occur
  43 + * will be catched and corresponding error messages written in the
  44 + * application logger and into the standard output.
43 ***************************************************************************/ 45 ***************************************************************************/
44 int main (int argc, char *argv[]) 46 int main (int argc, char *argv[])
45 { 47 {
@@ -55,35 +57,20 @@ int main (int argc, char *argv[]) @@ -55,35 +57,20 @@ int main (int argc, char *argv[])
55 // Create instance of application 57 // Create instance of application
56 application = new ctulimit(argc, argv); 58 application = new ctulimit(argc, argv);
57 59
58 - // Execute application  
59 - application->execute(); 60 + // Execute ctool
  61 + rc = execute_ctool(application);
60 62
61 - // Delete application  
62 - delete application;  
63 -  
64 - // Signal success  
65 - rc = 0;  
66 } 63 }
67 - catch (std::exception &e) {  
68 64
69 - // Extract error message  
70 - std::string message = e.what();  
71 - std::string signal = "*** ERROR encounterted in the execution of "  
72 - "ctulimit. Run aborted ..."; 65 + catch (std::exception &e) {
73 66
74 - // If application exists then write error in logger and delete  
75 - // application  
76 - if (application != NULL) {  
77 - application->log << signal << std::endl;  
78 - application->log << message << std::endl;  
79 - delete application;  
80 - } 67 + // Report exception
  68 + report_ctool_failure("ctulimit", e.what());
81 69
82 - // Write error on standard output  
83 - std::cout << signal << std::endl;  
84 - std::cout << message << std::endl; 70 + }
85 71
86 - } // endcatch: catched any application error 72 + // Delete application
  73 + delete application;
87 74
88 // Return 75 // Return
89 return rc; 76 return rc;
src/support/Makefile.am
@@ -20,7 +20,8 @@ @@ -20,7 +20,8 @@
20 ############################################################################# 20 #############################################################################
21 21
22 # Define sources for this directory 22 # Define sources for this directory
23 -sources = ctool.cpp ctool.hpp \ 23 +sources = support.cpp support.hpp \
  24 + ctool.cpp ctool.hpp \
24 ctobservation.cpp ctobservation.hpp \ 25 ctobservation.cpp ctobservation.hpp \
25 ctlikelihood.cpp ctlikelihood.hpp 26 ctlikelihood.cpp ctlikelihood.hpp
26 27
src/support/support.cpp 0 → 100644
  1 +/***************************************************************************
  2 + * support - support functions *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2016 by Juergen Knoedlseder *
  5 + * ----------------------------------------------------------------------- *
  6 + * *
  7 + * This program is free software: you can redistribute it and/or modify *
  8 + * it under the terms of the GNU General Public License as published by *
  9 + * the Free Software Foundation, either version 3 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + * This program is distributed in the hope that it will be useful, *
  13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  15 + * GNU General Public License for more details. *
  16 + * *
  17 + * You should have received a copy of the GNU General Public License *
  18 + * along with this program. If not, see <http://www.gnu.org/licenses/>. *
  19 + * *
  20 + ***************************************************************************/
  21 +/**
  22 + * @file support
  23 + * @brief Support function implementation
  24 + * @author Juergen Knoedlseder
  25 + */
  26 +
  27 +/* __ Includes ___________________________________________________________ */
  28 +#ifdef HAVE_CONFIG_H
  29 +#include <config.h>
  30 +#endif
  31 +//#include <cstdlib> // std::getenv() function
  32 +//#include <cstdio> // std::fopen(), etc. functions
  33 +#include "GammaLib.hpp"
  34 +#include "GCTALib.hpp"
  35 +#include "support.hpp"
  36 +//#include "GTools.hpp"
  37 +
  38 +/* __ Method name definitions ____________________________________________ */
  39 +
  40 +/* __ Debug definitions __________________________________________________ */
  41 +
  42 +/* __ Coding definitions _________________________________________________ */
  43 +
  44 +
  45 +/*==========================================================================
  46 + = =
  47 + = Support functions =
  48 + = =
  49 + ==========================================================================*/
  50 +
  51 +/***********************************************************************//**
  52 + * @brief Execute ctool
  53 + *
  54 + * @param[in] tool Pointer to ctool.
  55 + * @return Return code
  56 + *
  57 + * Executes a ctool. The execution is enclosed in a try-catch statement so
  58 + * that any exceptions that occur during execution will be properly logged
  59 + * and written into the standard output.
  60 + ***************************************************************************/
  61 +int execute_ctool(ctool* tool)
  62 +{
  63 + // Initialise return code
  64 + int rc = 1;
  65 +
  66 + // Try executing tool. This catches any exceptions that occur during
  67 + // the execution.
  68 + try {
  69 +
  70 + // Execute ctool
  71 + tool->execute();
  72 +
  73 + // Signal success
  74 + rc = 0;
  75 +
  76 + } // endtry
  77 +
  78 + // Handle any exceptions that have occured
  79 + catch (std::exception &e) {
  80 +
  81 + // Extract error message
  82 + std::string message = e.what();
  83 + std::string signal = "*** ERROR encounterted in the execution of "+
  84 + tool->name()+". Run aborted ...";
  85 +
  86 + // Write error in logger
  87 + tool->log << signal << std::endl;
  88 + tool->log << message << std::endl;
  89 +
  90 + // Write error in standard output
  91 + std::cout << signal << std::endl;
  92 + std::cout << message << std::endl;
  93 +
  94 + } // endcatch: catched any exception
  95 +
  96 + // Return return code
  97 + return rc;
  98 +}
  99 +
  100 +
  101 +/***********************************************************************//**
  102 + * @brief Report ctool failure
  103 + *
  104 + * @param[in] name Name of ctool.
  105 + * @param[in] message Exception message.
  106 + *
  107 + * Reports a ctools failure.
  108 + ***************************************************************************/
  109 +void report_ctool_failure(const std::string& name, const std::string& message)
  110 +{
  111 + // Set signal string
  112 + std::string signal = "*** ERROR encounterted in the execution of "+
  113 + name+". Run aborted ...";
  114 +
  115 + // Write error in standard output
  116 + std::cout << signal << std::endl;
  117 + std::cout << message << std::endl;
  118 +
  119 + // Return
  120 + return;
  121 +}
src/support/support.hpp 0 → 100644
  1 +/***************************************************************************
  2 + * support - support functions *
  3 + * ----------------------------------------------------------------------- *
  4 + * copyright (C) 2016 by Juergen Knoedlseder *
  5 + * ----------------------------------------------------------------------- *
  6 + * *
  7 + * This program is free software: you can redistribute it and/or modify *
  8 + * it under the terms of the GNU General Public License as published by *
  9 + * the Free Software Foundation, either version 3 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + * This program is distributed in the hope that it will be useful, *
  13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  15 + * GNU General Public License for more details. *
  16 + * *
  17 + * You should have received a copy of the GNU General Public License *
  18 + * along with this program. If not, see <http://www.gnu.org/licenses/>. *
  19 + * *
  20 + ***************************************************************************/
  21 +/**
  22 + * @file support
  23 + * @brief Support function definitions
  24 + * @author Juergen Knoedlseder
  25 + */
  26 +
  27 +#ifndef SUPPORT_HPP
  28 +#define SUPPORT_HPP
  29 +
  30 +/* __ Includes ___________________________________________________________ */
  31 +#include "ctool.hpp"
  32 +
  33 +/* __ Definitions ________________________________________________________ */
  34 +
  35 +/* __ Prototypes _________________________________________________________ */
  36 +int execute_ctool(ctool* tool);
  37 +void report_ctool_failure(const std::string& name, const std::string& message);
  38 +
  39 +#endif /* SUPPORT_HPP */
test/test_ctbin.py
@@ -82,7 +82,7 @@ class Test(test): @@ -82,7 +82,7 @@ class Test(test):
82 'Self test of test script') 82 'Self test of test script')
83 83
84 # Check if execution was successful 84 # Check if execution was successful
85 - self.test_assert(self._execute(cmd) == 0, 85 + self.test_value(self._execute(cmd), 0,
86 'Check successful execution from command line') 86 'Check successful execution from command line')
87 87
88 # Load counts cube and check content. 88 # Load counts cube and check content.
@@ -107,13 +107,11 @@ class Test(test): @@ -107,13 +107,11 @@ class Test(test):
107 # Check if execution was successful in case that the CTOOLS 107 # Check if execution was successful in case that the CTOOLS
108 # environment variable was set or failed otherwise 108 # environment variable was set or failed otherwise
109 if 'CTOOLS' in os.environ: 109 if 'CTOOLS' in os.environ:
110 - rc = 0  
111 - what = 'success' 110 + self.test_value(self._execute(cmd), 0,
  111 + 'Check successful execution with --help option')
112 else: 112 else:
113 - rc = 1  
114 - what = 'failure'  
115 - self.test_value(self._execute(cmd), rc,  
116 - 'Check execution %s from command line with --help option' % what) 113 + self.test_assert(self._execute(cmd) != 0,
  114 + 'Check execution failure with --help option')
117 115
118 # Return 116 # Return
119 return 117 return
test/test_ctbkgcube.py
@@ -110,13 +110,11 @@ class Test(test): @@ -110,13 +110,11 @@ class Test(test):
110 # Check if execution was successful in case that the CTOOLS 110 # Check if execution was successful in case that the CTOOLS
111 # environment variable was set or failed otherwise 111 # environment variable was set or failed otherwise
112 if 'CTOOLS' in os.environ: 112 if 'CTOOLS' in os.environ:
113 - rc = 0  
114 - what = 'success' 113 + self.test_value(self._execute(cmd), 0,
  114 + 'Check successful execution with --help option')
115 else: 115 else:
116 - rc = 1  
117 - what = 'failure'  
118 - self.test_value(self._execute(cmd), rc,  
119 - 'Check execution %s from command line with --help option' % what) 116 + self.test_assert(self._execute(cmd) != 0,
  117 + 'Check execution failure with --help option')
120 118
121 # Return 119 # Return
122 return 120 return
test/test_ctbutterfly.py
@@ -102,13 +102,11 @@ class Test(test): @@ -102,13 +102,11 @@ class Test(test):
102 # Check if execution was successful in case that the CTOOLS 102 # Check if execution was successful in case that the CTOOLS
103 # environment variable was set or failed otherwise 103 # environment variable was set or failed otherwise
104 if 'CTOOLS' in os.environ: 104 if 'CTOOLS' in os.environ:
105 - rc = 0  
106 - what = 'success' 105 + self.test_value(self._execute(cmd), 0,
  106 + 'Check successful execution with --help option')
107 else: 107 else:
108 - rc = 1  
109 - what = 'failure'  
110 - self.test_value(self._execute(cmd), rc,  
111 - 'Check execution %s from command line with --help option' % what) 108 + self.test_assert(self._execute(cmd) != 0,
  109 + 'Check execution failure with --help option')
112 110
113 # Return 111 # Return
114 return 112 return
test/test_ctcubemask.py
@@ -105,13 +105,11 @@ class Test(test): @@ -105,13 +105,11 @@ class Test(test):
105 # Check if execution was successful in case that the CTOOLS 105 # Check if execution was successful in case that the CTOOLS
106 # environment variable was set or failed otherwise 106 # environment variable was set or failed otherwise
107 if 'CTOOLS' in os.environ: 107 if 'CTOOLS' in os.environ:
108 - rc = 0  
109 - what = 'success' 108 + self.test_value(self._execute(cmd), 0,
  109 + 'Check successful execution with --help option')
110 else: 110 else:
111 - rc = 1  
112 - what = 'failure'  
113 - self.test_value(self._execute(cmd), rc,  
114 - 'Check execution %s from command line with --help option' % what) 111 + self.test_assert(self._execute(cmd) != 0,
  112 + 'Check execution failure with --help option')
115 113
116 # Return 114 # Return
117 return 115 return
test/test_ctedispcube.py
@@ -108,13 +108,11 @@ class Test(test): @@ -108,13 +108,11 @@ class Test(test):
108 # Check if execution was successful in case that the CTOOLS 108 # Check if execution was successful in case that the CTOOLS
109 # environment variable was set or failed otherwise 109 # environment variable was set or failed otherwise
110 if 'CTOOLS' in os.environ: 110 if 'CTOOLS' in os.environ:
111 - rc = 0  
112 - what = 'success' 111 + self.test_value(self._execute(cmd), 0,
  112 + 'Check successful execution with --help option')
113 else: 113 else:
114 - rc = 1  
115 - what = 'failure'  
116 - self.test_value(self._execute(cmd), rc,  
117 - 'Check execution %s from command line with --help option' % what) 114 + self.test_assert(self._execute(cmd) != 0,
  115 + 'Check execution failure with --help option')
118 116
119 # Return 117 # Return
120 return 118 return
test/test_cterror.py
@@ -100,13 +100,11 @@ class Test(test): @@ -100,13 +100,11 @@ class Test(test):
100 # Check if execution was successful in case that the CTOOLS 100 # Check if execution was successful in case that the CTOOLS
101 # environment variable was set or failed otherwise 101 # environment variable was set or failed otherwise
102 if 'CTOOLS' in os.environ: 102 if 'CTOOLS' in os.environ:
103 - rc = 0  
104 - what = 'success' 103 + self.test_value(self._execute(cmd), 0,
  104 + 'Check successful execution with --help option')
105 else: 105 else:
106 - rc = 1  
107 - what = 'failure'  
108 - self.test_value(self._execute(cmd), rc,  
109 - 'Check execution %s from command line with --help option' % what) 106 + self.test_assert(self._execute(cmd) != 0,
  107 + 'Check execution failure with --help option')
110 108
111 # Return 109 # Return
112 return 110 return
test/test_ctexpcube.py
@@ -106,13 +106,11 @@ class Test(test): @@ -106,13 +106,11 @@ class Test(test):
106 # Check if execution was successful in case that the CTOOLS 106 # Check if execution was successful in case that the CTOOLS
107 # environment variable was set or failed otherwise 107 # environment variable was set or failed otherwise
108 if 'CTOOLS' in os.environ: 108 if 'CTOOLS' in os.environ:
109 - rc = 0  
110 - what = 'success' 109 + self.test_value(self._execute(cmd), 0,
  110 + 'Check successful execution with --help option')
111 else: 111 else:
112 - rc = 1  
113 - what = 'failure'  
114 - self.test_value(self._execute(cmd), rc,  
115 - 'Check execution %s from command line with --help option' % what) 112 + self.test_assert(self._execute(cmd) != 0,
  113 + 'Check execution failure with --help option')
116 114
117 # Return 115 # Return
118 return 116 return
test/test_ctlike.py
@@ -100,13 +100,11 @@ class Test(test): @@ -100,13 +100,11 @@ class Test(test):
100 # Check if execution was successful in case that the CTOOLS 100 # Check if execution was successful in case that the CTOOLS
101 # environment variable was set or failed otherwise 101 # environment variable was set or failed otherwise
102 if 'CTOOLS' in os.environ: 102 if 'CTOOLS' in os.environ:
103 - rc = 0  
104 - what = 'success' 103 + self.test_value(self._execute(cmd), 0,
  104 + 'Check successful execution with --help option')
105 else: 105 else:
106 - rc = 1  
107 - what = 'failure'  
108 - self.test_value(self._execute(cmd), rc,  
109 - 'Check execution %s from command line with --help option' % what) 106 + self.test_assert(self._execute(cmd) != 0,
  107 + 'Check execution failure with --help option')
110 108
111 # Return 109 # Return
112 return 110 return
test/test_ctmapcube.py
@@ -106,13 +106,11 @@ class Test(test): @@ -106,13 +106,11 @@ class Test(test):
106 # Check if execution was successful in case that the CTOOLS 106 # Check if execution was successful in case that the CTOOLS
107 # environment variable was set or failed otherwise 107 # environment variable was set or failed otherwise
108 if 'CTOOLS' in os.environ: 108 if 'CTOOLS' in os.environ:
109 - rc = 0  
110 - what = 'success' 109 + self.test_value(self._execute(cmd), 0,
  110 + 'Check successful execution with --help option')
111 else: 111 else:
112 - rc = 1  
113 - what = 'failure'  
114 - self.test_value(self._execute(cmd), rc,  
115 - 'Check execution %s from command line with --help option' % what) 112 + self.test_assert(self._execute(cmd) != 0,
  113 + 'Check execution failure with --help option')
116 114
117 # Return 115 # Return
118 return 116 return
test/test_ctmodel.py
@@ -110,13 +110,11 @@ class Test(test): @@ -110,13 +110,11 @@ class Test(test):
110 # Check if execution was successful in case that the CTOOLS 110 # Check if execution was successful in case that the CTOOLS
111 # environment variable was set or failed otherwise 111 # environment variable was set or failed otherwise
112 if 'CTOOLS' in os.environ: 112 if 'CTOOLS' in os.environ:
113 - rc = 0  
114 - what = 'success' 113 + self.test_value(self._execute(cmd), 0,
  114 + 'Check successful execution with --help option')
115 else: 115 else:
116 - rc = 1  
117 - what = 'failure'  
118 - self.test_value(self._execute(cmd), rc,  
119 - 'Check execution %s from command line with --help option' % what) 116 + self.test_assert(self._execute(cmd) != 0,
  117 + 'Check execution failure with --help option')
120 118
121 # Return 119 # Return
122 return 120 return
test/test_ctobssim.py
@@ -108,13 +108,11 @@ class Test(test): @@ -108,13 +108,11 @@ class Test(test):
108 # Check if execution was successful in case that the CTOOLS 108 # Check if execution was successful in case that the CTOOLS
109 # environment variable was set or failed otherwise 109 # environment variable was set or failed otherwise
110 if 'CTOOLS' in os.environ: 110 if 'CTOOLS' in os.environ:
111 - rc = 0  
112 - what = 'success' 111 + self.test_value(self._execute(cmd), 0,
  112 + 'Check successful execution with --help option')
113 else: 113 else:
114 - rc = 1  
115 - what = 'failure'  
116 - self.test_value(self._execute(cmd), rc,  
117 - 'Check execution %s from command line with --help option' % what) 114 + self.test_assert(self._execute(cmd) != 0,
  115 + 'Check execution failure with --help option')
118 116
119 # Return 117 # Return
120 return 118 return
test/test_ctpsfcube.py
@@ -108,13 +108,11 @@ class Test(test): @@ -108,13 +108,11 @@ class Test(test):
108 # Check if execution was successful in case that the CTOOLS 108 # Check if execution was successful in case that the CTOOLS
109 # environment variable was set or failed otherwise 109 # environment variable was set or failed otherwise
110 if 'CTOOLS' in os.environ: 110 if 'CTOOLS' in os.environ:
111 - rc = 0  
112 - what = 'success' 111 + self.test_value(self._execute(cmd), 0,
  112 + 'Check successful execution with --help option')
113 else: 113 else:
114 - rc = 1  
115 - what = 'failure'  
116 - self.test_value(self._execute(cmd), rc,  
117 - 'Check execution %s from command line with --help option' % what) 114 + self.test_assert(self._execute(cmd) != 0,
  115 + 'Check execution failure with --help option')
118 116
119 # Return 117 # Return
120 return 118 return
test/test_ctselect.py
@@ -105,13 +105,11 @@ class Test(test): @@ -105,13 +105,11 @@ class Test(test):
105 # Check if execution was successful in case that the CTOOLS 105 # Check if execution was successful in case that the CTOOLS
106 # environment variable was set or failed otherwise 106 # environment variable was set or failed otherwise
107 if 'CTOOLS' in os.environ: 107 if 'CTOOLS' in os.environ:
108 - rc = 0  
109 - what = 'success' 108 + self.test_value(self._execute(cmd), 0,
  109 + 'Check successful execution with --help option')
110 else: 110 else:
111 - rc = 1  
112 - what = 'failure'  
113 - self.test_value(self._execute(cmd), rc,  
114 - 'Check execution %s from command line with --help option' % what) 111 + self.test_assert(self._execute(cmd) != 0,
  112 + 'Check execution failure with --help option')
115 113
116 # Return 114 # Return
117 return 115 return
test/test_ctskymap.py
@@ -102,13 +102,11 @@ class Test(test): @@ -102,13 +102,11 @@ class Test(test):
102 # Check if execution was successful in case that the CTOOLS 102 # Check if execution was successful in case that the CTOOLS
103 # environment variable was set or failed otherwise 103 # environment variable was set or failed otherwise
104 if 'CTOOLS' in os.environ: 104 if 'CTOOLS' in os.environ:
105 - rc = 0  
106 - what = 'success' 105 + self.test_value(self._execute(cmd), 0,
  106 + 'Check successful execution with --help option')
107 else: 107 else:
108 - rc = 1  
109 - what = 'failure'  
110 - self.test_value(self._execute(cmd), rc,  
111 - 'Check execution %s from command line with --help option' % what) 108 + self.test_assert(self._execute(cmd) != 0,
  109 + 'Check execution failure with --help option')
112 110
113 # Return 111 # Return
114 return 112 return
test/test_cttsmap.py
@@ -104,13 +104,11 @@ class Test(test): @@ -104,13 +104,11 @@ class Test(test):
104 # Check if execution was successful in case that the CTOOLS 104 # Check if execution was successful in case that the CTOOLS
105 # environment variable was set or failed otherwise 105 # environment variable was set or failed otherwise
106 if 'CTOOLS' in os.environ: 106 if 'CTOOLS' in os.environ:
107 - rc = 0  
108 - what = 'success' 107 + self.test_value(self._execute(cmd), 0,
  108 + 'Check successful execution with --help option')
109 else: 109 else:
110 - rc = 1  
111 - what = 'failure'  
112 - self.test_value(self._execute(cmd), rc,  
113 - 'Check execution %s from command line with --help option' % what) 110 + self.test_assert(self._execute(cmd) != 0,
  111 + 'Check execution failure with --help option')
114 112
115 # Return 113 # Return
116 return 114 return
test/test_ctulimit.py
@@ -98,13 +98,11 @@ class Test(test): @@ -98,13 +98,11 @@ class Test(test):
98 # Check if execution was successful in case that the CTOOLS 98 # Check if execution was successful in case that the CTOOLS
99 # environment variable was set or failed otherwise 99 # environment variable was set or failed otherwise
100 if 'CTOOLS' in os.environ: 100 if 'CTOOLS' in os.environ:
101 - rc = 0  
102 - what = 'success' 101 + self.test_value(self._execute(cmd), 0,
  102 + 'Check successful execution with --help option')
103 else: 103 else:
104 - rc = 1  
105 - what = 'failure'  
106 - self.test_value(self._execute(cmd), rc,  
107 - 'Check execution %s from command line with --help option' % what) 104 + self.test_assert(self._execute(cmd) != 0,
  105 + 'Check execution failure with --help option')
108 106
109 # Return 107 # Return
110 return 108 return