utest: add error exception 16/172616/1
authorSooChan Lim <sc1.lim@samsung.com>
Thu, 15 Mar 2018 01:05:09 +0000 (10:05 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Thu, 15 Mar 2018 01:05:09 +0000 (10:05 +0900)
Change-Id: I8223dbbd0be45cc7f0b3165a5543ee882dff6de1

utests/src/ut_main.cpp

index 02f2f0b..4112179 100644 (file)
@@ -45,13 +45,21 @@ int main(int argc, char **argv)
                ::testing::InitGoogleTest(&argc, argv);
                ::testing::FLAGS_gtest_death_test_style = "fast";
        } catch ( ... ) {
+               std::cout << "error while trying to init google tests.\n";
                exit(EXIT_FAILURE);
        }
 
-       AllTestSuccess = 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";
+       }
 
 #ifdef TIZEN_TEST_GCOV
        __gcov_flush();
 #endif
+
        return AllTestSuccess;
 }
\ No newline at end of file