Use specific DB name in merge_test
Summary: Currently, merge_test uses /tmp/testdb for the test database. It should really use something more specific to merge_test. Most of the other tests use test::TmpDir() + "/<test name>db". This patch implements such behavior for merge_test; it makes merge_test use test::TmpDir() + "/merge_testdb" Test Plan: make clean make -j32 merge_test ./merge_test Reviewers: dhruba, haobo Reviewed By: dhruba CC: leveldb Differential Revision: https://reviews.facebook.net/D11877
This commit is contained in:
parent
18afff2e63
commit
abc90b067c
4
Makefile
4
Makefile
|
@ -240,8 +240,8 @@ reduce_levels_test: tools/reduce_levels_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
||||||
write_batch_test: db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
write_batch_test: db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
||||||
$(CXX) db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS)
|
$(CXX) db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS)
|
||||||
|
|
||||||
merge_test: db/merge_test.o $(LIBOBJECTS)
|
merge_test: db/merge_test.o $(LIBOBJECTS) $(TESTHARNESS)
|
||||||
$(CXX) db/merge_test.o $(LIBOBJECTS) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS)
|
$(CXX) db/merge_test.o $(LIBOBJECTS) $(TESTHARNESS) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS)
|
||||||
|
|
||||||
$(MEMENVLIBRARY) : $(MEMENVOBJECTS)
|
$(MEMENVLIBRARY) : $(MEMENVOBJECTS)
|
||||||
rm -f $@
|
rm -f $@
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "leveldb/merge_operator.h"
|
#include "leveldb/merge_operator.h"
|
||||||
#include "db/dbformat.h"
|
#include "db/dbformat.h"
|
||||||
#include "utilities/merge_operators.h"
|
#include "utilities/merge_operators.h"
|
||||||
|
#include "util/testharness.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace leveldb;
|
using namespace leveldb;
|
||||||
|
@ -20,7 +21,7 @@ std::shared_ptr<DB> OpenDb() {
|
||||||
Options options;
|
Options options;
|
||||||
options.create_if_missing = true;
|
options.create_if_missing = true;
|
||||||
options.merge_operator = mergeOperator.get();
|
options.merge_operator = mergeOperator.get();
|
||||||
Status s = DB::Open(options, "/tmp/testdb", &db);
|
Status s = DB::Open(options, test::TmpDir() + "/merge_testdb", &db);
|
||||||
if (!s.ok()) {
|
if (!s.ok()) {
|
||||||
cerr << s.ToString() << endl;
|
cerr << s.ToString() << endl;
|
||||||
assert(false);
|
assert(false);
|
||||||
|
@ -45,7 +46,7 @@ class Counters {
|
||||||
uint64_t default_;
|
uint64_t default_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Counters(std::shared_ptr<DB> db, uint64_t defaultCount = 0)
|
explicit Counters(std::shared_ptr<DB> db, uint64_t defaultCount = 0)
|
||||||
: db_(db),
|
: db_(db),
|
||||||
put_option_(),
|
put_option_(),
|
||||||
get_option_(),
|
get_option_(),
|
||||||
|
@ -143,7 +144,7 @@ class MergeBasedCounters : public Counters {
|
||||||
WriteOptions merge_option_; // for merge
|
WriteOptions merge_option_; // for merge
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MergeBasedCounters(std::shared_ptr<DB> db, uint64_t defaultCount = 0)
|
explicit MergeBasedCounters(std::shared_ptr<DB> db, uint64_t defaultCount = 0)
|
||||||
: Counters(db, defaultCount),
|
: Counters(db, defaultCount),
|
||||||
merge_option_() {
|
merge_option_() {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user