From 0357ab2ad8b398641b1e03727c9de6241d72ad83 Mon Sep 17 00:00:00 2001 From: Lucian Petrut Date: Thu, 14 Sep 2023 11:08:36 +0000 Subject: [PATCH] test/dokan: avoid unnecessary wait 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 --- src/test/dokan/dokan.cc | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/test/dokan/dokan.cc b/src/test/dokan/dokan.cc index eaa26557fe88..baef44a49b65 100644 --- a/src/test/dokan/dokan.cc +++ b/src/test/dokan/dokan.cc @@ -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); } } -- 2.47.3