diff options
author | Peter Dillinger <peterd@fb.com> | 2022-10-18 00:35:35 -0700 |
---|---|---|
committer | Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> | 2022-10-18 00:35:35 -0700 |
commit | e466173d5cb0735f49a905489be0eb889a26d89d (patch) | |
tree | a38b745850fcff121e9391376f1230c1d1a006e4 /logging | |
parent | 8367f0d2d76de0f7d096cc65f5f9ebfb907d551a (diff) |
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
Diffstat (limited to 'logging')
-rw-r--r-- | logging/auto_roll_logger_test.cc | 1 | ||||
-rw-r--r-- | logging/env_logger_test.cc | 1 | ||||
-rw-r--r-- | logging/event_logger_test.cc | 1 |
3 files changed, 3 insertions, 0 deletions
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(); } |