-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[lldb][unittest] Add call_once flag to initialize debugger #80786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-lldb Author: Chelsea Cassanova (chelcassanova) ChangesI tried adding a new unit test to the core test
Full diff: https://github.com/llvm/llvm-project/pull/80786.diff 2 Files Affected:
diff --git a/lldb/unittests/TestingSupport/TestUtilities.cpp b/lldb/unittests/TestingSupport/TestUtilities.cpp
index 9e5523e487547..507241404c08d 100644
--- a/lldb/unittests/TestingSupport/TestUtilities.cpp
+++ b/lldb/unittests/TestingSupport/TestUtilities.cpp
@@ -19,6 +19,7 @@ using namespace lldb_private;
extern const char *TestMainArgv0;
+std::once_flag TestUtilities::debugger_initialize_flag;
std::string lldb_private::GetInputFilePath(const llvm::Twine &name) {
llvm::SmallString<128> result = llvm::sys::path::parent_path(TestMainArgv0);
llvm::sys::fs::make_absolute(result);
diff --git a/lldb/unittests/TestingSupport/TestUtilities.h b/lldb/unittests/TestingSupport/TestUtilities.h
index 811c4c1521269..99e569bfa5250 100644
--- a/lldb/unittests/TestingSupport/TestUtilities.h
+++ b/lldb/unittests/TestingSupport/TestUtilities.h
@@ -31,6 +31,11 @@
namespace lldb_private {
std::string GetInputFilePath(const llvm::Twine &name);
+class TestUtilities {
+ public:
+ static std::once_flag debugger_initialize_flag;
+};
+
class TestFile {
public:
static llvm::Expected<TestFile> fromYaml(llvm::StringRef Yaml);
@@ -51,6 +56,6 @@ class TestFile {
std::string Buffer;
};
-}
+} // namespace lldb_private
#endif
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
Did you mean to include changes to DiagnosticEventTest.cpp and ProgressReportTest.cpp to use this new global? |
I did, I'm adding them as separate patches. DiagnosticEventTest.cpp could probably go here since it's a simple change but ProgressEventTest doesn't exist upstream yet since I had to revert it so I think that at least should be it's own PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
2fa9939
to
7b5f866
Compare
Incorporates the changes from llvm#80786 to use a once_flag from `TestUtilities` instead of a local flag in order to prevent hitting an assertion that the debugger was initialized again in another test.
This file was previously approved and merged from this PR: llvm#79533 but caused a test failure on the Linux AArch64 bots due to hitting an assertion that `Debugger::Initialize` was already called. To fix this, this commit uses the changes made here: llvm#80786 to use a shared call_once flag to initialize the debugger.
I tried adding a new unit test to the core test suite (llvm#79533) but it broke the test suite on AArch64 Linux due to hitting an assertion for calling `Debugger::Initialize` more than once. When the unit test suite is invoked as a standalone binary the test suite state is shared, and `Debugger::Initialize` gets called in `DiagnosticEventTest.cpp` before being called in `ProgressReportTest.cpp`. `DiagnosticEventTest.cpp` uses a call_once flag to initialize the debugger but it's local to that test. This commit adds a once_flag to `TestUtilities` so that `Debugger::Initialize` can be called once by the tests that use it.
7b5f866
to
0d56057
Compare
This file was previously approved and merged from this PR: llvm#79533 but caused a test failure on the Linux AArch64 bots due to hitting an assertion that `Debugger::Initialize` was already called. To fix this, this commit uses the changes made here: llvm#80786 to use a shared call_once flag to initialize the debugger.
Incorporates the changes from #80786 to use a once_flag from `TestUtilities` instead of a local flag in order to prevent hitting an assertion that the debugger was initialized again in another test.
This file was previously approved and merged from this PR: llvm#79533 but caused a test failure on the Linux AArch64 bots due to hitting an assertion that `Debugger::Initialize` was already called. To fix this, this commit uses the changes made here: llvm#80786 to use a shared call_once flag to initialize the debugger.
…0791) This file was previously approved and merged from this PR: #79533 but caused a test failure on the Linux AArch64 bots due to hitting an assertion that `Debugger::Initialize` was already called. To fix this, this commit uses the changes made here: #80786 to use a shared call_once flag to initialize the debugger.
I tried adding a new unit test to the core test suite (llvm#79533) but it broke the test suite on AArch64 Linux due to hitting an assertion for calling `Debugger::Initialize` more than once. When the unit test suite is invoked as a standalone binary the test suite state is shared, and `Debugger::Initialize` gets called in `DiagnosticEventTest.cpp` before being called in `ProgressReportTest.cpp`. `DiagnosticEventTest.cpp` uses a call_once flag to initialize the debugger but it's local to that test. This commit adds a once_flag to `TestUtilities` so that `Debugger::Initialize` can be called once by the tests that use it. (cherry picked from commit 3885483)
) Incorporates the changes from llvm#80786 to use a once_flag from `TestUtilities` instead of a local flag in order to prevent hitting an assertion that the debugger was initialized again in another test. (cherry picked from commit 5690027)
…vm#80791) This file was previously approved and merged from this PR: llvm#79533 but caused a test failure on the Linux AArch64 bots due to hitting an assertion that `Debugger::Initialize` was already called. To fix this, this commit uses the changes made here: llvm#80786 to use a shared call_once flag to initialize the debugger. (cherry picked from commit a8ab830)
…ing support (#8141) * [lldb][unittest] Add call_once flag to initialize debugger (llvm#80786) I tried adding a new unit test to the core test suite (llvm#79533) but it broke the test suite on AArch64 Linux due to hitting an assertion for calling `Debugger::Initialize` more than once. When the unit test suite is invoked as a standalone binary the test suite state is shared, and `Debugger::Initialize` gets called in `DiagnosticEventTest.cpp` before being called in `ProgressReportTest.cpp`. `DiagnosticEventTest.cpp` uses a call_once flag to initialize the debugger but it's local to that test. This commit adds a once_flag to `TestUtilities` so that `Debugger::Initialize` can be called once by the tests that use it. (cherry picked from commit 3885483) * [lldb][unittest] Use shared once_flag in DiagnosticEventTest (llvm#80788) Incorporates the changes from llvm#80786 to use a once_flag from `TestUtilities` instead of a local flag in order to prevent hitting an assertion that the debugger was initialized again in another test. (cherry picked from commit 5690027)
…vm#80791) (#8142) This file was previously approved and merged from this PR: llvm#79533 but caused a test failure on the Linux AArch64 bots due to hitting an assertion that `Debugger::Initialize` was already called. To fix this, this commit uses the changes made here: llvm#80786 to use a shared call_once flag to initialize the debugger. (cherry picked from commit a8ab830)
I tried adding a new unit test to the core test
suite (#79533) but it broke the test suite on AArch64 Linux due to hitting an assertion for calling
Debugger::Initialize
more than once. When the unit test suite is invoked as a standalone binary the test suite state is shared, andDebugger::Initialize
gets called inDiagnosticEventTest.cpp
before being called inProgressReportTest.cpp
.DiagnosticEventTest.cpp
uses a call_once flag to initialize the debugger but it's local to that test. This commit adds a once_flag toTestUtilities
so thatDebugger::Initialize
can be called once by the tests that use it.