diff options
Diffstat (limited to 'indra/test/test.cpp')
-rw-r--r-- | indra/test/test.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/indra/test/test.cpp b/indra/test/test.cpp index 07e187ce45..721e9da917 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -69,14 +69,13 @@ namespace tut class LLTestCallback : public tut::callback { public: - LLTestCallback(bool verbose_mode, std::ostream *stream, bool wait) : + LLTestCallback(bool verbose_mode, std::ostream *stream) : mVerboseMode(verbose_mode), mTotalTests(0), mPassedTests(0), mFailedTests(0), mSkippedTests(0), - mStream(stream), - mWaitAtExit(wait) + mStream(stream) { } @@ -142,17 +141,9 @@ public: run_completed_(*mStream); } run_completed_(std::cout); - - if(mWaitAtExit) { - std::cerr << "Waiting for input before exiting..." << std::endl; - std::cin.get(); - } - - if (mFailedTests > 0) - { - exit(1); - } } + + int getFailedTests() const { return mFailedTests; } private: void run_completed_(std::ostream &stream) @@ -187,7 +178,6 @@ protected: int mFailedTests; int mSkippedTests; std::ostream *mStream; - bool mWaitAtExit; }; static const apr_getopt_option_t TEST_CL_OPTIONS[] = @@ -345,7 +335,7 @@ int main(int argc, char **argv) } // run the tests - LLTestCallback callback(verbose_mode, output, wait_at_exit); + LLTestCallback callback(verbose_mode, output); tut::runner.get().set_callback(&callback); if(test_group.empty()) @@ -356,6 +346,14 @@ int main(int argc, char **argv) { tut::runner.get().run_tests(test_group); } + + bool success = (callback.getFailedTests() == 0); + + if (wait_at_exit) + { + std::cerr << "Press return to exit..." << std::endl; + std::cin.get(); + } if (output) { @@ -363,7 +361,7 @@ int main(int argc, char **argv) delete output; } - if (touch) + if (touch && success) { std::ofstream s; s.open(touch); @@ -372,5 +370,7 @@ int main(int argc, char **argv) } apr_terminate(); - return 0; + + int retval = (success ? 0 : 1); + return retval; } |