From 82ef35db701cdf16a606522504cc1b4ea18e38ce Mon Sep 17 00:00:00 2001 From: Lucian Petrut Date: Mon, 24 Apr 2023 14:36:43 +0000 Subject: [PATCH] test/dokan: avoid runtime dependent assertion 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 --- src/test/dokan/dokan.cc | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/test/dokan/dokan.cc b/src/test/dokan/dokan.cc index 1a1d39580e6dd..18f206985e8b1 100644 --- a/src/test/dokan/dokan.cc +++ b/src/test/dokan/dokan.cc @@ -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()); -- 2.39.5