utest: cactch GoogleTestFailureException 83/165783/1
authorSooChan Lim <sc1.lim@samsung.com>
Thu, 4 Jan 2018 02:40:25 +0000 (11:40 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Thu, 4 Jan 2018 02:40:25 +0000 (11:40 +0900)
Change-Id: Ia137c1ba715b29ac7385f55218d51ca880f62fcc

utests/src/ut_main.cpp

index 6443f33..c056a2f 100644 (file)
@@ -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