}
};
+static void dump_bl_mismatch(bufferlist& expected, bufferlist& actual)
+{
+ cout << __func__ << std::endl;
+ unsigned offset = 0;
+ while (expected[offset] == actual[offset])
+ ++offset;
+ cout << "--- buffer mismatch at offset 0x" << std::hex << offset << std::dec
+ << std::endl;
+ cout << "--- expected:\n";
+ expected.hexdump(cout);
+ cout << "--- actual:\n";
+ actual.hexdump(cout);
+}
+
class SyntheticWorkloadState {
struct Object {
bufferlist data;
bufferlist r2;
r = state->store->read(state->cid, noid, 0, state->contents[noid].data.length(), r2);
if (!state->contents[noid].data.contents_equal(r2)) {
- assert(state->contents[noid].data.contents_equal(r2));
+ dump_bl_mismatch(state->contents[noid].data, r2);
+ assert(0 == " mismatch after clone");
ASSERT_TRUE(state->contents[noid].data.contents_equal(r2));
}
state->cond.Signal();
expected.copy(offset, len, bl);
ASSERT_EQ(r, (int)len);
if (!result.contents_equal(bl)) {
- cout << "result:\n";
- result.hexdump(cout);
- cout << "expected:\n";
- bl.hexdump(cout);
- for (unsigned i=0; i<result.length(); ++i) {
- if (result[i] != bl[i]) {
- cout << "first difference at offset " << i << std::endl;
- break;
- }
- }
- assert(0);
+ cout << " obj " << obj
+ << " size " << expected.length()
+ << " offset " << offset
+ << " len " << len << std::endl;
+ dump_bl_mismatch(bl, result);
+ assert(0 == "mismatch after read");
+ ASSERT_TRUE(result.contents_equal(bl));
}
- ASSERT_TRUE(result.contents_equal(bl));
}
}