From e466173d5cb0735f49a905489be0eb889a26d89d Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Tue, 18 Oct 2022 00:35:35 -0700 Subject: [PATCH] Print stack traces on frozen tests in CI (#10828) Summary: Instead of existing calls to ps from gnu_parallel, call a new wrapper that does ps, looks for unit test like processes, and uses pstack or gdb to print thread stack traces. Also, using `ps -wwf` instead of `ps -wf` ensures output is not cut off. For security, CircleCI runs with security restrictions on ptrace (/proc/sys/kernel/yama/ptrace_scope = 1), and this change adds a work-around to `InstallStackTraceHandler()` (only used by testing tools) to allow any process from the same user to debug it. (I've also touched >100 files to ensure all the unit tests call this function.) Pull Request resolved: https://github.com/facebook/rocksdb/pull/10828 Test Plan: local manual + temporary infinite loop in a unit test to observe in CircleCI Reviewed By: hx235 Differential Revision: D40447634 Pulled By: pdillinger fbshipit-source-id: 718a4c4a5b54fa0f9af2d01a446162b45e5e84e1 --- Makefile | 2 +- build_tools/gnu_parallel | 3 +- build_tools/ps_with_stack | 38 +++++++++++++++++++ cache/cache_reservation_manager_test.cc | 1 + cache/compressed_secondary_cache_test.cc | 1 + cache/lru_cache_test.cc | 1 + db/blob/blob_counting_iterator_test.cc | 1 + db/blob/blob_file_addition_test.cc | 1 + db/blob/blob_file_builder_test.cc | 1 + db/blob/blob_file_cache_test.cc | 1 + db/blob/blob_file_garbage_test.cc | 1 + db/blob/blob_file_reader_test.cc | 1 + db/blob/blob_garbage_meter_test.cc | 1 + db/blob/blob_source_test.cc | 1 + db/compact_files_test.cc | 1 + db/compaction/clipping_iterator_test.cc | 1 + db/compaction/compaction_iterator_test.cc | 1 + db/compaction/compaction_job_test.cc | 1 + db/compaction/compaction_picker_test.cc | 1 + db/comparator_db_test.cc | 1 + db/cuckoo_table_db_test.cc | 1 + db/db_iter_stress_test.cc | 1 + db/db_iter_test.cc | 1 + db/db_kv_checksum_test.cc | 1 + db/db_logical_block_size_cache_test.cc | 1 + db/dbformat_test.cc | 1 + db/fault_injection_test.cc | 1 + db/filename_test.cc | 1 + db/flush_job_test.cc | 1 + db/listener_test.cc | 1 + db/log_test.cc | 1 + db/manual_compaction_test.cc | 1 + db/memtable_list_test.cc | 1 + db/merge_helper_test.cc | 1 + db/options_file_test.cc | 1 + db/perf_context_test.cc | 1 + db/periodic_task_scheduler_test.cc | 1 + db/plain_table_db_test.cc | 1 + db/prefix_test.cc | 1 + db/range_del_aggregator_test.cc | 1 + db/range_tombstone_fragmenter_test.cc | 1 + db/repair_test.cc | 1 + db/table_properties_collector_test.cc | 1 + db/version_builder_test.cc | 1 + db/version_edit_test.cc | 1 + db/version_set_test.cc | 1 + db/wal_manager_test.cc | 1 + db/wide/wide_column_serialization_test.cc | 1 + db/write_batch_test.cc | 1 + db/write_callback_test.cc | 1 + db/write_controller_test.cc | 1 + env/env_basic_test.cc | 1 + env/io_posix_test.cc | 1 + env/mock_env_test.cc | 1 + file/delete_scheduler_test.cc | 1 + file/prefetch_test.cc | 1 + logging/auto_roll_logger_test.cc | 1 + logging/env_logger_test.cc | 1 + logging/event_logger_test.cc | 1 + memory/arena_test.cc | 1 + memory/memory_allocator_test.cc | 1 + memtable/inlineskiplist_test.cc | 1 + memtable/skiplist_test.cc | 1 + memtable/write_buffer_manager_test.cc | 1 + monitoring/histogram_test.cc | 1 + monitoring/iostats_context_test.cc | 1 + options/configurable_test.cc | 1 + options/options_settable_test.cc | 1 + options/options_test.cc | 1 + port/stack_trace.cc | 7 ++++ port/stack_trace.h | 5 ++- table/block_based/block_test.cc | 1 + .../block_based/data_block_hash_index_test.cc | 1 + table/block_based/full_filter_block_test.cc | 1 + .../partitioned_filter_block_test.cc | 1 + table/cuckoo/cuckoo_table_builder_test.cc | 1 + table/cuckoo/cuckoo_table_reader_test.cc | 1 + table/merger_test.cc | 1 + test_util/testharness.h | 2 + .../block_cache_trace_analyzer_test.cc | 1 + tools/db_bench_tool_test.cc | 1 + tools/io_tracer_parser_test.cc | 1 + tools/reduce_levels_test.cc | 1 + tools/trace_analyzer_test.cc | 1 + trace_replay/block_cache_tracer_test.cc | 1 + trace_replay/io_tracer_test.cc | 1 + util/autovector_test.cc | 1 + util/bloom_test.cc | 1 + util/coding_test.cc | 1 + util/crc32c_test.cc | 1 + util/dynamic_bloom_test.cc | 1 + util/file_reader_writer_test.cc | 1 + util/filelock_test.cc | 1 + util/hash_test.cc | 1 + util/heap_test.cc | 6 ++- util/random_test.cc | 1 + util/rate_limiter_test.cc | 1 + util/repeatable_thread_test.cc | 1 + util/ribbon_test.cc | 1 + util/slice_transform_test.cc | 1 + util/thread_list_test.cc | 1 + util/thread_local_test.cc | 1 + util/timer_test.cc | 1 + util/work_queue_test.cc | 4 ++ utilities/agg_merge/agg_merge_test.cc | 1 + utilities/blob_db/blob_db_test.cc | 1 + utilities/cassandra/cassandra_format_test.cc | 1 + .../cassandra/cassandra_functional_test.cc | 1 + .../cassandra/cassandra_row_merge_test.cc | 1 + .../cassandra/cassandra_serialize_test.cc | 1 + utilities/env_mirror_test.cc | 1 + utilities/env_timed_test.cc | 1 + utilities/memory/memory_test.cc | 1 + utilities/object_registry_test.cc | 1 + utilities/options/options_util_test.cc | 1 + utilities/persistent_cache/hash_table_test.cc | 1 + .../persistent_cache/persistent_cache_test.cc | 1 + .../simulator_cache/cache_simulator_test.cc | 1 + .../optimistic_transaction_test.cc | 1 + .../transactions/timestamped_snapshot_test.cc | 1 + utilities/transactions/transaction_test.cc | 1 + .../write_committed_transaction_ts_test.cc | 1 + .../write_unprepared_transaction_test.cc | 1 + utilities/ttl/ttl_test.cc | 1 + utilities/util_merge_operators_test.cc | 1 + 125 files changed, 179 insertions(+), 5 deletions(-) create mode 100755 build_tools/ps_with_stack diff --git a/Makefile b/Makefile index 9e300a20c..87c8eac83 100644 --- a/Makefile +++ b/Makefile @@ -1832,7 +1832,7 @@ memtable_list_test: $(OBJ_DIR)/db/memtable_list_test.o $(TEST_LIBRARY) $(LIBRARY write_callback_test: $(OBJ_DIR)/db/write_callback_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) -heap_test: $(OBJ_DIR)/util/heap_test.o $(GTEST) +heap_test: $(OBJ_DIR)/util/heap_test.o $(TEST_LIBRARY) $(LIBRARY) $(AM_LINK) point_lock_manager_test: utilities/transactions/lock/point/point_lock_manager_test.o $(TEST_LIBRARY) $(LIBRARY) diff --git a/build_tools/gnu_parallel b/build_tools/gnu_parallel index 211e96946..3365f46ba 100755 --- a/build_tools/gnu_parallel +++ b/build_tools/gnu_parallel @@ -1916,7 +1916,8 @@ sub drain_job_queue { } elsif (not $ps_reported and (time() - $last_progress_time) >= 60) { # No progress in at least 60 seconds: run ps print $Global::original_stderr "\n"; - system("ps", "-wf"); + my $script_dir = ::dirname($0); + system("$script_dir/ps_with_stack || ps -wwf"); $ps_reported = 1; } $last_left = $Global::left; diff --git a/build_tools/ps_with_stack b/build_tools/ps_with_stack new file mode 100755 index 000000000..ee4256965 --- /dev/null +++ b/build_tools/ps_with_stack @@ -0,0 +1,38 @@ +#!/usr/bin/env perl + +use strict; + +open(my $ps, "-|", "ps -wwf"); +my $cols_known = 0; +my $cmd_col = 0; +my $pid_col = 0; +while (<$ps>) { + print; + my @cols = split(/\s+/); + + if (!$cols_known && /CMD/) { + # Parse relevant ps column headers + for (my $i = 0; $i <= $#cols; $i++) { + if ($cols[$i] eq "CMD") { + $cmd_col = $i; + } + if ($cols[$i] eq "PID") { + $pid_col = $i; + } + } + $cols_known = 1; + } else { + my $pid = $cols[$pid_col]; + my $cmd = $cols[$cmd_col]; + # Match numeric PID and relative path command + # -> The intention is only to dump stack traces for hangs in code under + # test, which means we probably just built it and are executing by + # relative path (e.g. ./my_test or foo/bar_test) rather then by absolute + # path (e.g. /usr/bin/time) or PATH search (e.g. grep). + if ($pid =~ /^[0-9]+$/ && $cmd =~ /^[^\/ ]+[\/]/) { + print "Dumping stacks for $pid...\n"; + system("pstack $pid || gdb -batch -p $pid -ex 'thread apply all bt'"); + } + } +} +close $ps; diff --git a/cache/cache_reservation_manager_test.cc b/cache/cache_reservation_manager_test.cc index 3d000b5ad..2a0c318e0 100644 --- a/cache/cache_reservation_manager_test.cc +++ b/cache/cache_reservation_manager_test.cc @@ -463,6 +463,7 @@ TEST(CacheReservationHandleTest, HandleTest) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/cache/compressed_secondary_cache_test.cc b/cache/compressed_secondary_cache_test.cc index 5a5eeebda..574c257a7 100644 --- a/cache/compressed_secondary_cache_test.cc +++ b/cache/compressed_secondary_cache_test.cc @@ -999,6 +999,7 @@ TEST_F(CompressedSecondaryCacheTest, SplictValueAndMergeChunksTest) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/cache/lru_cache_test.cc b/cache/lru_cache_test.cc index f42404cce..748908d0c 100644 --- a/cache/lru_cache_test.cc +++ b/cache/lru_cache_test.cc @@ -2703,6 +2703,7 @@ TEST_F(DBSecondaryCacheTest, TestSecondaryCacheOptionTwoDB) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/blob/blob_counting_iterator_test.cc b/db/blob/blob_counting_iterator_test.cc index faa329e81..c7bbc8f58 100644 --- a/db/blob/blob_counting_iterator_test.cc +++ b/db/blob/blob_counting_iterator_test.cc @@ -321,6 +321,7 @@ TEST(BlobCountingIteratorTest, CorruptBlobIndex) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/blob/blob_file_addition_test.cc b/db/blob/blob_file_addition_test.cc index 9d819b557..64cb0a9d6 100644 --- a/db/blob/blob_file_addition_test.cc +++ b/db/blob/blob_file_addition_test.cc @@ -205,6 +205,7 @@ TEST_F(BlobFileAdditionTest, ForwardIncompatibleCustomField) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/blob/blob_file_builder_test.cc b/db/blob/blob_file_builder_test.cc index 663681966..3a0feee45 100644 --- a/db/blob/blob_file_builder_test.cc +++ b/db/blob/blob_file_builder_test.cc @@ -674,6 +674,7 @@ TEST_P(BlobFileBuilderIOErrorTest, IOError) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/blob/blob_file_cache_test.cc b/db/blob/blob_file_cache_test.cc index b19d78b66..d3a61b3c5 100644 --- a/db/blob/blob_file_cache_test.cc +++ b/db/blob/blob_file_cache_test.cc @@ -263,6 +263,7 @@ TEST_F(BlobFileCacheTest, GetBlobFileReader_CacheFull) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/blob/blob_file_garbage_test.cc b/db/blob/blob_file_garbage_test.cc index 31eeff4ba..292a8b38a 100644 --- a/db/blob/blob_file_garbage_test.cc +++ b/db/blob/blob_file_garbage_test.cc @@ -168,6 +168,7 @@ TEST_F(BlobFileGarbageTest, ForwardIncompatibleCustomField) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/blob/blob_file_reader_test.cc b/db/blob/blob_file_reader_test.cc index 413040fcb..03458e2b5 100644 --- a/db/blob/blob_file_reader_test.cc +++ b/db/blob/blob_file_reader_test.cc @@ -1018,6 +1018,7 @@ TEST_P(BlobFileReaderDecodingErrorTest, DecodingError) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/blob/blob_garbage_meter_test.cc b/db/blob/blob_garbage_meter_test.cc index 7066a2c33..ba53f06f1 100644 --- a/db/blob/blob_garbage_meter_test.cc +++ b/db/blob/blob_garbage_meter_test.cc @@ -191,6 +191,7 @@ TEST(BlobGarbageMeterTest, InlinedTTLBlobIndex) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/blob/blob_source_test.cc b/db/blob/blob_source_test.cc index 30f2aa02a..a85ed8646 100644 --- a/db/blob/blob_source_test.cc +++ b/db/blob/blob_source_test.cc @@ -1618,6 +1618,7 @@ TEST_F(BlobSourceCacheReservationTest, IncreaseCacheReservationOnFullCache) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/compact_files_test.cc b/db/compact_files_test.cc index 196b6c627..499220d7f 100644 --- a/db/compact_files_test.cc +++ b/db/compact_files_test.cc @@ -490,6 +490,7 @@ TEST_F(CompactFilesTest, GetCompactionJobInfo) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/compaction/clipping_iterator_test.cc b/db/compaction/clipping_iterator_test.cc index a9c2eb356..b2b167048 100644 --- a/db/compaction/clipping_iterator_test.cc +++ b/db/compaction/clipping_iterator_test.cc @@ -253,6 +253,7 @@ INSTANTIATE_TEST_CASE_P( } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/compaction/compaction_iterator_test.cc b/db/compaction/compaction_iterator_test.cc index ccfe0728e..0bc3cd713 100644 --- a/db/compaction/compaction_iterator_test.cc +++ b/db/compaction/compaction_iterator_test.cc @@ -1497,6 +1497,7 @@ INSTANTIATE_TEST_CASE_P(CompactionIteratorTsGcTestInstance, } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/compaction/compaction_job_test.cc b/db/compaction/compaction_job_test.cc index 57580445f..de80e1a4a 100644 --- a/db/compaction/compaction_job_test.cc +++ b/db/compaction/compaction_job_test.cc @@ -2434,6 +2434,7 @@ TEST_F(CompactionJobIOPriorityTest, GetRateLimiterPriority) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); RegisterCustomObjects(argc, argv); return RUN_ALL_TESTS(); diff --git a/db/compaction/compaction_picker_test.cc b/db/compaction/compaction_picker_test.cc index dea7ea37b..539d25a33 100644 --- a/db/compaction/compaction_picker_test.cc +++ b/db/compaction/compaction_picker_test.cc @@ -3721,6 +3721,7 @@ INSTANTIATE_TEST_CASE_P(PerKeyPlacementCompactionPickerTest, } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/comparator_db_test.cc b/db/comparator_db_test.cc index 34a4776f0..229ab9a5a 100644 --- a/db/comparator_db_test.cc +++ b/db/comparator_db_test.cc @@ -673,6 +673,7 @@ TEST_P(ComparatorDBTest, SeparatorSuccessorRandomizeTest) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/cuckoo_table_db_test.cc b/db/cuckoo_table_db_test.cc index eff0cdbf8..2484c402d 100644 --- a/db/cuckoo_table_db_test.cc +++ b/db/cuckoo_table_db_test.cc @@ -345,6 +345,7 @@ TEST_F(CuckooTableDBTest, AdaptiveTable) { int main(int argc, char** argv) { if (ROCKSDB_NAMESPACE::port::kLittleEndian) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } else { diff --git a/db/db_iter_stress_test.cc b/db/db_iter_stress_test.cc index 2d26a7a64..ca1a1fd95 100644 --- a/db/db_iter_stress_test.cc +++ b/db/db_iter_stress_test.cc @@ -652,6 +652,7 @@ TEST_F(DBIteratorStressTest, StressTest) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); ParseCommandLineFlags(&argc, &argv, true); return RUN_ALL_TESTS(); diff --git a/db/db_iter_test.cc b/db/db_iter_test.cc index c6f30a450..545d48a1f 100644 --- a/db/db_iter_test.cc +++ b/db/db_iter_test.cc @@ -3187,6 +3187,7 @@ TEST_F(DBIteratorTest, ReverseToForwardWithDisappearingKeys) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_kv_checksum_test.cc b/db/db_kv_checksum_test.cc index 64b910a50..614399243 100644 --- a/db/db_kv_checksum_test.cc +++ b/db/db_kv_checksum_test.cc @@ -879,6 +879,7 @@ TEST_P(DbMemtableKVChecksumTest, FlushWithCorruptAfterMemtableInsert) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/db_logical_block_size_cache_test.cc b/db/db_logical_block_size_cache_test.cc index 9c6e2e6da..ae5cded0e 100644 --- a/db/db_logical_block_size_cache_test.cc +++ b/db/db_logical_block_size_cache_test.cc @@ -515,6 +515,7 @@ TEST_F(DBLogicalBlockSizeCacheTest, MultiDBWithSamePaths) { #endif // OS_LINUX int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/dbformat_test.cc b/db/dbformat_test.cc index c4923968e..b52b0192c 100644 --- a/db/dbformat_test.cc +++ b/db/dbformat_test.cc @@ -206,6 +206,7 @@ TEST_F(FormatTest, RangeTombstoneSerializeEndKey) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); RegisterCustomObjects(argc, argv); return RUN_ALL_TESTS(); diff --git a/db/fault_injection_test.cc b/db/fault_injection_test.cc index de675e691..b2c7870d9 100644 --- a/db/fault_injection_test.cc +++ b/db/fault_injection_test.cc @@ -631,6 +631,7 @@ INSTANTIATE_TEST_CASE_P( } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); RegisterCustomObjects(argc, argv); return RUN_ALL_TESTS(); diff --git a/db/filename_test.cc b/db/filename_test.cc index 23f6974b1..bba275dc0 100644 --- a/db/filename_test.cc +++ b/db/filename_test.cc @@ -237,6 +237,7 @@ TEST_F(FileNameTest, NormalizePath) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/flush_job_test.cc b/db/flush_job_test.cc index 4b35bc9b4..c3275b856 100644 --- a/db/flush_job_test.cc +++ b/db/flush_job_test.cc @@ -739,6 +739,7 @@ TEST_F(FlushJobTimestampTest, NoKeyExpired) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/listener_test.cc b/db/listener_test.cc index 2c0732750..0d88c8f55 100644 --- a/db/listener_test.cc +++ b/db/listener_test.cc @@ -1591,6 +1591,7 @@ TEST_F(EventListenerTest, BlobDBFileTest) { #endif // ROCKSDB_LITE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/log_test.cc b/db/log_test.cc index 668e26629..a055d72f6 100644 --- a/db/log_test.cc +++ b/db/log_test.cc @@ -1062,6 +1062,7 @@ INSTANTIATE_TEST_CASE_P( } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/manual_compaction_test.cc b/db/manual_compaction_test.cc index df324d928..d41eca589 100644 --- a/db/manual_compaction_test.cc +++ b/db/manual_compaction_test.cc @@ -304,6 +304,7 @@ TEST_F(ManualCompactionTest, SkipLevel) { } // anonymous namespace int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/memtable_list_test.cc b/db/memtable_list_test.cc index 42098bdd9..458dc18a3 100644 --- a/db/memtable_list_test.cc +++ b/db/memtable_list_test.cc @@ -1009,6 +1009,7 @@ TEST_F(MemTableListTest, AtomicFlusTest) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/merge_helper_test.cc b/db/merge_helper_test.cc index f458a1af7..b3fd9a074 100644 --- a/db/merge_helper_test.cc +++ b/db/merge_helper_test.cc @@ -291,6 +291,7 @@ TEST_F(MergeHelperTest, DontFilterMergeOperandsBeforeSnapshotTest) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/options_file_test.cc b/db/options_file_test.cc index 3ff7e0952..283d19344 100644 --- a/db/options_file_test.cc +++ b/db/options_file_test.cc @@ -102,6 +102,7 @@ TEST_F(OptionsFileTest, OptionsFileName) { int main(int argc, char** argv) { #if !(defined NDEBUG) || !defined(OS_WIN) + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); #else diff --git a/db/perf_context_test.cc b/db/perf_context_test.cc index a8aec686a..0416dee08 100644 --- a/db/perf_context_test.cc +++ b/db/perf_context_test.cc @@ -959,6 +959,7 @@ TEST_F(PerfContextTest, CPUTimer) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); for (int i = 1; i < argc; i++) { diff --git a/db/periodic_task_scheduler_test.cc b/db/periodic_task_scheduler_test.cc index b0922c0f8..4abea4d5e 100644 --- a/db/periodic_task_scheduler_test.cc +++ b/db/periodic_task_scheduler_test.cc @@ -224,6 +224,7 @@ TEST_F(PeriodicTaskSchedulerTest, MultiEnv) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); diff --git a/db/plain_table_db_test.cc b/db/plain_table_db_test.cc index b18864595..a38ed8742 100644 --- a/db/plain_table_db_test.cc +++ b/db/plain_table_db_test.cc @@ -1352,6 +1352,7 @@ INSTANTIATE_TEST_CASE_P(PlainTableDBTest, PlainTableDBTest, ::testing::Bool()); } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/prefix_test.cc b/db/prefix_test.cc index 57845d9cc..74f0ce6be 100644 --- a/db/prefix_test.cc +++ b/db/prefix_test.cc @@ -890,6 +890,7 @@ TEST_F(PrefixTest, PrefixSeekModePrev3) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); ParseCommandLineFlags(&argc, &argv, true); return RUN_ALL_TESTS(); diff --git a/db/range_del_aggregator_test.cc b/db/range_del_aggregator_test.cc index 99f8bc8f0..3541fafd1 100644 --- a/db/range_del_aggregator_test.cc +++ b/db/range_del_aggregator_test.cc @@ -709,6 +709,7 @@ TEST_F(RangeDelAggregatorTest, } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/range_tombstone_fragmenter_test.cc b/db/range_tombstone_fragmenter_test.cc index 368dc909f..46b3c99b5 100644 --- a/db/range_tombstone_fragmenter_test.cc +++ b/db/range_tombstone_fragmenter_test.cc @@ -549,6 +549,7 @@ TEST_F(RangeTombstoneFragmenterTest, SeekOutOfBounds) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/repair_test.cc b/db/repair_test.cc index 58c1d6a16..b93f1f951 100644 --- a/db/repair_test.cc +++ b/db/repair_test.cc @@ -427,6 +427,7 @@ TEST_F(RepairTest, DbNameContainsTrailingSlash) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/table_properties_collector_test.cc b/db/table_properties_collector_test.cc index b329fdef4..4098677b1 100644 --- a/db/table_properties_collector_test.cc +++ b/db/table_properties_collector_test.cc @@ -507,6 +507,7 @@ INSTANTIATE_TEST_CASE_P(CustomizedTablePropertiesCollector, TablePropertiesTest, } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/version_builder_test.cc b/db/version_builder_test.cc index cd7cce7ff..a751b697f 100644 --- a/db/version_builder_test.cc +++ b/db/version_builder_test.cc @@ -1689,6 +1689,7 @@ TEST_F(VersionBuilderTest, EstimatedActiveKeys) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/version_edit_test.cc b/db/version_edit_test.cc index 44163ab71..c7f271d83 100644 --- a/db/version_edit_test.cc +++ b/db/version_edit_test.cc @@ -724,6 +724,7 @@ TEST(FileMetaDataTest, UpdateBoundariesBlobIndex) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/version_set_test.cc b/db/version_set_test.cc index 906938b3b..d38e3ad73 100644 --- a/db/version_set_test.cc +++ b/db/version_set_test.cc @@ -3579,6 +3579,7 @@ TEST_P(ChargeFileMetadataTestWithParam, Basic) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/wal_manager_test.cc b/db/wal_manager_test.cc index cbf866ce3..e3c96c90c 100644 --- a/db/wal_manager_test.cc +++ b/db/wal_manager_test.cc @@ -329,6 +329,7 @@ TEST_F(WalManagerTest, TransactionLogIteratorNewFileWhileScanning) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/wide/wide_column_serialization_test.cc b/db/wide/wide_column_serialization_test.cc index 87d0d647e..a52d8eb3b 100644 --- a/db/wide/wide_column_serialization_test.cc +++ b/db/wide/wide_column_serialization_test.cc @@ -303,6 +303,7 @@ TEST(WideColumnSerializationTest, DeserializeColumnsOutOfOrder) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/write_batch_test.cc b/db/write_batch_test.cc index d3d9ba860..9e436cf50 100644 --- a/db/write_batch_test.cc +++ b/db/write_batch_test.cc @@ -1107,6 +1107,7 @@ TEST_F(WriteBatchTest, CommitWithTimestamp) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/write_callback_test.cc b/db/write_callback_test.cc index 3c8c9b14e..16061739e 100644 --- a/db/write_callback_test.cc +++ b/db/write_callback_test.cc @@ -447,6 +447,7 @@ TEST_F(WriteCallbackTest, WriteCallBackTest) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/db/write_controller_test.cc b/db/write_controller_test.cc index 1f7cf999a..69c2418e9 100644 --- a/db/write_controller_test.cc +++ b/db/write_controller_test.cc @@ -242,6 +242,7 @@ TEST_F(WriteControllerTest, CreditAccumulation) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/env/env_basic_test.cc b/env/env_basic_test.cc index 40413b569..2f7da52df 100644 --- a/env/env_basic_test.cc +++ b/env/env_basic_test.cc @@ -395,6 +395,7 @@ TEST_P(EnvMoreTestWithParam, GetChildrenIgnoresDotAndDotDot) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/env/io_posix_test.cc b/env/io_posix_test.cc index 3b9b90c96..81ce50587 100644 --- a/env/io_posix_test.cc +++ b/env/io_posix_test.cc @@ -135,6 +135,7 @@ TEST_F(LogicalBlockSizeCacheTest, Ref) { #endif int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/env/mock_env_test.cc b/env/mock_env_test.cc index 8e0d8ea8c..bcd8ed530 100644 --- a/env/mock_env_test.cc +++ b/env/mock_env_test.cc @@ -78,6 +78,7 @@ TEST_F(MockEnvTest, FakeSleeping) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/file/delete_scheduler_test.cc b/file/delete_scheduler_test.cc index 4da0623c7..196721155 100644 --- a/file/delete_scheduler_test.cc +++ b/file/delete_scheduler_test.cc @@ -712,6 +712,7 @@ TEST_F(DeleteSchedulerTest, IsTrashCheck) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/file/prefetch_test.cc b/file/prefetch_test.cc index 3e006246f..ec06ef0d8 100644 --- a/file/prefetch_test.cc +++ b/file/prefetch_test.cc @@ -2079,6 +2079,7 @@ namespace { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); diff --git a/logging/auto_roll_logger_test.cc b/logging/auto_roll_logger_test.cc index f95f4215d..e9578369a 100644 --- a/logging/auto_roll_logger_test.cc +++ b/logging/auto_roll_logger_test.cc @@ -728,6 +728,7 @@ TEST_F(AutoRollLoggerTest, RenameError) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/logging/env_logger_test.cc b/logging/env_logger_test.cc index b06e78588..0406ac0f4 100644 --- a/logging/env_logger_test.cc +++ b/logging/env_logger_test.cc @@ -156,6 +156,7 @@ TEST_F(EnvLoggerTest, ConcurrentLogging) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/logging/event_logger_test.cc b/logging/event_logger_test.cc index 656d73c87..a48bcdc0c 100644 --- a/logging/event_logger_test.cc +++ b/logging/event_logger_test.cc @@ -38,6 +38,7 @@ TEST_F(EventLoggerTest, SimpleTest) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/memory/arena_test.cc b/memory/arena_test.cc index 5f5e10632..0aaf39826 100644 --- a/memory/arena_test.cc +++ b/memory/arena_test.cc @@ -259,6 +259,7 @@ TEST(MmapTest, AllocateLazyZeroed) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/memory/memory_allocator_test.cc b/memory/memory_allocator_test.cc index 104241f5c..6afde7165 100644 --- a/memory/memory_allocator_test.cc +++ b/memory/memory_allocator_test.cc @@ -234,6 +234,7 @@ INSTANTIATE_TEST_CASE_P( } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/memtable/inlineskiplist_test.cc b/memtable/inlineskiplist_test.cc index 4523aa770..1f3c6a691 100644 --- a/memtable/inlineskiplist_test.cc +++ b/memtable/inlineskiplist_test.cc @@ -658,6 +658,7 @@ TEST_F(InlineSkipTest, ConcurrentInsertWithHint3) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/memtable/skiplist_test.cc b/memtable/skiplist_test.cc index d35bc856d..1d43d734b 100644 --- a/memtable/skiplist_test.cc +++ b/memtable/skiplist_test.cc @@ -383,6 +383,7 @@ TEST_F(SkipTest, Concurrent5) { RunConcurrent(5); } } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/memtable/write_buffer_manager_test.cc b/memtable/write_buffer_manager_test.cc index f74565134..546df894a 100644 --- a/memtable/write_buffer_manager_test.cc +++ b/memtable/write_buffer_manager_test.cc @@ -298,6 +298,7 @@ TEST_F(ChargeWriteBufferTest, BasicWithCacheFull) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/monitoring/histogram_test.cc b/monitoring/histogram_test.cc index 1ed561d44..834884cbd 100644 --- a/monitoring/histogram_test.cc +++ b/monitoring/histogram_test.cc @@ -248,6 +248,7 @@ TEST_F(HistogramTest, LostUpdateStandardDeviation) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/monitoring/iostats_context_test.cc b/monitoring/iostats_context_test.cc index 49f6fc058..ea40822ff 100644 --- a/monitoring/iostats_context_test.cc +++ b/monitoring/iostats_context_test.cc @@ -24,6 +24,7 @@ TEST(IOStatsContextTest, ToString) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/options/configurable_test.cc b/options/configurable_test.cc index 8643193d8..6ec02cf3a 100644 --- a/options/configurable_test.cc +++ b/options/configurable_test.cc @@ -872,6 +872,7 @@ INSTANTIATE_TEST_CASE_P( } // namespace test } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); #ifdef GFLAGS ParseCommandLineFlags(&argc, &argv, true); diff --git a/options/options_settable_test.cc b/options/options_settable_test.cc index ff4e2acc5..f0ee5ecc6 100644 --- a/options/options_settable_test.cc +++ b/options/options_settable_test.cc @@ -611,6 +611,7 @@ TEST_F(OptionsSettableTest, ColumnFamilyOptionsAllFieldsSettable) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); #ifdef GFLAGS ParseCommandLineFlags(&argc, &argv, true); diff --git a/options/options_test.cc b/options/options_test.cc index e6a824c9b..b89434c3a 100644 --- a/options/options_test.cc +++ b/options/options_test.cc @@ -4985,6 +4985,7 @@ INSTANTIATE_TEST_CASE_P(OptionsSanityCheckTest, OptionsSanityCheckTest, } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); #ifdef GFLAGS ParseCommandLineFlags(&argc, &argv, true); diff --git a/port/stack_trace.cc b/port/stack_trace.cc index 15a36bb71..afb8baf3b 100644 --- a/port/stack_trace.cc +++ b/port/stack_trace.cc @@ -35,6 +35,9 @@ void* SaveStack(int* /*num_frames*/, int /*first_frames_to_skip*/) { #if defined(OS_FREEBSD) #include #endif +#ifdef OS_LINUX +#include +#endif #include "port/lang.h" @@ -187,6 +190,10 @@ void InstallStackTraceHandler() { signal(SIGSEGV, StackTraceHandler); signal(SIGBUS, StackTraceHandler); signal(SIGABRT, StackTraceHandler); + // Allow ouside debugger to attach, even with Yama security restrictions +#ifdef PR_SET_PTRACER_ANY + (void)prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0); +#endif } } // namespace port diff --git a/port/stack_trace.h b/port/stack_trace.h index b3474ca3e..5b3bf9320 100644 --- a/port/stack_trace.h +++ b/port/stack_trace.h @@ -12,7 +12,10 @@ namespace port { // Install a signal handler to print callstack on the following signals: // SIGILL SIGSEGV SIGBUS SIGABRT -// Currently supports linux only. No-op otherwise. +// And also (Linux ony for now) overrides security settings to allow outside +// processes to attach to this one as a debugger. ONLY USE FOR NON-SECURITY +// CRITICAL PROCESSES such as unit tests or benchmarking tools. +// Currently supports only some POSIX implementations. No-op otherwise. void InstallStackTraceHandler(); // Prints stack, skips skip_first_frames frames diff --git a/table/block_based/block_test.cc b/table/block_based/block_test.cc index 4b7ba09b1..83b87fe79 100644 --- a/table/block_based/block_test.cc +++ b/table/block_based/block_test.cc @@ -621,6 +621,7 @@ INSTANTIATE_TEST_CASE_P(P, IndexBlockTest, } // namespace ROCKSDB_NAMESPACE int main(int argc, char **argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/table/block_based/data_block_hash_index_test.cc b/table/block_based/data_block_hash_index_test.cc index 2e137ca6d..b3106634b 100644 --- a/table/block_based/data_block_hash_index_test.cc +++ b/table/block_based/data_block_hash_index_test.cc @@ -711,6 +711,7 @@ TEST(DataBlockHashIndex, BlockBoundary) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/table/block_based/full_filter_block_test.cc b/table/block_based/full_filter_block_test.cc index e894edd75..37a9a5085 100644 --- a/table/block_based/full_filter_block_test.cc +++ b/table/block_based/full_filter_block_test.cc @@ -334,6 +334,7 @@ TEST_F(FullFilterBlockTest, SingleChunk) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/table/block_based/partitioned_filter_block_test.cc b/table/block_based/partitioned_filter_block_test.cc index 5003708e4..21e073365 100644 --- a/table/block_based/partitioned_filter_block_test.cc +++ b/table/block_based/partitioned_filter_block_test.cc @@ -429,6 +429,7 @@ TEST_P(PartitionedFilterBlockTest, PartitionCount) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/table/cuckoo/cuckoo_table_builder_test.cc b/table/cuckoo/cuckoo_table_builder_test.cc index c3f2b5379..07b42cdf8 100644 --- a/table/cuckoo/cuckoo_table_builder_test.cc +++ b/table/cuckoo/cuckoo_table_builder_test.cc @@ -630,6 +630,7 @@ TEST_F(CuckooBuilderTest, FailWhenSameKeyInserted) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/table/cuckoo/cuckoo_table_reader_test.cc b/table/cuckoo/cuckoo_table_reader_test.cc index b04c14f40..6203a42d4 100644 --- a/table/cuckoo/cuckoo_table_reader_test.cc +++ b/table/cuckoo/cuckoo_table_reader_test.cc @@ -556,6 +556,7 @@ TEST_F(CuckooReaderTest, TestReadPerformance) { int main(int argc, char** argv) { if (ROCKSDB_NAMESPACE::port::kLittleEndian) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); ParseCommandLineFlags(&argc, &argv, true); return RUN_ALL_TESTS(); diff --git a/table/merger_test.cc b/table/merger_test.cc index 02eadf0ab..71dc798e5 100644 --- a/table/merger_test.cc +++ b/table/merger_test.cc @@ -176,6 +176,7 @@ TEST_F(MergerTest, SeekToLastTest) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/test_util/testharness.h b/test_util/testharness.h index 8576eea62..69018629a 100644 --- a/test_util/testharness.h +++ b/test_util/testharness.h @@ -52,6 +52,8 @@ } while (false) /* user ; */ #include + +#include "port/stack_trace.h" #include "rocksdb/env.h" namespace ROCKSDB_NAMESPACE { diff --git a/tools/block_cache_analyzer/block_cache_trace_analyzer_test.cc b/tools/block_cache_analyzer/block_cache_trace_analyzer_test.cc index 5b8300a81..915ad6117 100644 --- a/tools/block_cache_analyzer/block_cache_trace_analyzer_test.cc +++ b/tools/block_cache_analyzer/block_cache_trace_analyzer_test.cc @@ -711,6 +711,7 @@ TEST_F(BlockCacheTracerTest, MixedBlocks) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/tools/db_bench_tool_test.cc b/tools/db_bench_tool_test.cc index 7d09c67a5..a406ff66c 100644 --- a/tools/db_bench_tool_test.cc +++ b/tools/db_bench_tool_test.cc @@ -320,6 +320,7 @@ TEST_F(DBBenchTest, OptionsFileFromFile) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); return RUN_ALL_TESTS(); diff --git a/tools/io_tracer_parser_test.cc b/tools/io_tracer_parser_test.cc index 48c0664fa..41be5fa96 100644 --- a/tools/io_tracer_parser_test.cc +++ b/tools/io_tracer_parser_test.cc @@ -176,6 +176,7 @@ TEST_F(IOTracerParserTest, NoRecordingBeforeStartIOTrace) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/tools/reduce_levels_test.cc b/tools/reduce_levels_test.cc index 4a60560e1..c538554a0 100644 --- a/tools/reduce_levels_test.cc +++ b/tools/reduce_levels_test.cc @@ -206,6 +206,7 @@ TEST_F(ReduceLevelTest, All_Levels) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/tools/trace_analyzer_test.cc b/tools/trace_analyzer_test.cc index 619a3468a..146c0c6f4 100644 --- a/tools/trace_analyzer_test.cc +++ b/tools/trace_analyzer_test.cc @@ -874,6 +874,7 @@ TEST_F(TraceAnalyzerTest, MultiGet) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/trace_replay/block_cache_tracer_test.cc b/trace_replay/block_cache_tracer_test.cc index 425287de5..9386ed718 100644 --- a/trace_replay/block_cache_tracer_test.cc +++ b/trace_replay/block_cache_tracer_test.cc @@ -379,6 +379,7 @@ TEST_F(BlockCacheTracerTest, HumanReadableTrace) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/trace_replay/io_tracer_test.cc b/trace_replay/io_tracer_test.cc index 49973b40b..be3af4fb3 100644 --- a/trace_replay/io_tracer_test.cc +++ b/trace_replay/io_tracer_test.cc @@ -347,6 +347,7 @@ TEST_F(IOTracerTest, AtomicMultipleWrites) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/util/autovector_test.cc b/util/autovector_test.cc index bc7fbc3f1..9dad69e73 100644 --- a/util/autovector_test.cc +++ b/util/autovector_test.cc @@ -325,6 +325,7 @@ TEST_F(AutoVectorTest, PerfBench) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/util/bloom_test.cc b/util/bloom_test.cc index 0bb50cbef..4adf522e4 100644 --- a/util/bloom_test.cc +++ b/util/bloom_test.cc @@ -1169,6 +1169,7 @@ TEST(RibbonTest, RibbonTestLevelThreshold) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); ParseCommandLineFlags(&argc, &argv, true); diff --git a/util/coding_test.cc b/util/coding_test.cc index ed1d680f7..0f974277d 100644 --- a/util/coding_test.cc +++ b/util/coding_test.cc @@ -212,6 +212,7 @@ TEST(Coding, Strings) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/util/crc32c_test.cc b/util/crc32c_test.cc index e02a95ebe..e8929bfe4 100644 --- a/util/crc32c_test.cc +++ b/util/crc32c_test.cc @@ -204,6 +204,7 @@ inline uint64_t fnv64_buf(const void* buf, } int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); // Populate a buffer with a deterministic pattern diff --git a/util/dynamic_bloom_test.cc b/util/dynamic_bloom_test.cc index 9f032befd..9f43ce0fd 100644 --- a/util/dynamic_bloom_test.cc +++ b/util/dynamic_bloom_test.cc @@ -315,6 +315,7 @@ TEST_F(DynamicBloomTest, concurrent_with_perf) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); ParseCommandLineFlags(&argc, &argv, true); diff --git a/util/file_reader_writer_test.cc b/util/file_reader_writer_test.cc index 6c4e2a9a0..e778efc3c 100644 --- a/util/file_reader_writer_test.cc +++ b/util/file_reader_writer_test.cc @@ -1060,6 +1060,7 @@ TEST_F(WritableFileWriterIOPriorityTest, BasicOp) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/util/filelock_test.cc b/util/filelock_test.cc index 2cf21d6cd..e7f4d8ae4 100644 --- a/util/filelock_test.cc +++ b/util/filelock_test.cc @@ -147,6 +147,7 @@ TEST_F(LockTest, LockBySameThread) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/util/hash_test.cc b/util/hash_test.cc index b82b5a4af..4b1d52238 100644 --- a/util/hash_test.cc +++ b/util/hash_test.cc @@ -846,6 +846,7 @@ TEST(MathTest, CodingGeneric) { int main(int argc, char** argv) { fprintf(stderr, "NPHash64 id: %x\n", static_cast(ROCKSDB_NAMESPACE::GetSliceNPHash64("RocksDB"))); + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); diff --git a/util/heap_test.cc b/util/heap_test.cc index 1f188e73b..fd54751e3 100644 --- a/util/heap_test.cc +++ b/util/heap_test.cc @@ -3,15 +3,16 @@ // COPYING file in the root directory) and Apache 2.0 License // (found in the LICENSE.Apache file in the root directory). +#include "util/heap.h" + #include #include - #include #include #include -#include "util/heap.h" +#include "port/stack_trace.h" #ifndef GFLAGS const int64_t FLAGS_iters = 100000; @@ -131,6 +132,7 @@ INSTANTIATE_TEST_CASE_P( } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); #ifdef GFLAGS GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); diff --git a/util/random_test.cc b/util/random_test.cc index ad5208193..b8c9357e8 100644 --- a/util/random_test.cc +++ b/util/random_test.cc @@ -99,6 +99,7 @@ TEST(RandomTest, PercentTrue) { } int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); diff --git a/util/rate_limiter_test.cc b/util/rate_limiter_test.cc index df83287e9..cda134867 100644 --- a/util/rate_limiter_test.cc +++ b/util/rate_limiter_test.cc @@ -470,6 +470,7 @@ TEST_F(RateLimiterTest, AutoTuneIncreaseWhenFull) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/util/repeatable_thread_test.cc b/util/repeatable_thread_test.cc index 19f22d726..0b3e95464 100644 --- a/util/repeatable_thread_test.cc +++ b/util/repeatable_thread_test.cc @@ -104,6 +104,7 @@ TEST_F(RepeatableThreadTest, MockEnvTest) { } int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); diff --git a/util/ribbon_test.cc b/util/ribbon_test.cc index c8fd436aa..ae6d1db49 100644 --- a/util/ribbon_test.cc +++ b/util/ribbon_test.cc @@ -1298,6 +1298,7 @@ TYPED_TEST(RibbonTypeParamTest, OptimizeHomogAtScale) { } int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); #ifdef GFLAGS ParseCommandLineFlags(&argc, &argv, true); diff --git a/util/slice_transform_test.cc b/util/slice_transform_test.cc index 6550cadea..64ac8bb1f 100644 --- a/util/slice_transform_test.cc +++ b/util/slice_transform_test.cc @@ -148,6 +148,7 @@ TEST_F(SliceTransformDBTest, CapPrefix) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/util/thread_list_test.cc b/util/thread_list_test.cc index 65da2edeb..51edee020 100644 --- a/util/thread_list_test.cc +++ b/util/thread_list_test.cc @@ -357,6 +357,7 @@ TEST_F(ThreadListTest, SimpleEventTest) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/util/thread_local_test.cc b/util/thread_local_test.cc index 7baab2fde..25ef5c0ee 100644 --- a/util/thread_local_test.cc +++ b/util/thread_local_test.cc @@ -576,6 +576,7 @@ TEST_F(ThreadLocalTest, DISABLED_MainThreadDiesFirst) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/util/timer_test.cc b/util/timer_test.cc index a04c098ea..0ebfa9f3d 100644 --- a/util/timer_test.cc +++ b/util/timer_test.cc @@ -395,6 +395,7 @@ TEST_F(TimerTest, DestroyTimerWithRunningFunc) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); diff --git a/util/work_queue_test.cc b/util/work_queue_test.cc index 967101568..c23a51279 100644 --- a/util/work_queue_test.cc +++ b/util/work_queue_test.cc @@ -14,12 +14,15 @@ #include "util/work_queue.h" #include + #include #include #include #include #include +#include "port/stack_trace.h" + namespace ROCKSDB_NAMESPACE { // Unit test for work_queue.h. @@ -263,6 +266,7 @@ TEST(WorkQueue, FailedPop) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/agg_merge/agg_merge_test.cc b/utilities/agg_merge/agg_merge_test.cc index 6502daa36..a65441cd0 100644 --- a/utilities/agg_merge/agg_merge_test.cc +++ b/utilities/agg_merge/agg_merge_test.cc @@ -129,6 +129,7 @@ TEST_F(AggMergeTest, TestUsingMergeOperator) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/blob_db/blob_db_test.cc b/utilities/blob_db/blob_db_test.cc index 623286668..c8771ff69 100644 --- a/utilities/blob_db/blob_db_test.cc +++ b/utilities/blob_db/blob_db_test.cc @@ -2392,6 +2392,7 @@ TEST_F(BlobDBTest, SyncBlobFileBeforeCloseIOError) { // A black-box test for the ttl wrapper around rocksdb int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/cassandra/cassandra_format_test.cc b/utilities/cassandra/cassandra_format_test.cc index 9805d35d7..62c6ae508 100644 --- a/utilities/cassandra/cassandra_format_test.cc +++ b/utilities/cassandra/cassandra_format_test.cc @@ -370,6 +370,7 @@ TEST(RowValueTest, ExpireTtlShouldConvertExpiredColumnsToTombstones) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/cassandra/cassandra_functional_test.cc b/utilities/cassandra/cassandra_functional_test.cc index 15f633bac..17ad97262 100644 --- a/utilities/cassandra/cassandra_functional_test.cc +++ b/utilities/cassandra/cassandra_functional_test.cc @@ -423,6 +423,7 @@ TEST_F(CassandraFunctionalTest, LoadCompactionFilterFactory) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/cassandra/cassandra_row_merge_test.cc b/utilities/cassandra/cassandra_row_merge_test.cc index 33a1b5627..6f6b7514b 100644 --- a/utilities/cassandra/cassandra_row_merge_test.cc +++ b/utilities/cassandra/cassandra_row_merge_test.cc @@ -109,6 +109,7 @@ TEST(RowValueMergeTest, MergeWithRowTombstone) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/cassandra/cassandra_serialize_test.cc b/utilities/cassandra/cassandra_serialize_test.cc index 8d0cf6667..bd5932c93 100644 --- a/utilities/cassandra/cassandra_serialize_test.cc +++ b/utilities/cassandra/cassandra_serialize_test.cc @@ -182,6 +182,7 @@ TEST(SerializeTest, DeserializeI8) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/env_mirror_test.cc b/utilities/env_mirror_test.cc index 0be9d7db2..13683b8ee 100644 --- a/utilities/env_mirror_test.cc +++ b/utilities/env_mirror_test.cc @@ -208,6 +208,7 @@ TEST_F(EnvMirrorTest, LargeWrite) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/env_timed_test.cc b/utilities/env_timed_test.cc index 7bc8f41b0..29952925c 100644 --- a/utilities/env_timed_test.cc +++ b/utilities/env_timed_test.cc @@ -29,6 +29,7 @@ TEST_F(TimedEnvTest, BasicTest) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/memory/memory_test.cc b/utilities/memory/memory_test.cc index 33d0666e8..0b043af0e 100644 --- a/utilities/memory/memory_test.cc +++ b/utilities/memory/memory_test.cc @@ -261,6 +261,7 @@ TEST_F(MemoryTest, MemTableAndTableReadersTotal) { int main(int argc, char** argv) { #if !(defined NDEBUG) || !defined(OS_WIN) + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); #else diff --git a/utilities/object_registry_test.cc b/utilities/object_registry_test.cc index 26ae79b48..90cd155ee 100644 --- a/utilities/object_registry_test.cc +++ b/utilities/object_registry_test.cc @@ -856,6 +856,7 @@ TEST_F(PatternEntryTest, TestTwoNamesAndPattern) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/options/options_util_test.cc b/utilities/options/options_util_test.cc index f88e3a56c..1c3b41ff2 100644 --- a/utilities/options/options_util_test.cc +++ b/utilities/options/options_util_test.cc @@ -761,6 +761,7 @@ TEST_F(OptionsUtilTest, WalDirInOptins) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); #ifdef GFLAGS ParseCommandLineFlags(&argc, &argv, true); diff --git a/utilities/persistent_cache/hash_table_test.cc b/utilities/persistent_cache/hash_table_test.cc index 62a5b1d40..a56813afa 100644 --- a/utilities/persistent_cache/hash_table_test.cc +++ b/utilities/persistent_cache/hash_table_test.cc @@ -155,6 +155,7 @@ TEST_F(EvictableHashTableTest, TestEvict) { #endif int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/persistent_cache/persistent_cache_test.cc b/utilities/persistent_cache/persistent_cache_test.cc index f511c9450..bacb9f822 100644 --- a/utilities/persistent_cache/persistent_cache_test.cc +++ b/utilities/persistent_cache/persistent_cache_test.cc @@ -448,6 +448,7 @@ TEST_F(PersistentCacheDBTest, DISABLED_TieredCacheTest) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/simulator_cache/cache_simulator_test.cc b/utilities/simulator_cache/cache_simulator_test.cc index beacdfa1e..01441de46 100644 --- a/utilities/simulator_cache/cache_simulator_test.cc +++ b/utilities/simulator_cache/cache_simulator_test.cc @@ -491,6 +491,7 @@ TEST_F(CacheSimulatorTest, GhostHybridRowBlockCacheSimulator) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/transactions/optimistic_transaction_test.cc b/utilities/transactions/optimistic_transaction_test.cc index 7161aa4b7..1bd9fc9be 100644 --- a/utilities/transactions/optimistic_transaction_test.cc +++ b/utilities/transactions/optimistic_transaction_test.cc @@ -1472,6 +1472,7 @@ INSTANTIATE_TEST_CASE_P( } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/transactions/timestamped_snapshot_test.cc b/utilities/transactions/timestamped_snapshot_test.cc index 546a77f8b..e9b474415 100644 --- a/utilities/transactions/timestamped_snapshot_test.cc +++ b/utilities/transactions/timestamped_snapshot_test.cc @@ -459,6 +459,7 @@ TEST_P(TransactionTest, MultipleTimestampedSnapshots) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/transactions/transaction_test.cc b/utilities/transactions/transaction_test.cc index 607c4fe00..632826def 100644 --- a/utilities/transactions/transaction_test.cc +++ b/utilities/transactions/transaction_test.cc @@ -6533,6 +6533,7 @@ TEST_P(TransactionTest, WriteWithBulkCreatedColumnFamilies) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/transactions/write_committed_transaction_ts_test.cc b/utilities/transactions/write_committed_transaction_ts_test.cc index 0c1f659c3..2bae5db12 100644 --- a/utilities/transactions/write_committed_transaction_ts_test.cc +++ b/utilities/transactions/write_committed_transaction_ts_test.cc @@ -562,6 +562,7 @@ TEST_P(WriteCommittedTxnWithTsTest, CheckKeysForConflicts) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/transactions/write_unprepared_transaction_test.cc b/utilities/transactions/write_unprepared_transaction_test.cc index b0c4bae52..771ff5553 100644 --- a/utilities/transactions/write_unprepared_transaction_test.cc +++ b/utilities/transactions/write_unprepared_transaction_test.cc @@ -773,6 +773,7 @@ TEST_P(WriteUnpreparedTransactionTest, UntrackedKeys) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/ttl/ttl_test.cc b/utilities/ttl/ttl_test.cc index 982051ac7..e32c82a9d 100644 --- a/utilities/ttl/ttl_test.cc +++ b/utilities/ttl/ttl_test.cc @@ -895,6 +895,7 @@ TEST_F(TtlOptionsTest, LoadTtlMergeOperator) { // A black-box test for the ttl wrapper around rocksdb int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/utilities/util_merge_operators_test.cc b/utilities/util_merge_operators_test.cc index 3b043ea2f..fed6f1a75 100644 --- a/utilities/util_merge_operators_test.cc +++ b/utilities/util_merge_operators_test.cc @@ -94,6 +94,7 @@ TEST_F(UtilMergeOperatorTest, MaxMergeOperator) { } // namespace ROCKSDB_NAMESPACE int main(int argc, char** argv) { + ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }