From 628e9ae26db0d7765caffd4035903dcaa0429c89 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sat, 6 Apr 2013 09:37:52 -0700 Subject: [PATCH] librbd: fix DiffIterateStress again - fix seed - the array indices are points in time; no need to subtract one from i! - pick a random seed and print it to stdout I ran this with several different seeds without failure, so I am confident we are in good shape. And if we ever get a future failure, we'll have the seed to reproduce. Signed-off-by: Sage Weil --- src/test/librbd/test_librbd.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc index 38bfbb6cf9193..2051b71696366 100644 --- a/src/test/librbd/test_librbd.cc +++ b/src/test/librbd/test_librbd.cc @@ -1505,7 +1505,7 @@ TEST(LibRBD, FlushAioPP) int iterate_cb(uint64_t off, size_t len, int exists, void *arg) { - cout << "iterate_cb " << off << "~" << len << std::endl; + //cout << "iterate_cb " << off << "~" << len << std::endl; interval_set *diff = static_cast *>(arg); diff->insert(off, len); return 0; @@ -1701,6 +1701,10 @@ TEST(LibRBD, DiffIterateStress) ASSERT_EQ("", create_one_pool_pp(pool_name, rados)); ASSERT_EQ(0, rados.ioctx_create(pool_name.c_str(), ioctx)); + int seed = getpid(); + cout << "seed " << seed << std::endl; + srand(seed); + { librbd::RBD rbd; librbd::Image image; @@ -1735,9 +1739,7 @@ TEST(LibRBD, DiffIterateStress) cout << "from " << i << " to " << j << " diff " << diff << std::endl; // limit to extents that exists both at the beginning and at the end - uex = exists[j]; - if (i) - uex.union_of(exists[i-1]); + uex.union_of(exists[i], exists[j]); diff.intersection_of(uex); cout << " limited diff " << diff << std::endl; -- 2.39.5