Add user request mode test for recovery test 85/239585/4
authorIlho Kim <ilho159.kim@samsung.com>
Tue, 28 Jul 2020 02:22:19 +0000 (11:22 +0900)
committerIlho Kim <ilho159.kim@samsung.com>
Thu, 6 Aug 2020 08:48:59 +0000 (17:48 +0900)
Recovery test can run user request mode With additional option '--user-request'

Change-Id: I0759d9cfc76dc2231e194a7c892c4814d114cf0a
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
src/unit_tests/recovery_test.cc

index 628929c569e29903c20df5702631837dec7e682a..6a8615282d88c5bdac463bc11eba0dc2a95f8f43 100644 (file)
@@ -359,6 +359,9 @@ int main(int argc,  char** argv) {
   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;
@@ -394,7 +397,8 @@ int main(int argc,  char** argv) {
         ("no-backup", "Do test without backup")
         ("backup-type", bpo::value<std::string>(), "<move|copy> set test's "
             "backup type \'move\', \'copy and remove\'");
-    bpo::store(bpo::parse_command_line(argc, argv, options), opt_map);
+    bpo::store(bpo::command_line_parser(argc, argv).
+        options(options).allow_unregistered().run(), opt_map);
     if (opt_map.count("help")) {
       std::cerr << options << std::endl;
       return -1;
@@ -459,7 +463,7 @@ int main(int argc,  char** argv) {
     testing::InitGoogleTest(&argc, argv);
     ::env = static_cast<smoke_test::SmokeEnvironment*>(
         testing::AddGlobalTestEnvironment(
-            new smoke_test::SmokeEnvironment(ci::RequestMode::GLOBAL,
+            new smoke_test::SmokeEnvironment(request_mode,
                 no_backup, backup_type)));
     signal(SIGINT, ::signalHandler);
     signal(SIGSEGV, ::signalHandler);