#include <time.h>
#include <sys/mount.h>
#include "os/FileStore.h"
+#include "os/KeyValueStore.h"
#include "include/Context.h"
#include "common/ceph_argparse.h"
#include "global/global_init.h"
#include "include/unordered_map.h"
typedef boost::mt11213b gen_type;
-class StoreTest : public ::testing::Test {
+#if GTEST_HAS_PARAM_TEST
+
+class StoreTest : public ::testing::TestWithParam<const char*> {
public:
boost::scoped_ptr<ObjectStore> store;
return;
}
- ObjectStore *store_ = new FileStore(string("store_test_temp_dir"), string("store_test_temp_journal"));
+ ObjectStore *store_ = ObjectStore::create(g_ceph_context,
+ string(GetParam()),
+ string("store_test_temp_dir"),
+ string("store_test_temp_journal"));
store.reset(store_);
EXPECT_EQ(store->mkfs(), 0);
EXPECT_EQ(store->mount(), 0);
return true;
}
-TEST_F(StoreTest, SimpleColTest) {
+TEST_P(StoreTest, SimpleColTest) {
coll_t cid = coll_t("initial");
int r = 0;
{
}
}
-TEST_F(StoreTest, SimpleObjectTest) {
+TEST_P(StoreTest, SimpleObjectTest) {
int r;
coll_t cid = coll_t("coll");
{
}
}
-TEST_F(StoreTest, SimpleObjectLongnameTest) {
+TEST_P(StoreTest, SimpleObjectLongnameTest) {
int r;
coll_t cid = coll_t("coll");
{
}
}
-TEST_F(StoreTest, ManyObjectTest) {
+TEST_P(StoreTest, ManyObjectTest) {
int NUM_OBJS = 2000;
int r = 0;
coll_t cid("blah");
}
};
-TEST_F(StoreTest, Synthetic) {
+TEST_P(StoreTest, Synthetic) {
ObjectStore::Sequencer osr("test");
MixedGenerator gen;
gen_type rng(time(NULL));
test_obj.wait_for_done();
}
-TEST_F(StoreTest, HashCollisionTest) {
+TEST_P(StoreTest, HashCollisionTest) {
coll_t cid("blah");
int r;
{
store->apply_transaction(t);
}
-TEST_F(StoreTest, OMapTest) {
+TEST_P(StoreTest, OMapTest) {
coll_t cid("blah");
ghobject_t hoid(hobject_t("tesomap", "", CEPH_NOSNAP, 0, 0, ""));
int r;
store->apply_transaction(t);
}
-TEST_F(StoreTest, XattrTest) {
+TEST_P(StoreTest, XattrTest) {
coll_t cid("blah");
ghobject_t hoid(hobject_t("tesomap", "", CEPH_NOSNAP, 0, 0, ""));
bufferlist big;
ASSERT_EQ(r, 0);
}
-TEST_F(StoreTest, ColSplitTest1) {
+TEST_P(StoreTest, ColSplitTest1) {
colsplittest(store.get(), 10000, 11);
}
-TEST_F(StoreTest, ColSplitTest2) {
+TEST_P(StoreTest, ColSplitTest2) {
colsplittest(store.get(), 100, 7);
}
#if 0
-TEST_F(StoreTest, ColSplitTest3) {
+TEST_P(StoreTest, ColSplitTest3) {
colsplittest(store.get(), 100000, 25);
}
#endif
* in order to verify that the merging correctly
* stops at the common prefix subdir. See bug
* #5273 */
-TEST_F(StoreTest, TwoHash) {
+TEST_P(StoreTest, TwoHash) {
coll_t cid("asdf");
int r;
{
ASSERT_EQ(r, 0);
}
-TEST_F(StoreTest, MoveRename) {
+TEST_P(StoreTest, MoveRename) {
coll_t temp_cid("mytemp");
hobject_t temp_oid("tmp_oid", "", CEPH_NOSNAP, 0, 0, "");
coll_t cid("dest");
}
}
+INSTANTIATE_TEST_CASE_P(
+ ObjectStore,
+ StoreTest,
+ ::testing::Values("filestore", "keyvaluestore"));
+
+#else
+
+// Google Test may not support value-parameterized tests with some
+// compilers. If we use conditional compilation to compile out all
+// code referring to the gtest_main library, MSVC linker will not link
+// that library at all and consequently complain about missing entry
+// point defined in that library (fatal error LNK1561: entry point
+// must be defined). This dummy test keeps gtest_main linked in.
+TEST(DummyTest, ValueParameterizedTestsAreNotSupportedOnThisPlatform) {}
+
+#endif
+
+
//
// support tests for qa/workunits/filestore/filestore.sh
//
}
}
+
int main(int argc, char **argv) {
vector<const char*> args;
argv_to_vec(argc, (const char **)argv, args);