Fixed Coverity issue : 1018951, 1018952 74/186174/1 accepted/tizen/unified/20180808.063422 submit/tizen/20180808.022814
authorsaerome.kim <saerome.kim@samsung.com>
Wed, 8 Aug 2018 02:13:42 +0000 (11:13 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Wed, 8 Aug 2018 02:13:42 +0000 (11:13 +0900)
- There is no exception handler for unknown exception and
  testing::internal::GoogleTestFailureException. So, added handler.

Change-Id: Ie19d085d7251765e3b7c22bbb2eda64aff21eab3
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
haltest/mtp_initiator_hal_tc.cpp

index bd79ffb3037ad2fa37da55aa792168b0479cb8a3..96f23b158f8708f22c2fc31ca5ea41ebe7d2f6b0 100644 (file)
@@ -135,6 +135,21 @@ TEST(hal_libmtp, Init_p)
 
 int main(int argc, char **argv)
 {
-       InitGoogleTest(&argc, argv);
-       return RUN_ALL_TESTS();
+       int ret = 0;
+       try {
+               testing::InitGoogleTest(&argc, argv);
+       } catch (const ::testing::internal::GoogleTestFailureException& ex) {
+               std::cerr << "Caught: GoogleTestFailureException& " << ex.what() << std::endl;
+       } catch (...) {
+               std::cerr << "Caught: unknown exception" << std::endl;
+       }
+
+       try {
+               ret = RUN_ALL_TESTS();
+       } catch (const ::testing::internal::GoogleTestFailureException& ex) {
+               std::cerr << "Caught: GoogleTestFailureException& " << ex.what() << std::endl;
+       } catch (...) {
+               std::cerr << "Caught: unknown exception" << std::endl;
+       }
+       return ret;
 }