From: SooChan Lim Date: Thu, 4 Jan 2018 02:40:25 +0000 (+0900) Subject: utest: cactch GoogleTestFailureException X-Git-Tag: accepted/tizen/unified/20180108.193247~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F83%2F165783%2F1;p=platform%2Fcore%2Fuifw%2Flibtdm.git utest: cactch GoogleTestFailureException Change-Id: Ia137c1ba715b29ac7385f55218d51ca880f62fcc --- diff --git a/utests/src/ut_main.cpp b/utests/src/ut_main.cpp index 6443f33..c056a2f 100644 --- a/utests/src/ut_main.cpp +++ b/utests/src/ut_main.cpp @@ -32,6 +32,8 @@ int main(int argc, char **argv) { + auto AllTestSuccess = false; + try { ::testing::InitGoogleTest(&argc, argv); ::testing::FLAGS_gtest_death_test_style = "fast"; @@ -39,5 +41,14 @@ int main(int argc, char **argv) std::cout << "error while trying to init google tests.\n"; exit(EXIT_FAILURE); } - return RUN_ALL_TESTS(); -} + + try { + AllTestSuccess = RUN_ALL_TESTS() == 0 ? true : false; + } catch (const ::testing::internal::GoogleTestFailureException& e) { + AllTestSuccess = false; + std::cout << "GoogleTestFailureException was thrown:"<< e.what() << std::endl; + std::cout << "\n"; + } + + return AllTestSuccess; +} \ No newline at end of file