]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/dokan: avoid runtime dependent assertion
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Mon, 24 Apr 2023 14:36:43 +0000 (14:36 +0000)
committerLucian Petrut <lpetrut@cloudbasesolutions.com>
Wed, 30 Aug 2023 12:59:00 +0000 (12:59 +0000)
We're checking a permission denied exception message that's
runtime specific:

  /mnt/data/workspace/ceph_mingw_clang/src/test/dokan/dokan.cc:252: Failure
  Expected equality of these values:
    e.what()
      Which is: "filesystem error: in remove: Permission denied
      [\"Z:\\ro_success_b76223c4-c590-45e0-ab78-4d281ac512b5\"]"
    exception_msg.c_str()
      Which is: "filesystem error: cannot remove: No such device
      [Z:\\ro_success_b76223c4-c590-45e0-ab78-4d281ac512b5]"

In order to support libc++, we'll drop the exception message
assertion and rely on the exception type.

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

index 1a1d39580e6dd0b195d94700a78fc492e0fe6696..18f206985e8b186f44faf30b0b56a87be24d5885 100644 (file)
@@ -242,16 +242,9 @@ TEST_F(DokanTests, test_mount_read_only) {
     ASSERT_TRUE(fs::exists(mountpoint + success_file_path));
     ASSERT_EQ(read_file(mountpoint + success_file_path), data);
 
-    std::string exception_msg(
-        "filesystem error: cannot remove: No such device ["
-        + mountpoint + success_file_path + "]");
+    // The actual exception message is runtime dependent.
     EXPECT_THROW({
-        try {
-            fs::remove(mountpoint + success_file_path);
-        } catch(const fs::filesystem_error &e) {
-            EXPECT_STREQ(e.what(), exception_msg.c_str());
-            throw;
-        }
+        fs::remove(mountpoint + success_file_path);
     }, fs::filesystem_error);
     unmap_dokan(mount, mountpoint.c_str());