Skip to content

Commit

Permalink
Move test related files under util/ to test_util/ (facebook#5377)
Browse files Browse the repository at this point in the history
Summary:
There are too many types of files under util/. Some test related files don't belong to there or just are just loosely related. Mo
ve them to a new directory test_util/, so that util/ is cleaner.
Pull Request resolved: facebook#5377

Differential Revision: D15551366

Pulled By: siying

fbshipit-source-id: 0f5c8653832354ef8caa31749c0143815d719e2c
  • Loading branch information
siying authored and facebook-github-bot committed May 30, 2019
1 parent a984040 commit e9e0101
Show file tree
Hide file tree
Showing 203 changed files with 322 additions and 322 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,10 @@ set(SOURCES
table/sst_file_writer.cc
table/table_properties.cc
table/two_level_iterator.cc
test_util/sync_point.cc
test_util/sync_point_impl.cc
test_util/testutil.cc
test_util/transaction_test_util.cc
tools/db_bench_tool.cc
tools/dump/db_dump_tool.cc
tools/ldb_cmd.cc
Expand Down Expand Up @@ -629,13 +633,9 @@ set(SOURCES
util/slice.cc
util/status.cc
util/string_util.cc
util/sync_point.cc
util/sync_point_impl.cc
util/testutil.cc
util/thread_local.cc
util/threadpool_imp.cc
util/trace_replay.cc
util/transaction_test_util.cc
util/xxhash.cc
utilities/backupable/backupable_db.cc
utilities/blob_db/blob_compaction_filter.cc
Expand Down Expand Up @@ -1006,7 +1006,7 @@ if(WITH_TESTS)
tools/db_bench.cc
table/table_reader_bench.cc
utilities/persistent_cache/hash_table_bench.cc)
add_library(testharness OBJECT util/testharness.cc)
add_library(testharness OBJECT test_util/testharness.cc)
foreach(sourcefile ${BENCHMARKS})
get_filename_component(exename ${sourcefile} NAME_WE)
add_executable(${exename}${ARTIFACT_SUFFIX} ${sourcefile}
Expand All @@ -1020,7 +1020,7 @@ if(WITH_TESTS)
db/db_test_util.cc
monitoring/thread_status_updater_debug.cc
table/mock_table.cc
util/fault_injection_test_env.cc
test_util/fault_injection_test_env.cc
utilities/cassandra/test_utils.cc
)
# test utilities are only build in debug
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@ LIBOBJECTS += $(TOOL_LIB_SOURCES:.cc=.o)
MOCKOBJECTS = $(MOCK_LIB_SOURCES:.cc=.o)

GTEST = $(GTEST_DIR)/gtest/gtest-all.o
TESTUTIL = ./util/testutil.o
TESTHARNESS = ./util/testharness.o $(TESTUTIL) $(MOCKOBJECTS) $(GTEST)
TESTUTIL = ./test_util/testutil.o
TESTHARNESS = ./test_util/testharness.o $(TESTUTIL) $(MOCKOBJECTS) $(GTEST)
VALGRIND_ERROR = 2
VALGRIND_VER := $(join $(VALGRIND_VER),valgrind)

Expand Down
14 changes: 7 additions & 7 deletions TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ cpp_library(
"table/sst_file_writer.cc",
"table/table_properties.cc",
"table/two_level_iterator.cc",
"test_util/sync_point.cc",
"test_util/sync_point_impl.cc",
"test_util/transaction_test_util.cc",
"tools/dump/db_dump_tool.cc",
"tools/ldb_cmd.cc",
"tools/ldb_tool.cc",
Expand Down Expand Up @@ -235,12 +238,9 @@ cpp_library(
"util/slice.cc",
"util/status.cc",
"util/string_util.cc",
"util/sync_point.cc",
"util/sync_point_impl.cc",
"util/thread_local.cc",
"util/threadpool_imp.cc",
"util/trace_replay.cc",
"util/transaction_test_util.cc",
"util/xxhash.cc",
"utilities/backupable/backupable_db.cc",
"utilities/blob_db/blob_compaction_filter.cc",
Expand Down Expand Up @@ -309,10 +309,10 @@ cpp_library(
srcs = [
"db/db_test_util.cc",
"table/mock_table.cc",
"test_util/fault_injection_test_env.cc",
"test_util/testharness.cc",
"test_util/testutil.cc",
"tools/trace_analyzer_tool.cc",
"util/fault_injection_test_env.cc",
"util/testharness.cc",
"util/testutil.cc",
"utilities/cassandra/test_utils.cc",
],
auto_headers = AutoHeaders.RECURSIVE_GLOB,
Expand All @@ -326,9 +326,9 @@ cpp_library(
cpp_library(
name = "rocksdb_tools_lib",
srcs = [
"test_util/testutil.cc",
"tools/db_bench_tool.cc",
"tools/trace_analyzer_tool.cc",
"util/testutil.cc",
],
auto_headers = AutoHeaders.RECURSIVE_GLOB,
arch_preprocessor_flags = ROCKSDB_ARCH_PREPROCESSOR_FLAGS,
Expand Down
2 changes: 1 addition & 1 deletion buckifier/buckify_rocksdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def generate_targets(repo_path):
"rocksdb_tools_lib",
src_mk.get("BENCH_LIB_SOURCES", []) +
src_mk.get("ANALYZER_LIB_SOURCES", []) +
["util/testutil.cc"],
["test_util/testutil.cc"],
[":rocksdb_lib"])

# test for every test we found in the Makefile
Expand Down
2 changes: 1 addition & 1 deletion cache/cache_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "cache/lru_cache.h"
#include "util/coding.h"
#include "util/string_util.h"
#include "util/testharness.h"
#include "test_util/testharness.h"

namespace rocksdb {

Expand Down
2 changes: 1 addition & 1 deletion cache/lru_cache_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <string>
#include <vector>
#include "port/port.h"
#include "util/testharness.h"
#include "test_util/testharness.h"

namespace rocksdb {

Expand Down
2 changes: 1 addition & 1 deletion db/builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "table/internal_iterator.h"
#include "util/file_reader_writer.h"
#include "util/stop_watch.h"
#include "util/sync_point.h"
#include "test_util/sync_point.h"

namespace rocksdb {

Expand Down
8 changes: 4 additions & 4 deletions db/column_family_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
#include "rocksdb/env.h"
#include "rocksdb/iterator.h"
#include "util/coding.h"
#include "util/fault_injection_test_env.h"
#include "test_util/fault_injection_test_env.h"
#include "util/string_util.h"
#include "util/sync_point.h"
#include "util/testharness.h"
#include "util/testutil.h"
#include "test_util/sync_point.h"
#include "test_util/testharness.h"
#include "test_util/testutil.h"
#include "utilities/merge_operators.h"

namespace rocksdb {
Expand Down
4 changes: 2 additions & 2 deletions db/compact_files_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include "rocksdb/db.h"
#include "rocksdb/env.h"
#include "util/string_util.h"
#include "util/sync_point.h"
#include "util/testharness.h"
#include "test_util/sync_point.h"
#include "test_util/testharness.h"

namespace rocksdb {

Expand Down
2 changes: 1 addition & 1 deletion db/compaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "db/column_family.h"
#include "rocksdb/compaction_filter.h"
#include "util/string_util.h"
#include "util/sync_point.h"
#include "test_util/sync_point.h"

namespace rocksdb {

Expand Down
2 changes: 1 addition & 1 deletion db/compaction_iterator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "port/likely.h"
#include "rocksdb/listener.h"
#include "table/internal_iterator.h"
#include "util/sync_point.h"
#include "test_util/sync_point.h"

#define DEFINITELY_IN_SNAPSHOT(seq, snapshot) \
((seq) <= (snapshot) && \
Expand Down
4 changes: 2 additions & 2 deletions db/compaction_iterator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

#include "port/port.h"
#include "util/string_util.h"
#include "util/testharness.h"
#include "util/testutil.h"
#include "test_util/testharness.h"
#include "test_util/testutil.h"
#include "utilities/merge_operators.h"

namespace rocksdb {
Expand Down
2 changes: 1 addition & 1 deletion db/compaction_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#include "util/random.h"
#include "util/stop_watch.h"
#include "util/string_util.h"
#include "util/sync_point.h"
#include "test_util/sync_point.h"

namespace rocksdb {

Expand Down
6 changes: 3 additions & 3 deletions db/compaction_job_stats_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@
#include "util/mutexlock.h"
#include "util/rate_limiter.h"
#include "util/string_util.h"
#include "util/sync_point.h"
#include "util/testharness.h"
#include "util/testutil.h"
#include "test_util/sync_point.h"
#include "test_util/testharness.h"
#include "test_util/testutil.h"
#include "utilities/merge_operators.h"

#if !defined(IOS_CROSS_COMPILE)
Expand Down
4 changes: 2 additions & 2 deletions db/compaction_job_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#include "table/mock_table.h"
#include "util/file_reader_writer.h"
#include "util/string_util.h"
#include "util/testharness.h"
#include "util/testutil.h"
#include "test_util/testharness.h"
#include "test_util/testutil.h"
#include "utilities/merge_operators.h"

namespace rocksdb {
Expand Down
2 changes: 1 addition & 1 deletion db/compaction_picker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "util/log_buffer.h"
#include "util/random.h"
#include "util/string_util.h"
#include "util/sync_point.h"
#include "test_util/sync_point.h"

namespace rocksdb {

Expand Down
4 changes: 2 additions & 2 deletions db/compaction_picker_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

#include "util/logging.h"
#include "util/string_util.h"
#include "util/testharness.h"
#include "util/testutil.h"
#include "test_util/testharness.h"
#include "test_util/testutil.h"

namespace rocksdb {

Expand Down
2 changes: 1 addition & 1 deletion db/compaction_picker_universal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "util/log_buffer.h"
#include "util/random.h"
#include "util/string_util.h"
#include "util/sync_point.h"
#include "test_util/sync_point.h"

namespace rocksdb {
namespace {
Expand Down
4 changes: 2 additions & 2 deletions db/comparator_db_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include "util/hash.h"
#include "util/kv_map.h"
#include "util/string_util.h"
#include "util/testharness.h"
#include "util/testutil.h"
#include "test_util/testharness.h"
#include "test_util/testutil.h"
#include "utilities/merge_operators.h"

using std::unique_ptr;
Expand Down
4 changes: 2 additions & 2 deletions db/corruption_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include "table/block_based_table_builder.h"
#include "table/meta_blocks.h"
#include "util/string_util.h"
#include "util/testharness.h"
#include "util/testutil.h"
#include "test_util/testharness.h"
#include "test_util/testutil.h"

namespace rocksdb {

Expand Down
4 changes: 2 additions & 2 deletions db/cuckoo_table_db_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include "table/cuckoo_table_reader.h"
#include "table/meta_blocks.h"
#include "util/string_util.h"
#include "util/testharness.h"
#include "util/testutil.h"
#include "test_util/testharness.h"
#include "test_util/testutil.h"

namespace rocksdb {

Expand Down
4 changes: 2 additions & 2 deletions db/db_basic_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#include "db/db_test_util.h"
#include "port/stack_trace.h"
#include "rocksdb/perf_context.h"
#include "util/fault_injection_test_env.h"
#include "test_util/fault_injection_test_env.h"
#if !defined(ROCKSDB_LITE)
#include "util/sync_point.h"
#include "test_util/sync_point.h"
#endif

namespace rocksdb {
Expand Down
4 changes: 2 additions & 2 deletions db/db_compaction_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include "rocksdb/experimental.h"
#include "rocksdb/utilities/convenience.h"
#include "util/concurrent_task_limiter_impl.h"
#include "util/fault_injection_test_env.h"
#include "util/sync_point.h"
#include "test_util/fault_injection_test_env.h"
#include "test_util/sync_point.h"

namespace rocksdb {

Expand Down
2 changes: 1 addition & 1 deletion db/db_encryption_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "port/stack_trace.h"
#include "rocksdb/perf_context.h"
#if !defined(ROCKSDB_LITE)
#include "util/sync_point.h"
#include "test_util/sync_point.h"
#endif
#include <iostream>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion db/db_filesnapshot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "rocksdb/db.h"
#include "rocksdb/env.h"
#include "util/mutexlock.h"
#include "util/sync_point.h"
#include "test_util/sync_point.h"

namespace rocksdb {

Expand Down
4 changes: 2 additions & 2 deletions db/db_flush_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

#include "db/db_test_util.h"
#include "port/stack_trace.h"
#include "util/fault_injection_test_env.h"
#include "util/sync_point.h"
#include "test_util/fault_injection_test_env.h"
#include "test_util/sync_point.h"

namespace rocksdb {

Expand Down
2 changes: 1 addition & 1 deletion db/db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
#include "util/mutexlock.h"
#include "util/stop_watch.h"
#include "util/string_util.h"
#include "util/sync_point.h"
#include "test_util/sync_point.h"

namespace rocksdb {
const std::string kDefaultColumnFamilyName("default");
Expand Down
2 changes: 1 addition & 1 deletion db/db_impl_compaction_flush.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "monitoring/thread_status_updater.h"
#include "monitoring/thread_status_util.h"
#include "util/concurrent_task_limiter_impl.h"
#include "util/sync_point.h"
#include "test_util/sync_point.h"

namespace rocksdb {

Expand Down
2 changes: 1 addition & 1 deletion db/db_impl_open.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "rocksdb/wal_filter.h"
#include "table/block_based_table_factory.h"
#include "util/rate_limiter.h"
#include "util/sync_point.h"
#include "test_util/sync_point.h"

namespace rocksdb {
Options SanitizeOptions(const std::string& dbname, const Options& src) {
Expand Down
2 changes: 1 addition & 1 deletion db/db_impl_write.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "db/event_helpers.h"
#include "monitoring/perf_context_imp.h"
#include "options/options_helper.h"
#include "util/sync_point.h"
#include "test_util/sync_point.h"

namespace rocksdb {
// Convenience methods
Expand Down
2 changes: 1 addition & 1 deletion db/db_iter_stress_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "rocksdb/slice.h"
#include "util/random.h"
#include "util/string_util.h"
#include "util/testharness.h"
#include "test_util/testharness.h"
#include "utilities/merge_operators.h"

#ifdef GFLAGS
Expand Down
4 changes: 2 additions & 2 deletions db/db_iter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include "table/iterator_wrapper.h"
#include "table/merging_iterator.h"
#include "util/string_util.h"
#include "util/sync_point.h"
#include "util/testharness.h"
#include "test_util/sync_point.h"
#include "test_util/testharness.h"
#include "utilities/merge_operators.h"

namespace rocksdb {
Expand Down
Loading

0 comments on commit e9e0101

Please sign in to comment.