[Lldb-commits] [lldb] 5690027 - [lldb][unittest] Use shared once_flag in DiagnosticEventTest (#80788)

via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 6 08:36:04 PST 2024


Author: Chelsea Cassanova
Date: 2024-02-06T08:36:00-08:00
New Revision: 56900278b578b4f7beedb8ac1e52c541d347f401

URL: https://github.com/llvm/llvm-project/commit/56900278b578b4f7beedb8ac1e52c541d347f401
DIFF: https://github.com/llvm/llvm-project/commit/56900278b578b4f7beedb8ac1e52c541d347f401.diff

LOG: [lldb][unittest] Use shared once_flag in DiagnosticEventTest (#80788)

Incorporates the changes from
https://github.com/llvm/llvm-project/pull/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.

Added: 
    

Modified: 
    lldb/unittests/Core/DiagnosticEventTest.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/unittests/Core/DiagnosticEventTest.cpp b/lldb/unittests/Core/DiagnosticEventTest.cpp
index bca8f3789955ab..d06f164e87e70c 100644
--- a/lldb/unittests/Core/DiagnosticEventTest.cpp
+++ b/lldb/unittests/Core/DiagnosticEventTest.cpp
@@ -11,6 +11,7 @@
 #include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
 #include "Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h"
 #include "TestingSupport/SubsystemRAII.h"
+#include "TestingSupport/TestUtilities.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/DebuggerEvents.h"
 #include "lldb/Host/FileSystem.h"
@@ -26,8 +27,6 @@ using namespace lldb_private::repro;
 static const constexpr std::chrono::seconds TIMEOUT(0);
 static const constexpr size_t DEBUGGERS = 3;
 
-static std::once_flag debugger_initialize_flag;
-
 namespace {
 class DiagnosticEventTest : public ::testing::Test {
 public:
@@ -35,7 +34,7 @@ class DiagnosticEventTest : public ::testing::Test {
     FileSystem::Initialize();
     HostInfo::Initialize();
     PlatformMacOSX::Initialize();
-    std::call_once(debugger_initialize_flag,
+    std::call_once(TestUtilities::g_debugger_initialize_flag,
                    []() { Debugger::Initialize(nullptr); });
     ArchSpec arch("x86_64-apple-macosx-");
     Platform::SetHostPlatform(


        


More information about the lldb-commits mailing list