]>
git.proxmox.com Git - ceph.git/blob - ceph/src/test/objectstore/store_test_fixture.cc
4 #include <gtest/gtest.h>
6 #include "common/errno.h"
7 #include "os/ObjectStore.h"
8 #if defined(HAVE_LIBAIO)
9 #include "os/bluestore/BlueStore.h"
11 #include "store_test_fixture.h"
13 static void rm_r(const string
& path
) {
14 string cmd
= string("rm -r ") + path
;
15 cout
<< "==> " << cmd
<< std::endl
;
16 int r
= ::system(cmd
.c_str());
20 cerr
<< "system() failed to fork() " << cpp_strerror(r
)
21 << ", continuing anyway" << std::endl
;
23 cerr
<< "failed with exit code " << r
24 << ", continuing anyway" << std::endl
;
29 void StoreTestFixture::SetUp() {
30 int r
= ::mkdir(data_dir
.c_str(), 0777);
33 cerr
<< __func__
<< ": unable to create " << data_dir
<< ": " << cpp_strerror(r
) << std::endl
;
37 store
.reset(ObjectStore::create(g_ceph_context
,
40 string("store_test_temp_journal")));
42 cerr
<< __func__
<< ": objectstore type " << type
<< " doesn't exist yet!" << std::endl
;
45 #if defined(HAVE_LIBAIO)
46 if (type
== "bluestore") {
47 BlueStore
*s
= static_cast<BlueStore
*>(store
.get());
48 // better test coverage!
49 s
->set_cache_shards(5);
52 ASSERT_EQ(0, store
->mkfs());
53 ASSERT_EQ(0, store
->mount());
56 void StoreTestFixture::TearDown() {
58 int r
= store
->umount();