From: Lucian Petrut Date: Fri, 21 Jul 2023 07:42:47 +0000 (+0000) Subject: test/libcephfs: update delegation test assertions X-Git-Tag: v19.0.0~768^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7488deef32222e7cf1ce83401d6e65c492200823;p=ceph.git test/libcephfs: update delegation test assertions Some of the libcephfs tests ensure that the delegations are recalled as a result of certain open requests. The issue is that we're expecting the "opened" flag to be false after the delegation gets recalled, which is racy. /home/ubuntu/ceph/src/test/libcephfs/deleg.cc:392: Failure Expected equality of these values: opened.load() Which is: true false We'll update those checks, asserting that "opened" is true after the delegation breaker thread returns. Signed-off-by: Lucian Petrut --- diff --git a/src/test/libcephfs/deleg.cc b/src/test/libcephfs/deleg.cc index 061e13763c62..7bdc97d206ee 100644 --- a/src/test/libcephfs/deleg.cc +++ b/src/test/libcephfs/deleg.cc @@ -186,9 +186,9 @@ static void simple_deleg_test(struct ceph_mount_info *cmount, struct ceph_mount_ std::thread breaker1(open_breaker_func, tcmount, filename, O_RDWR, &opened); wait_for_atomic_bool(recalled); - ASSERT_EQ(opened.load(), false); ASSERT_EQ(ceph_ll_delegation(cmount, fh, CEPH_DELEGATION_NONE, dummy_deleg_cb, &recalled), 0); breaker1.join(); + ASSERT_EQ(opened.load(), true); ASSERT_EQ(ceph_ll_close(cmount, fh), 0); ASSERT_EQ(ceph_ll_unlink(cmount, root, filename, perms), 0); @@ -201,9 +201,9 @@ static void simple_deleg_test(struct ceph_mount_info *cmount, struct ceph_mount_ ASSERT_EQ(ceph_ll_delegation_wait(cmount, fh, CEPH_DELEGATION_WR, dummy_deleg_cb, &recalled), 0); std::thread breaker2(open_breaker_func, tcmount, filename, O_RDONLY, &opened); wait_for_atomic_bool(recalled); - ASSERT_EQ(opened.load(), false); ASSERT_EQ(ceph_ll_delegation(cmount, fh, CEPH_DELEGATION_NONE, dummy_deleg_cb, &recalled), 0); breaker2.join(); + ASSERT_EQ(opened.load(), true); ASSERT_EQ(ceph_ll_close(cmount, fh), 0); ASSERT_EQ(ceph_ll_unlink(cmount, root, filename, perms), 0); @@ -222,9 +222,9 @@ static void simple_deleg_test(struct ceph_mount_info *cmount, struct ceph_mount_ std::thread breaker4(open_breaker_func, tcmount, filename, O_WRONLY, &opened); wait_for_atomic_bool(recalled); usleep(1000); - ASSERT_EQ(opened.load(), false); ASSERT_EQ(ceph_ll_delegation(cmount, fh, CEPH_DELEGATION_NONE, dummy_deleg_cb, &recalled), 0); breaker4.join(); + ASSERT_EQ(opened.load(), true); ASSERT_EQ(ceph_ll_close(cmount, fh), 0); ASSERT_EQ(ceph_ll_unlink(cmount, root, filename, perms), 0); @@ -389,10 +389,10 @@ TEST(LibCephFS, RecalledGetattr) { ASSERT_LT(i++, MAX_WAIT); usleep(1000); } while (!recalled.load()); - ASSERT_EQ(opened.load(), false); ASSERT_EQ(ceph_ll_getattr(cmount2, file, &stx, CEPH_STATX_ALL_STATS, 0, perms), 0); ASSERT_EQ(ceph_ll_delegation(cmount2, fh, CEPH_DELEGATION_NONE, dummy_deleg_cb, nullptr), 0); breaker1.join(); + ASSERT_EQ(opened.load(), true); ASSERT_EQ(ceph_ll_close(cmount2, fh), 0); ceph_unmount(cmount2); ceph_release(cmount2);