]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: librbd DiffIterateStress now tests object map merging
authorJason Dillaman <dillaman@redhat.com>
Mon, 13 Apr 2015 21:08:04 +0000 (17:08 -0400)
committerJason Dillaman <dillaman@redhat.com>
Mon, 13 Apr 2015 21:08:04 +0000 (17:08 -0400)
Snapshots are deleted to verify that the fast diff feature
still functions as expected.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/test/librbd/test_librbd.cc

index ea6009ec60d02c77a5952045b60265094bc3e655..d6f676dbd4d3e3db9404bfc721248705a648e94a 100644 (file)
@@ -2257,34 +2257,39 @@ TYPED_TEST(DiffIterateTest, DiffIterateStress)
     snap.push_back(s);
   }
 
-  for (int i=0; i<n-1; i++) {
-    for (int j=i+1; j<n; j++) {
-      interval_set<uint64_t> 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<uint64_t> i;
-        i.intersection_of(diff, actual);
-        interval_set<uint64_t> l = diff;
-        l.subtract(i);
-        cout << " ... diff - (actual*diff) = " << l << std::endl;
+  for (int h=0; h<n-1; h++) {
+    for (int i=0; i<n-h-1; i++) {
+      for (int j=(h==0 ? i+1 : n-1); j<n; j++) {
+        interval_set<uint64_t> 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<uint64_t> i;
+          i.intersection_of(diff, actual);
+          interval_set<uint64_t> 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);