Combine try-catch statement in unified recovery test 70/241170/1
authorIlho Kim <ilho159.kim@samsung.com>
Tue, 18 Aug 2020 08:34:04 +0000 (17:34 +0900)
committerIlho Kim <ilho159.kim@samsung.com>
Tue, 18 Aug 2020 08:34:04 +0000 (17:34 +0900)
Change-Id: I4aaf7b3f8c82a0830a1d6049615041bd372c05a8
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
test/smoke_test/unified_recovery_test.cc

index ce466c32a362b500b303e4cdf7e19f75e45a84b9..fb114bcfbd304e20c759462d57a1fed2222ed4e0 100644 (file)
@@ -575,18 +575,18 @@ TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) {
 const int kBufSize = 1024;
 
 int main(int argc,  char** argv) {
-  bool no_backup = false;
-  int repeat_count = 10;
-  ReqType req_type = ReqType::UNKNOWN_REQ;
-  bool repeat = false;
-  BackupType backup_type = BackupType::MOVE;
-  ci::RequestMode request_mode = smoke_test::ParseRequestMode(argc, argv);
-  if (getuid() != 0 || request_mode != ci::RequestMode::GLOBAL)
-    std::cout << "Run recovery test with user request mode" << std::endl;
-
-  bpo::options_description options("Allowed options");
-  bpo::variables_map opt_map;
   try {
+    bool no_backup = false;
+    int repeat_count = 10;
+    ReqType req_type = ReqType::UNKNOWN_REQ;
+    bool repeat = false;
+    BackupType backup_type = BackupType::MOVE;
+    ci::RequestMode request_mode = smoke_test::ParseRequestMode(argc, argv);
+    if (getuid() != 0 || request_mode != ci::RequestMode::GLOBAL)
+      std::cout << "Run recovery test with user request mode" << std::endl;
+
+    bpo::options_description options("Allowed options");
+    bpo::variables_map opt_map;
     options.add_options()
         ("help", "display this help message")
         ("install",
@@ -657,19 +657,12 @@ int main(int argc,  char** argv) {
       }
     }
     bpo::notify(opt_map);
-  } catch (...) {
-    std::cerr << "Exception occurred: "
-              << boost::current_exception_diagnostic_information()
-              << std::endl;
-    return -1;
-  }
 
-  if (req_type == ReqType::UNKNOWN_REQ) {
-    std::cerr << options << std::endl;
-    return 0;
-  }
+    if (req_type == ReqType::UNKNOWN_REQ) {
+      std::cerr << options << std::endl;
+      return 0;
+    }
 
-  try {
     testing::GTEST_FLAG(filter) = install_req_filter[req_type];
     if (repeat) {
       testing::GTEST_FLAG(repeat) = repeat_count;