Fix unit tests issues on Windows (#1078)

main
Dmitri Smirnov 9 years ago committed by Siying Dong
parent 083cadc7e9
commit c9d668c584
  1. 9
      db/auto_roll_logger_test.cc
  2. 4
      db/column_family_test.cc
  3. 4
      db/db_test.cc

@ -458,7 +458,16 @@ TEST_F(AutoRollLoggerTest, LogHeaderTest) {
TEST_F(AutoRollLoggerTest, LogFileExistence) {
rocksdb::DB* db;
rocksdb::Options options;
#ifdef OS_WIN
// Replace all slashes in the path so windows CompSpec does not
// become confused
std::string testDir(kTestDir);
std::replace_if(testDir.begin(), testDir.end(),
[](char ch) { return ch == '/'; }, '\\');
std::string deleteCmd = "if exist " + testDir + " rd /s /q " + testDir;
#else
string deleteCmd = "rm -rf " + kTestDir;
#endif
ASSERT_EQ(system(deleteCmd.c_str()), 0);
options.max_log_file_size = 100 * 1024 * 1024;
options.create_if_missing = true;

@ -2557,6 +2557,9 @@ TEST_F(ColumnFamilyTest, CompactionSpeedupTwoColumnFamilies) {
ASSERT_EQ(2, dbfull()->BGCompactionsAllowed());
}
// Disable on windows because SyncWAL requires env->IsSyncThreadSafe()
// to return true which is not so in unbuffered mode.
#ifndef OS_WIN
TEST_F(ColumnFamilyTest, LogSyncConflictFlush) {
Open();
CreateColumnFamiliesAndReopen({"one", "two"});
@ -2586,6 +2589,7 @@ TEST_F(ColumnFamilyTest, LogSyncConflictFlush) {
rocksdb::SyncPoint::GetInstance()->DisableProcessing();
Close();
}
#endif
} // namespace rocksdb
int main(int argc, char** argv) {

@ -5880,7 +5880,11 @@ TEST_F(DBTest, MmapAndBufferOptions) {
Options options = CurrentOptions();
// If allow_mmap_reads is on allow_os_buffer must also be on
// On Windows you can have either memory mapped file or a file
// with unbuffered access.
#ifndef OS_WIN
options.allow_os_buffer = false;
#endif
options.allow_mmap_reads = true;
ASSERT_NOK(TryReopen(options));

Loading…
Cancel
Save