utest: add error exception 14/172614/1
authorSooChan Lim <sc1.lim@samsung.com>
Thu, 15 Mar 2018 00:52:19 +0000 (09:52 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Thu, 15 Mar 2018 00:52:19 +0000 (09:52 +0900)
Change-Id: I76fd108c7c73dbdd55884f386de5ad9e1d684d44

utests/ut_main.cpp

index 48fedd63d668d581ea1f29ae91a66b79698e9e13..a9362175d4f5afd18042a5c5017f2a66aa504a9d 100644 (file)
@@ -36,6 +36,7 @@ extern "C" void __gcov_flush(void);
 
 int main(int argc, char **argv)
 {
+       auto AllTestSuccess = false;
 
 #ifdef TIZEN_TEST_GCOV
        setenv("GCOV_PREFIX", "/tmp", 1);
@@ -45,12 +46,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);
        }
 
+       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 RUN_ALL_TESTS();
+       return AllTestSuccess;
 }