From aba5070c1b1fb85a6dcbd5230fd918584325bd20 Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Mon, 5 Jan 2026 11:02:39 -0800 Subject: [PATCH 1/2] Rename db_test2 -> db_etc2_test, improve `make clean` Summary: When searching/grepping through unit tests, it's convenient to use test.cc suffix to match all unit tests, or to exclude test.cc when excluding unit tests from a code search. (I've even seen my AI assistant grep through `*test.cc`.) So I'm renaming db_test2.cc (as planned in Bonus: improved the speed of `make clean` by using just one `find` and by pruning "hidden" .* directories that should not be modified anyway. Test Plan: exsiting tests, manual `make clean` runs --- .github/actions/windows-build-steps/action.yml | 2 +- .gitignore | 2 +- BUCK | 4 ++-- CMakeLists.txt | 2 +- Makefile | 7 ++++--- db/{db_test2.cc => db_etc2_test.cc} | 2 +- src.mk | 2 +- util/compression_test.cc | 2 +- 8 files changed, 12 insertions(+), 11 deletions(-) rename db/{db_test2.cc => db_etc2_test.cc} (99%) diff --git a/.github/actions/windows-build-steps/action.yml b/.github/actions/windows-build-steps/action.yml index 699d4aa0e580..cba97eac6051 100644 --- a/.github/actions/windows-build-steps/action.yml +++ b/.github/actions/windows-build-steps/action.yml @@ -56,7 +56,7 @@ runs: msbuild build/rocksdb.sln /m:32 /p:LinkIncremental=false -property:Configuration=Debug -property:Platform=x64 if(!$?) { Exit $LASTEXITCODE } echo ========================= Test RocksDB ========================= - build_tools\run_ci_db_test.ps1 -SuiteRun arena_test,db_basic_test,db_test,db_test2,db_merge_operand_test,bloom_test,c_test,coding_test,crc32c_test,dynamic_bloom_test,env_basic_test,env_test,hash_test,random_test -Concurrency 16 + build_tools\run_ci_db_test.ps1 -SuiteRun arena_test,db_basic_test,db_test,db_etc2_test,db_merge_operand_test,bloom_test,c_test,coding_test,crc32c_test,dynamic_bloom_test,env_basic_test,env_test,hash_test,random_test -Concurrency 16 if(!$?) { Exit $LASTEXITCODE } echo ======================== Test RocksJava ======================== cd build\java diff --git a/.gitignore b/.gitignore index 645e7021f35d..5103b741ad36 100644 --- a/.gitignore +++ b/.gitignore @@ -52,7 +52,7 @@ GRTAGS GTAGS rocksdb_dump rocksdb_undump -db_test2 +db_etc2_test trace_analyzer block_cache_trace_analyzer io_tracer_parser diff --git a/BUCK b/BUCK index c7fd89eeb18d..3c67eb4f8c5e 100644 --- a/BUCK +++ b/BUCK @@ -4996,8 +4996,8 @@ cpp_unittest_wrapper(name="db_test", extra_compiler_flags=[]) -cpp_unittest_wrapper(name="db_test2", - srcs=["db/db_test2.cc"], +cpp_unittest_wrapper(name="db_etc2_test", + srcs=["db/db_etc2_test.cc"], deps=[":rocksdb_test_lib"], extra_compiler_flags=[]) diff --git a/CMakeLists.txt b/CMakeLists.txt index 03837b672ac4..b5a5179d498f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1380,6 +1380,7 @@ if(WITH_TESTS) db/db_clip_test.cc db/db_dynamic_level_test.cc db/db_encryption_test.cc + db/db_etc2_test.cc db/db_etc3_test.cc db/db_flush_test.cc db/db_inplace_update_test.cc @@ -1402,7 +1403,6 @@ if(WITH_TESTS) db/db_table_properties_test.cc db/db_tailing_iter_test.cc db/db_test.cc - db/db_test2.cc db/db_logical_block_size_cache_test.cc db/db_universal_compaction_test.cc db/db_wal_test.cc diff --git a/Makefile b/Makefile index 0c31657d76f5..69112b600e86 100644 --- a/Makefile +++ b/Makefile @@ -1173,8 +1173,9 @@ clean-rocks: rm -f ${LIBNAME}*.so* ${LIBNAME}*.a rm -f $(BENCHMARKS) $(TOOLS) $(TESTS) $(PARALLEL_TEST) $(MICROBENCHS) rm -rf $(CLEAN_FILES) ios-x86 ios-arm scan_build_report - $(FIND) . -name "*.[oda]" -exec rm -f {} \; - $(FIND) . -type f \( -name "*.gcda" -o -name "*.gcno" \) -exec rm -f {} \; + find . -regextype awk \ + -regex '.*/[.].*' -prune -o \ + -type f -regex '.*[.]([oda]|gcda|gcno)' -exec rm -f {} \; clean-rocksjava: clean-rocks rm -rf jl jls @@ -1412,7 +1413,7 @@ db_encryption_test: $(OBJ_DIR)/db/db_encryption_test.o $(TEST_LIBRARY) $(LIBRARY db_test: $(OBJ_DIR)/db/db_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -db_test2: $(OBJ_DIR)/db/db_test2.o $(TEST_LIBRARY) $(LIBRARY) +db_etc2_test: $(OBJ_DIR)/db/db_etc2_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) db_etc3_test: $(OBJ_DIR)/db/db_etc3_test.o $(TEST_LIBRARY) $(LIBRARY) diff --git a/db/db_test2.cc b/db/db_etc2_test.cc similarity index 99% rename from db/db_test2.cc rename to db/db_etc2_test.cc index 33da1ffaf12f..ac896aa19746 100644 --- a/db/db_test2.cc +++ b/db/db_etc2_test.cc @@ -35,7 +35,7 @@ namespace ROCKSDB_NAMESPACE { class DBTest2 : public DBTestBase { public: - DBTest2() : DBTestBase("db_test2", /*env_do_fsync=*/true) {} + DBTest2() : DBTestBase("db_etc2_test", /*env_do_fsync=*/true) {} }; TEST_F(DBTest2, OpenForReadOnly) { diff --git a/src.mk b/src.mk index 5eac640572d1..aca58d8551c9 100644 --- a/src.mk +++ b/src.mk @@ -494,6 +494,7 @@ TEST_MAIN_SOURCES = \ db/db_clip_test.cc \ db/db_dynamic_level_test.cc \ db/db_encryption_test.cc \ + db/db_etc2_test.cc \ db/db_etc3_test.cc \ db/db_flush_test.cc \ db/db_follower_test.cc \ @@ -520,7 +521,6 @@ TEST_MAIN_SOURCES = \ db/db_table_properties_test.cc \ db/db_tailing_iter_test.cc \ db/db_test.cc \ - db/db_test2.cc \ db/db_logical_block_size_cache_test.cc \ db/db_universal_compaction_test.cc \ db/db_wal_test.cc \ diff --git a/util/compression_test.cc b/util/compression_test.cc index 06571f233bf3..f3ca9154300b 100644 --- a/util/compression_test.cc +++ b/util/compression_test.cc @@ -520,7 +520,7 @@ class PresetCompressionDictTest public testing::WithParamInterface> { public: PresetCompressionDictTest() - : DBTestBase("db_test2", false /* env_do_fsync */), + : DBTestBase("db_etc2_test", false /* env_do_fsync */), compression_type_(std::get<0>(GetParam())), bottommost_(std::get<1>(GetParam())) {} From 30282a9438355a1e499793e9b9ddddbbff38acdc Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Mon, 5 Jan 2026 15:06:17 -0800 Subject: [PATCH 2/2] Fixes for when -regextype is not available --- BUCK | 12 ++++++------ Makefile | 22 +++++++++++++--------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/BUCK b/BUCK index 3c67eb4f8c5e..fd6aeb22ee5e 100644 --- a/BUCK +++ b/BUCK @@ -4846,6 +4846,12 @@ cpp_unittest_wrapper(name="db_encryption_test", extra_compiler_flags=[]) +cpp_unittest_wrapper(name="db_etc2_test", + srcs=["db/db_etc2_test.cc"], + deps=[":rocksdb_test_lib"], + extra_compiler_flags=[]) + + cpp_unittest_wrapper(name="db_etc3_test", srcs=["db/db_etc3_test.cc"], deps=[":rocksdb_test_lib"], @@ -4996,12 +5002,6 @@ cpp_unittest_wrapper(name="db_test", extra_compiler_flags=[]) -cpp_unittest_wrapper(name="db_etc2_test", - srcs=["db/db_etc2_test.cc"], - deps=[":rocksdb_test_lib"], - extra_compiler_flags=[]) - - cpp_unittest_wrapper(name="db_universal_compaction_test", srcs=["db/db_universal_compaction_test.cc"], deps=[":rocksdb_test_lib"], diff --git a/Makefile b/Makefile index 69112b600e86..8f7bc1670b5f 100644 --- a/Makefile +++ b/Makefile @@ -327,6 +327,9 @@ missing_make_config_paths := $(shell \ $(foreach path, $(missing_make_config_paths), \ $(warning Warning: $(path) does not exist)) +# This (the first rule) must depend on "all". +default: all + ifeq ($(PLATFORM), OS_AIX) # no debug info else ifneq ($(PLATFORM), IOS) @@ -481,9 +484,6 @@ ifdef ROCKSDB_MODIFY_NPHASH PLATFORM_CXXFLAGS += -DROCKSDB_MODIFY_NPHASH=1 endif -# This (the first rule) must depend on "all". -default: all - WARNING_FLAGS = -W -Wextra -Wall -Wsign-compare -Wshadow \ -Wunused-parameter @@ -946,7 +946,7 @@ check_0: ' run "make watch-log" in a separate window' ''; \ { \ printf './%s\n' $(filter-out $(PARALLEL_TEST),$(TESTS)); \ - find t -name 'run-*' -print; \ + $(FIND) t -name 'run-*' -print; \ } \ | $(prioritize_long_running_tests) \ | grep -E '$(tests-regexp)' \ @@ -968,7 +968,7 @@ valgrind_check_0: ' run "make watch-log" in a separate window' ''; \ { \ printf './%s\n' $(filter-out $(PARALLEL_TEST) %skiplist_test options_settable_test, $(TESTS)); \ - find t -name 'run-*' -print; \ + $(FIND) t -name 'run-*' -print; \ } \ | $(prioritize_long_running_tests) \ | grep -E '$(tests-regexp)' \ @@ -1173,9 +1173,13 @@ clean-rocks: rm -f ${LIBNAME}*.so* ${LIBNAME}*.a rm -f $(BENCHMARKS) $(TOOLS) $(TESTS) $(PARALLEL_TEST) $(MICROBENCHS) rm -rf $(CLEAN_FILES) ios-x86 ios-arm scan_build_report - find . -regextype awk \ - -regex '.*/[.].*' -prune -o \ - -type f -regex '.*[.]([oda]|gcda|gcno)' -exec rm -f {} \; + if $(FIND) Makefile -regextype awk &> /dev/null; then \ + $(FIND) . -regextype awk \ + -regex '.*/[.].*' -prune -o \ + -type f -regex '.*[.]([oda]|gcda|gcno)' -exec rm -f {} \; ; \ + else \ + $(FIND) . -name "*.[oda]" -exec rm -f {} \; ; \ + fi clean-rocksjava: clean-rocks rm -rf jl jls @@ -1188,7 +1192,7 @@ clean-ext-libraries-all: rm -rf bzip2* snappy* zlib* lz4* zstd* clean-ext-libraries-bin: - find . -maxdepth 1 -type d \( -name bzip2\* -or -name snappy\* -or -name zlib\* -or -name lz4\* -or -name zstd\* \) -prune -exec rm -rf {} \; + $(FIND) . -maxdepth 1 -type d \( -name bzip2\* -or -name snappy\* -or -name zlib\* -or -name lz4\* -or -name zstd\* \) -prune -exec rm -rf {} \; tags: ctags -R .