Tests to avoid to use TMPDIR directly

Summary: Directly using TMPDIR can cause problems when running tests using parallel option. Fix them.

Test Plan: Run all tests in parallel

Reviewers: kradhakrishnan, yhchiang, IslamAbdelRahman, anthony

Reviewed By: anthony

Subscribers: leveldb, dhruba

Differential Revision: https://reviews.facebook.net/D42807
main
sdong 10 years ago
parent f09d45690b
commit 85ac65536b
  1. 3
      util/db_test_util.cc
  2. 1
      util/db_test_util.h
  3. 2
      utilities/geodb/geodb_test.cc
  4. 2
      utilities/merge_operators/string_append/stringappend_test.cc
  5. 3
      utilities/redis/redis_lists_test.cc

@ -46,6 +46,7 @@ DBTestBase::DBTestBase(const std::string path) : option_config_(kDefault),
env_->SetBackgroundThreads(1, Env::HIGH);
dbname_ = test::TmpDir(env_) + path;
alternative_wal_dir_ = dbname_ + "/wal";
alternative_db_log_dir_ = dbname_ + "/db_log_dir";
auto options = CurrentOptions();
auto delete_options = options;
delete_options.wal_dir = alternative_wal_dir_;
@ -229,7 +230,7 @@ Options DBTestBase::CurrentOptions(
options.num_levels = 3;
break;
case kDBLogDir:
options.db_log_dir = test::TmpDir(env_);
options.db_log_dir = alternative_db_log_dir_;
break;
case kWalDirAndMmapReads:
options.wal_dir = alternative_wal_dir_;

@ -428,6 +428,7 @@ class DBTestBase : public testing::Test {
public:
std::string dbname_;
std::string alternative_wal_dir_;
std::string alternative_db_log_dir_;
MockEnv* mem_env_;
SpecialEnv* env_;
DB* db_;

@ -35,7 +35,7 @@ class GeoDBTest : public testing::Test {
}
};
const std::string GeoDBTest::kDefaultDbName = test::TmpDir();
const std::string GeoDBTest::kDefaultDbName = test::TmpDir() + "/geodb_test";
Options GeoDBTest::options = Options();
// Insert, Get and Remove

@ -23,7 +23,7 @@ using namespace rocksdb;
namespace rocksdb {
// Path to the database on file system
const std::string kDbName = test::TmpDir();
const std::string kDbName = test::TmpDir() + "/stringappend_test";
namespace {
// OpenDb opens a (possibly new) rocksdb database with a StringAppendOperator

@ -39,7 +39,8 @@ class RedisListsTest : public testing::Test {
}
};
const string RedisListsTest::kDefaultDbName = test::TmpDir();
const string RedisListsTest::kDefaultDbName =
test::TmpDir() + "/redis_lists_test";
Options RedisListsTest::options = Options();
// operator== and operator<< are defined below for vectors (lists)

Loading…
Cancel
Save