I want $? = 1 whenever some test fails.

* src/main.cc (testLoop): Return 1 iff an error occured.
(main): Use testLoop's output as exit status.
This commit is contained in:
Alexandre Duret-Lutz 2003-07-09 15:34:53 +00:00
parent 9df8be4503
commit 71b7da1437
2 changed files with 31 additions and 21 deletions

View file

@ -1,5 +1,9 @@
2003-07-09 Alexandre Duret-Lutz <aduret@src.lip6.fr> 2003-07-09 Alexandre Duret-Lutz <aduret@src.lip6.fr>
I want $? = 1 whenever some test fails.
* src/main.cc (testLoop): Return 1 iff an error occured.
(main): Use testLoop's output as exit status.
* src/ExternalTranslator.h (class ExternalTranslator): * src/ExternalTranslator.h (class ExternalTranslator):
Declare class SpotWrapper as a friend. Declare class SpotWrapper as a friend.
* src/SpotWrapper.h, src/SpotWrapper.cc: New files. * src/SpotWrapper.h, src/SpotWrapper.cc: New files.

View file

@ -111,7 +111,7 @@ vector<TestStatistics, ALLOC(TestStatistics) > /* Overall test */
* *
*****************************************************************************/ *****************************************************************************/
void testLoop() int testLoop()
{ {
using namespace DispUtil; using namespace DispUtil;
using namespace SharedTestData; using namespace SharedTestData;
@ -119,6 +119,9 @@ void testLoop()
using namespace StringUtil; using namespace StringUtil;
using namespace TestOperations; using namespace TestOperations;
/* Return code. Will be set to 1 if any of the test fails. */
int exit_status = 0;
const Configuration::GlobalConfiguration& global_options const Configuration::GlobalConfiguration& global_options
= configuration.global_options; = configuration.global_options;
@ -587,6 +590,9 @@ void testLoop()
round_info.next_round_to_stop = round_info.current_round; round_info.next_round_to_stop = round_info.current_round;
} }
if (round_info.error)
exit_status = 1;
/* /*
* Determine from the program configuration and the error status whether * Determine from the program configuration and the error status whether
* the testing should be paused to wait for user commands. * the testing should be paused to wait for user commands.
@ -666,6 +672,8 @@ void testLoop()
if (round_info.formula_input_file.is_open()) if (round_info.formula_input_file.is_open())
round_info.formula_input_file.close(); round_info.formula_input_file.close();
return exit_status;
} }
@ -708,7 +716,7 @@ int main(int argc, char* argv[])
try try
{ {
testLoop(); return testLoop();
} }
catch (const Exception& e) catch (const Exception& e)
{ {
@ -720,6 +728,4 @@ int main(int argc, char* argv[])
cerr << argv[0] << ": out of memory" << endl; cerr << argv[0] << ": out of memory" << endl;
exit(-1); exit(-1);
} }
return 0;
} }