]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/dokan: avoid unnecessary wait 53456/head
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Thu, 14 Sep 2023 11:08:36 +0000 (11:08 +0000)
committerLucian Petrut <lpetrut@cloudbasesolutions.com>
Thu, 14 Sep 2023 11:08:36 +0000 (11:08 +0000)
One of the dokan tests expects some mount operations to fail.
The issue is that it polls the mount location for 10s, which
is unnecessary.

We'll update the test to check the mount process exit code
instead. This basically reduces the dokan test duration by
about 20s.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
src/test/dokan/dokan.cc

index eaa26557fe88429e5e83e9d1525d8d8309f48015..baef44a49b655aea8903ffeb1e239d211e5e6b29 100644 (file)
@@ -157,7 +157,18 @@ void map_dokan_with_maxpath(
     const char* mountpoint,
     uint64_t max_path_len)
 {
-    SubProcess* new_mount = new SubProcess("ceph-dokan");
+    SubProcess* new_mount = nullptr;
+
+    bool expect_failure = max_path_len < 256 || max_path_len > 4096;
+    if (expect_failure) {
+        new_mount = new SubProcessTimed(
+            "ceph-dokan",
+            SubProcess::CLOSE, SubProcess::CLOSE, SubProcess::CLOSE,
+            MOUNT_POLL_ATTEMPT * MOUNT_POLL_INTERVAL_MS / 1000);
+    } else {
+        new_mount = new SubProcess("ceph-dokan");
+    }
+
     new_mount->add_cmd_args("map", "--debug", "--dokan-stderr",
                             "--win-vol-name", "TestCeph",
                             "--win-vol-serial", TEST_VOL_SERIAL,
@@ -167,10 +178,10 @@ void map_dokan_with_maxpath(
 
     *mount = new_mount;
     ASSERT_EQ(new_mount->spawn(), 0);
-    if (256 <= max_path_len && max_path_len <= 4096) {
-        ASSERT_EQ(wait_for_mount(mountpoint), 0);
+    if (expect_failure) {
+        ASSERT_NE(0, new_mount->join());
     } else {
-        ASSERT_NE(wait_for_mount(mountpoint), 0);
+        ASSERT_EQ(wait_for_mount(mountpoint), 0);
     }
 }