diff options
author | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2015-02-27 20:31:21 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:46:03 +0300 |
commit | c5a45d38c2060c1b8722a387031bef03cabdc9e6 (patch) | |
tree | cfbcac93439a272583e96657c5d17caaae8c97b5 /testing | |
parent | b6db1697139223354c36524605eb13cbdc2f9f15 (diff) |
Developing infrastucture for launching integration tests and unit tests for Android. Porting integration tests and indexer tests on Android platform.
Diffstat (limited to 'testing')
-rw-r--r-- | testing/testing.hpp | 4 | ||||
-rw-r--r-- | testing/testingmain.cpp | 17 |
2 files changed, 13 insertions, 8 deletions
diff --git a/testing/testing.hpp b/testing/testing.hpp index a866b8d13f..5ede65be90 100644 --- a/testing/testing.hpp +++ b/testing/testing.hpp @@ -2,6 +2,7 @@ #include "testing/testregister.hpp" #include "base/exception.hpp" +#include "base/logging.hpp" #include "base/math.hpp" #include "base/src_point.hpp" @@ -20,7 +21,8 @@ namespace my { inline void OnTestFailed(SrcPoint const & srcPoint, string const & msg) { - cerr << "FAILED" << endl << srcPoint.FileName() << ":" << srcPoint.Line() << " " << msg << endl; + LOG(LINFO, ("FAILED")); + LOG(LINFO, (srcPoint.FileName(), ":", srcPoint.Line(), msg)); MYTHROW(TestFailureException, (srcPoint.FileName(), srcPoint.Line(), msg)); } } diff --git a/testing/testingmain.cpp b/testing/testingmain.cpp index 425a70e04b..d47779b01e 100644 --- a/testing/testingmain.cpp +++ b/testing/testingmain.cpp @@ -40,6 +40,9 @@ int main(int argc, char * argv[]) #endif my::g_LogLevel = LINFO; +#if defined(OMIM_OS_MAC) || defined(OMIM_OS_LINUX) + my::SetLogMessageFn(my::LogMessageTests); +#endif vector<string> testNames; vector<bool> testResults; @@ -85,7 +88,7 @@ int main(int argc, char * argv[]) if (!g_bLastTestOK) { // Somewhere else global variables have been reset. - cerr << "\n\nSOMETHING IS REALLY WRONG IN THE UNIT TEST FRAMEWORK!!!" << endl; + LOG(LERROR, ("\n\nSOMETHING IS REALLY WRONG IN THE UNIT TEST FRAMEWORK!!!")); return 5; } @@ -96,7 +99,7 @@ int main(int argc, char * argv[]) if (g_bLastTestOK) { - cerr << "OK" << endl; + LOG(LINFO, ("OK")); } else { @@ -114,13 +117,13 @@ int main(int argc, char * argv[]) } catch (std::exception const & ex) { - cerr << "FAILED" << endl << "<<<Exception thrown [" << ex.what() << "].>>>" << endl; + LOG(LERROR, ("FAILED", "<<<Exception thrown [", ex.what(), "].>>>")); testResults[iTest] = false; ++numFailedTests; } catch (...) { - cerr << "FAILED" << endl << "<<<Unknown exception thrown.>>>" << endl; + LOG(LERROR, ("FAILED<<<Unknown exception thrown.>>>")); testResults[iTest] = false; ++numFailedTests; } @@ -129,18 +132,18 @@ int main(int argc, char * argv[]) if (numFailedTests == 0) { - cerr << endl << "All tests passed." << endl << flush; + LOG(LINFO, ("All tests passed.")); return 0; } else { - cerr << endl << numFailedTests << " tests failed:" << endl; + LOG(LINFO, (numFailedTests, " tests failed:")); for (size_t i = 0; i < testNames.size(); ++i) { if (!testResults[i]) cerr << testNames[i] << endl; } - cerr << "Some tests FAILED." << endl << flush; + LOG(LINFO, ("Some tests FAILED.")); return 1; } } |