From 4fba83b4c27f7d5861a657c1b60495a387ac487a Mon Sep 17 00:00:00 2001 From: Levi Tamasi Date: Fri, 5 Feb 2021 15:39:50 -0800 Subject: [PATCH] Fix db_bench_tool_test (#7935) Summary: The patch fixes the build for `db_bench_tool_test` and makes the tests pass. Namely, it fixes the following issues: * https://github.com/facebook/rocksdb/issues/7703 removed the member variable `fs_` but the test case `OptionsFileMultiLevelUniversal` was not updated. * https://github.com/facebook/rocksdb/issues/7344 fixed the `OptionsFile` test case for the case when Snappy is *not* available but at the same time broke it for the case when it *is* available. (The test used a default-constructed `ColumnFamilyOptions` object, and the default value of the `compression` option is either Snappy or no compression depending on whether Snappy is supported.) * The test used `google::ParseCommandLineFlags` instead of `GFLAGS_NAMESPACE::ParseCommandLineFlags`. Pull Request resolved: https://github.com/facebook/rocksdb/pull/7935 Test Plan: Ran the test both with and without Snappy support. Reviewed By: zhichao-cao Differential Revision: D26269765 Pulled By: ltamasi fbshipit-source-id: b7303d8a981ab299d22ab540e0cbd12d149ed9bb --- tools/db_bench_tool_test.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/db_bench_tool_test.cc b/tools/db_bench_tool_test.cc index af9a72493..8c4259457 100644 --- a/tools/db_bench_tool_test.cc +++ b/tools/db_bench_tool_test.cc @@ -127,7 +127,7 @@ TEST_F(DBBenchTest, OptionsFile) { const std::string kOptionsFileName = test_path_ + "/OPTIONS_test"; Options opt = GetDefaultOptions(); ASSERT_OK(PersistRocksDBOptions(DBOptions(opt), {"default"}, - {ColumnFamilyOptions()}, kOptionsFileName, + {ColumnFamilyOptions(opt)}, kOptionsFileName, opt.env->GetFileSystem().get())); // override the following options as db_bench will not take these @@ -164,7 +164,7 @@ TEST_F(DBBenchTest, OptionsFileMultiLevelUniversal) { ASSERT_OK(PersistRocksDBOptions(DBOptions(opt), {"default"}, {ColumnFamilyOptions(opt)}, kOptionsFileName, - fs_.get())); + opt.env->GetFileSystem().get())); // override the following options as db_bench will not take these // options from the options file @@ -316,7 +316,7 @@ TEST_F(DBBenchTest, OptionsFileFromFile) { int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); - google::ParseCommandLineFlags(&argc, &argv, true); + GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); return RUN_ALL_TESTS(); } -- GitLab