Fix static analyzer issues 05/174505/1
authorSangyoon Jang <jeremy.jang@samsung.com>
Mon, 2 Apr 2018 11:08:08 +0000 (20:08 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Mon, 2 Apr 2018 11:08:08 +0000 (20:08 +0900)
- Fix uncaught exception.

Change-Id: Ica139ffdff375bbbaf9345787744f167dc79c788
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/unit_tests/smoke_test.cc

index b5bf24d..d61b444 100644 (file)
@@ -867,16 +867,21 @@ TEST_F(SmokeTest, InstallExtendedMode) {
 }  // namespace smoke_test
 
 int main(int argc,  char** argv) {
-  ci::RequestMode request_mode = st::ParseRequestMode(argc, argv);
-  if (getuid() != 0 || request_mode != ci::RequestMode::GLOBAL) {
-    std::cout << "Skip tests for preload request" << std::endl;
-    ::testing::GTEST_FLAG(filter) = "SmokeTest.*";
+  try {
+    ci::RequestMode request_mode = st::ParseRequestMode(argc, argv);
+    if (getuid() != 0 || request_mode != ci::RequestMode::GLOBAL) {
+      std::cout << "Skip tests for preload request" << std::endl;
+      ::testing::GTEST_FLAG(filter) = "SmokeTest.*";
+    }
+    testing::InitGoogleTest(&argc, argv);
+    ::env = static_cast<smoke_test::SmokeEnvironment*>(
+        testing::AddGlobalTestEnvironment(
+            new smoke_test::SmokeEnvironment(request_mode)));
+    signal(SIGINT, ::signalHandler);
+    signal(SIGSEGV, ::signalHandler);
+    return RUN_ALL_TESTS();
+  } catch (...) {
+    std::cout << "Exception occurred during testing" << std::endl;
+    return 1;
   }
-  testing::InitGoogleTest(&argc, argv);
-  ::env = static_cast<smoke_test::SmokeEnvironment*>(
-      testing::AddGlobalTestEnvironment(
-          new smoke_test::SmokeEnvironment(request_mode)));
-  signal(SIGINT, ::signalHandler);
-  signal(SIGSEGV, ::signalHandler);
-  return RUN_ALL_TESTS();
 }