From e5befcd5c3c98b8762b405b0d3cc6ab32e0715b4 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Mon, 13 Apr 2015 17:08:04 -0400 Subject: [PATCH] tests: librbd DiffIterateStress now tests object map merging Snapshots are deleted to verify that the fast diff feature still functions as expected. Signed-off-by: Jason Dillaman --- src/test/librbd/test_librbd.cc | 57 ++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc index ea6009ec60d0..d6f676dbd4d3 100644 --- a/src/test/librbd/test_librbd.cc +++ b/src/test/librbd/test_librbd.cc @@ -2257,34 +2257,39 @@ TYPED_TEST(DiffIterateTest, DiffIterateStress) snap.push_back(s); } - for (int i=0; i diff, actual, uex; - for (int k=i+1; k<=j; k++) - diff.union_of(wrote[k]); - cout << "from " << i << " to " << j << " diff " - << round_diff_interval(diff, object_size) << std::endl; - - // limit to extents that exists both at the beginning and at the end - uex.union_of(exists[i], exists[j]); - diff.intersection_of(uex); - diff = round_diff_interval(diff, object_size); - cout << " limited diff " << diff << std::endl; - - image.snap_set(snap[j].c_str()); - ASSERT_EQ(0, image.diff_iterate2(snap[i].c_str(), 0, size, true, - this->whole_object, iterate_cb, - (void *)&actual)); - cout << " actual was " << actual << std::endl; - if (!diff.subset_of(actual)) { - interval_set i; - i.intersection_of(diff, actual); - interval_set l = diff; - l.subtract(i); - cout << " ... diff - (actual*diff) = " << l << std::endl; + for (int h=0; h diff, actual, uex; + for (int k=i+1; k<=j; k++) + diff.union_of(wrote[k]); + cout << "from " << i << " to " + << (h != 0 ? string("HEAD") : stringify(j)) << " diff " + << round_diff_interval(diff, object_size) << std::endl; + + // limit to extents that exists both at the beginning and at the end + uex.union_of(exists[i], exists[j]); + diff.intersection_of(uex); + diff = round_diff_interval(diff, object_size); + cout << " limited diff " << diff << std::endl; + + ASSERT_EQ(0, image.snap_set(h==0 ? snap[j].c_str() : NULL)); + ASSERT_EQ(0, image.diff_iterate2(snap[i].c_str(), 0, size, true, + this->whole_object, iterate_cb, + (void *)&actual)); + cout << " actual was " << actual << std::endl; + if (!diff.subset_of(actual)) { + interval_set i; + i.intersection_of(diff, actual); + interval_set l = diff; + l.subtract(i); + cout << " ... diff - (actual*diff) = " << l << std::endl; + } + ASSERT_TRUE(diff.subset_of(actual)); } - ASSERT_TRUE(diff.subset_of(actual)); } + ASSERT_EQ(0, image.snap_set(NULL)); + ASSERT_EQ(0, image.snap_remove(snap[n-h-1].c_str())); } ASSERT_PASSED(this->validate_object_map, image); -- 2.47.3