test the recursive space map

This commit is contained in:
Joe Thornber 2013-01-10 21:12:37 +00:00
parent 186b0aa6c1
commit 6a4facf03b

View File

@ -1,4 +1,4 @@
// Copyright (C) 2011 Red Hat, Inc. All rights reserved. // Copyright (C) 2011-2012 Red Hat, Inc. All rights reserved.
// //
// This file is part of the thin-provisioning-tools source. // This file is part of the thin-provisioning-tools source.
// //
@ -19,6 +19,7 @@
#include "persistent-data/space_map_disk.h" #include "persistent-data/space_map_disk.h"
#include "persistent-data/space_map_core.h" #include "persistent-data/space_map_core.h"
#include "persistent-data/space_map_careful_alloc.h" #include "persistent-data/space_map_careful_alloc.h"
#include "persistent-data/space_map_recursive.h"
#define BOOST_TEST_MODULE SpaceMapDiskTests #define BOOST_TEST_MODULE SpaceMapDiskTests
#include <boost/test/included/unit_test.hpp> #include <boost/test/included/unit_test.hpp>
@ -44,16 +45,14 @@ namespace {
return tm; return tm;
} }
class sm_core_creator { struct sm_core_creator {
public:
static space_map::ptr static space_map::ptr
create() { create() {
return space_map::ptr(new persistent_data::core_map(NR_BLOCKS)); return space_map::ptr(new persistent_data::core_map(NR_BLOCKS));
} }
}; };
class sm_careful_alloc_creator { struct sm_careful_alloc_creator {
public:
static space_map::ptr static space_map::ptr
create() { create() {
return create_careful_alloc_sm( return create_careful_alloc_sm(
@ -62,8 +61,16 @@ namespace {
} }
}; };
class sm_disk_creator { struct sm_recursive_creator {
public: static checked_space_map::ptr
create() {
return create_recursive_sm(
checked_space_map::ptr(
new core_map(NR_BLOCKS)));
}
};
struct sm_disk_creator {
static persistent_space_map::ptr static persistent_space_map::ptr
create() { create() {
transaction_manager::ptr tm = create_tm(); transaction_manager::ptr tm = create_tm();
@ -77,8 +84,7 @@ namespace {
} }
}; };
class sm_metadata_creator { struct sm_metadata_creator {
public:
static persistent_space_map::ptr static persistent_space_map::ptr
create() { create() {
transaction_manager::ptr tm = create_tm(); transaction_manager::ptr tm = create_tm();
@ -264,11 +270,15 @@ BOOST_AUTO_TEST_CASE(test_sm_careful_alloc)
do_tests<sm_careful_alloc_creator>(space_map_tests); do_tests<sm_careful_alloc_creator>(space_map_tests);
} }
BOOST_AUTO_TEST_CASE(test_sm_recursive)
{
do_tests<sm_recursive_creator>(space_map_tests);
}
BOOST_AUTO_TEST_CASE(test_sm_disk) BOOST_AUTO_TEST_CASE(test_sm_disk)
{ {
do_tests<sm_disk_creator>(space_map_tests); do_tests<sm_disk_creator>(space_map_tests);
test_sm_reopen<sm_disk_creator>(); test_sm_reopen<sm_disk_creator>();
} }
BOOST_AUTO_TEST_CASE(test_sm_metadata) BOOST_AUTO_TEST_CASE(test_sm_metadata)