From: Junghyun Yeon Date: Thu, 13 Aug 2020 07:29:48 +0000 (+0900) Subject: Fix static analysis X-Git-Tag: accepted/tizen/unified/20200814.123123~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=576ef6b377ab264acd05233d945bd743204391b6;p=platform%2Fcore%2Fappfw%2Fapp2sd.git Fix static analysis Add try-catch to catch exception. Change-Id: I91a25addfaae8f125ba904afa0e7a1b329b440de Signed-off-by: Junghyun Yeon --- diff --git a/unit-tests/lib/test_lib.cc b/unit-tests/lib/test_lib.cc index 5b5d5c8..14a26ae 100644 --- a/unit-tests/lib/test_lib.cc +++ b/unit-tests/lib/test_lib.cc @@ -351,7 +351,12 @@ class App2sdEnvironment : public ::testing::Environment { } // namespace app2sd int main(int argc, char* argv[]) { - ::testing::InitGoogleTest(&argc, argv); - ::env = testing::AddGlobalTestEnvironment(new app2sd::App2sdEnvironment); - return RUN_ALL_TESTS(); + try { + ::testing::InitGoogleTest(&argc, argv); + ::env = testing::AddGlobalTestEnvironment(new app2sd::App2sdEnvironment); + return RUN_ALL_TESTS(); + } catch (...) { + std::cerr << "Exception occurred" << std::endl; + return -1; + } } diff --git a/unit-tests/server/test_server.cc b/unit-tests/server/test_server.cc index bb2ff3f..468ddc6 100644 --- a/unit-tests/server/test_server.cc +++ b/unit-tests/server/test_server.cc @@ -250,7 +250,12 @@ TEST_F(App2sdServerTest, ForceClean) { } // namespace int main(int argc, char* argv[]) { - ::testing::InitGoogleTest(&argc, argv); - ::env = testing::AddGlobalTestEnvironment(new app2sd::App2sdEnvironment); - return RUN_ALL_TESTS(); + try { + ::testing::InitGoogleTest(&argc, argv); + ::env = testing::AddGlobalTestEnvironment(new app2sd::App2sdEnvironment); + return RUN_ALL_TESTS(); + } catch (...) { + std::cerr << "Exception occurred" << std::endl; + return -1; + } }