From f76f7720065a77aa1652039d9252f9c9d5619689 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Mon, 20 Apr 2015 15:08:56 -0400 Subject: [PATCH] tests: verify object map is updated after full copyup Signed-off-by: Jason Dillaman --- src/test/librbd/test_internal.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/librbd/test_internal.cc b/src/test/librbd/test_internal.cc index afd17da1c95..bac02049ede 100644 --- a/src/test/librbd/test_internal.cc +++ b/src/test/librbd/test_internal.cc @@ -4,6 +4,7 @@ #include "librbd/AioCompletion.h" #include "librbd/ImageWatcher.h" #include "librbd/internal.h" +#include "librbd/ObjectMap.h" #include #include #include @@ -477,6 +478,17 @@ TEST_F(TestInternal, SnapshotCopyup) } else { ASSERT_TRUE(read_bl.is_zero()); } + + // verify the object map was properly updated + if ((ictx2->features & RBD_FEATURE_OBJECT_MAP) != 0) { + uint8_t state = OBJECT_EXISTS; + if ((ictx2->features & RBD_FEATURE_DEEP_FLATTEN) != 0 && + it != snaps.begin() && snap_name != NULL) { + state = OBJECT_EXISTS_CLEAN; + } + RWLock::WLocker object_map_locker(ictx2->object_map_lock); + ASSERT_EQ(state, ictx2->object_map[0]); + } } }