From af96c22786c62b757b8d26e728f2129d79649f93 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Thu, 10 Jan 2013 22:11:59 +0000 Subject: [PATCH] Fix a transaction manager test --- unit-tests/transaction_manager_t.cc | 45 ++++++++++++++++++----------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/unit-tests/transaction_manager_t.cc b/unit-tests/transaction_manager_t.cc index 0c30e55..74480af 100644 --- a/unit-tests/transaction_manager_t.cc +++ b/unit-tests/transaction_manager_t.cc @@ -94,28 +94,39 @@ BOOST_AUTO_TEST_CASE(shadowing) BOOST_AUTO_TEST_CASE(multiple_shadowing) { transaction_manager::ptr tm = create_tm(); - write_ref superblock = tm->begin(0, noop_validator()); - space_map::ptr sm = tm->get_sm(); sm->set_count(1, 3); + block_address b, b2; - pair p = tm->shadow(1, noop_validator()); - block_address b = p.first.get_location(); - BOOST_CHECK(b != 1); - BOOST_CHECK(p.second); + { + write_ref superblock = tm->begin(0, noop_validator()); + pair p = tm->shadow(1, noop_validator()); + b = p.first.get_location(); + BOOST_CHECK(b != 1); + BOOST_CHECK(p.second); + sm->commit(); + } - p = tm->shadow(1, noop_validator()); - block_address b2 = p.first.get_location(); - BOOST_CHECK(b2 != 1); - BOOST_CHECK(b2 != b); - BOOST_CHECK(p.second); + { + write_ref superblock = tm->begin(0, noop_validator()); + pair p = tm->shadow(1, noop_validator()); + b2 = p.first.get_location(); + BOOST_CHECK(b2 != 1); + BOOST_CHECK(b2 != b); + BOOST_CHECK(p.second); + sm->commit(); + } - p = tm->shadow(1, noop_validator()); - block_address b3 = p.first.get_location(); - BOOST_CHECK(b3 != b2); - BOOST_CHECK(b3 != b); - BOOST_CHECK(b3 != 1); - BOOST_CHECK(!p.second); + { + write_ref superblock = tm->begin(0, noop_validator()); + pair p = tm->shadow(1, noop_validator()); + block_address b3 = p.first.get_location(); + BOOST_CHECK(b3 != b2); + BOOST_CHECK(b3 != b); + BOOST_CHECK(b3 != 1); + BOOST_CHECK(!p.second); + sm->commit(); + } } BOOST_AUTO_TEST_CASE(shadow_free_block_fails)