diff options
author | cmumford <cmumford@google.com> | 2019-03-19 17:30:42 -0700 |
---|---|---|
committer | Victor Costan <pwnall@chromium.org> | 2019-03-20 13:57:03 -0700 |
commit | ea49b27d062c4bc998616cef7944f7f9088a327d (patch) | |
tree | 3616eb24ed7f65461ccc7c5675bad4028836c650 /util/env_windows.cc | |
parent | ce399ac28af7023b1aff0ede4986cb6d89b3c0b5 (diff) | |
download | leveldb-ea49b27d062c4bc998616cef7944f7f9088a327d.tar.gz |
Switch corruption_test to use InMemEnv.
This change switches corruption_test, which previously used direct file
I/O to corrupt table files for open databases, to use InMemEnv. Using an
Env eliminates some platform dependencies thus simplifying the tests.
Also removed EnvWindowsTestHelper::RelaxFilePermissions(). This was
only added because the Windows Env opens files for exclusive access.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=239305329
Diffstat (limited to 'util/env_windows.cc')
-rw-r--r-- | util/env_windows.cc | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/util/env_windows.cc b/util/env_windows.cc index 3b4496b..93555a8 100644 --- a/util/env_windows.cc +++ b/util/env_windows.cc @@ -43,9 +43,6 @@ constexpr int kDefaultMmapLimit = sizeof(void*) >= 8 ? 1000 : 0; // Modified by EnvWindowsTestHelper::SetReadOnlyMMapLimit(). int g_mmap_limit = kDefaultMmapLimit; -// Relax some file access permissions for testing. -bool g_relax_permissions = false; - std::string GetWindowsErrorMessage(DWORD error_code) { std::string message; char* error_text = nullptr; @@ -366,10 +363,6 @@ class WindowsEnv : public Env { *result = nullptr; DWORD desired_access = GENERIC_READ; DWORD share_mode = FILE_SHARE_READ; - if (g_relax_permissions) { - desired_access |= GENERIC_WRITE; - share_mode |= FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; - } ScopedHandle handle = ::CreateFileA(fname.c_str(), desired_access, share_mode, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); @@ -385,10 +378,6 @@ class WindowsEnv : public Env { *result = nullptr; DWORD desired_access = GENERIC_READ; DWORD share_mode = FILE_SHARE_READ; - if (g_relax_permissions) { - // desired_access |= GENERIC_WRITE; - share_mode |= FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; - } DWORD file_flags = FILE_ATTRIBUTE_READONLY; ScopedHandle handle = @@ -433,10 +422,6 @@ class WindowsEnv : public Env { WritableFile** result) override { DWORD desired_access = GENERIC_WRITE; DWORD share_mode = 0; - if (g_relax_permissions) { - desired_access |= GENERIC_READ; - share_mode |= FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; - } ScopedHandle handle = ::CreateFileA(fname.c_str(), desired_access, share_mode, nullptr, @@ -721,11 +706,6 @@ void EnvWindowsTestHelper::SetReadOnlyMMapLimit(int limit) { g_mmap_limit = limit; } -void EnvWindowsTestHelper::RelaxFilePermissions() { - assert(default_env == nullptr); - g_relax_permissions = true; -} - Env* Env::Default() { std::call_once(once, InitDefaultEnv); return default_env; |