summaryrefslogtreecommitdiff
path: root/maximus/unittest
diff options
context:
space:
mode:
authorburet2007-08-23 10:26:50 +0000
committerburet2007-08-23 10:26:50 +0000
commit66fb962d9e71ec356586fa51b1da1505f255da32 (patch)
treedf45173849e2b1f830fb5713ce4a2d394fe97208 /maximus/unittest
parent70d576f13f8d9b150a38f6ad45c5637ab38681a9 (diff)
Maximus:
- solve segmentation fault problem - clean Maximus logs and unitary tests logs - remove SAR test files (they have been moved) git-svn-id: svn+ssh://pessac/svn/cesar/trunk@600 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'maximus/unittest')
-rw-r--r--maximus/unittest/src/main.cpp84
1 files changed, 45 insertions, 39 deletions
diff --git a/maximus/unittest/src/main.cpp b/maximus/unittest/src/main.cpp
index 492542abf5..d31896fae1 100644
--- a/maximus/unittest/src/main.cpp
+++ b/maximus/unittest/src/main.cpp
@@ -21,41 +21,47 @@ int main (int argc, char * argv[])
{
UNITTEST = true;
int returnValue = -1;
-
- // Create a file for logging
- //
- ofstream logFile("unittest_log");
- if (logFile)
- {
- clog.rdbuf(logFile.rdbuf());
- }
- else
- {
- cerr << "Error while opening log file" << endl;
- clog.rdbuf(cout.rdbuf());
- }
-
- cout << endl << "*** Welcome to Fulminata Maximus simulator unitary tests ***" << endl;
- int optionChar = 0;
- while (EOF != optionChar)
+ try
{
- optionChar = getopt(argc, argv, "e:");
-
- switch (optionChar)
+ // Create a file for logging
+ //
+ ofstream logFile("unittest_log");
+ if (logFile)
{
- case 'e':
- cout << "station executable = " << optarg << endl;
- stationTest = optarg;
- break;
- case '?':
- throw Error(__PRETTY_FUNCTION__, "Usage: -e station_executable");
- break;
+ clog.rdbuf(logFile.rdbuf());
+ }
+ else
+ {
+ cerr << "Error while opening log file" << endl;
+ clog.rdbuf(cout.rdbuf());
}
- }
- try
- {
+ cout << endl << "*** Welcome to Fulminata Maximus simulator unitary tests ***" << endl;
+
+ bool isStationExecutableSet = false;
+ int optionChar = 0;
+ while (EOF != optionChar)
+ {
+ optionChar = getopt(argc, argv, "e:");
+
+ switch (optionChar)
+ {
+ case 'e':
+ cout << "station executable = " << optarg << endl;
+ stationTest = optarg;
+ isStationExecutableSet = true;
+ break;
+ case '?':
+ throw Error(__PRETTY_FUNCTION__, "Usage: -e station_executable");
+ break;
+ }
+ }
+ if (!isStationExecutableSet)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Usage: -e station_executable");
+ }
+
cout << "\ttestresult" << endl;
CPPUNIT_NS :: TestResult testresult;
@@ -73,19 +79,19 @@ int main (int argc, char * argv[])
compileroutputter.write ();
returnValue = collectedresults.wasSuccessful () ? 0 : 1;
+
+ cout << endl << "*** END ***" << endl;
+
+ // Close the created file for logging
+ //
+ logFile.flush();
+ logFile.close();
}
catch ( Error &e )
{
e.display();
}
-
- cout << endl << "*** END ***" << endl;
-
- // Close the created file for logging
- //
- logFile.flush();
- logFile.close();
-
- return returnValue;
+
+ return returnValue;
}