[Lldb-commits] [lldb] 275eab9 - [LLDB]Fix test crash (#129921)

via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 5 14:36:10 PST 2025


Author: Vy Nguyen
Date: 2025-03-05T17:36:06-05:00
New Revision: 275eab91edba816b5c98828c53b7f21afd97dbd9

URL: https://github.com/llvm/llvm-project/commit/275eab91edba816b5c98828c53b7f21afd97dbd9
DIFF: https://github.com/llvm/llvm-project/commit/275eab91edba816b5c98828c53b7f21afd97dbd9.diff

LOG: [LLDB]Fix test crash (#129921)

Use the `SubsystemRAII` to unregister the fake manager at end of tests
(Should fix https://github.com/llvm/llvm-project/issues/129910)

Added: 
    

Modified: 
    lldb/unittests/Core/TelemetryTest.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/unittests/Core/TelemetryTest.cpp b/lldb/unittests/Core/TelemetryTest.cpp
index 0e9f329110872..7fc2b3d0264e3 100644
--- a/lldb/unittests/Core/TelemetryTest.cpp
+++ b/lldb/unittests/Core/TelemetryTest.cpp
@@ -5,9 +5,10 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
+#include "lldb/Core/Telemetry.h"
+#include "TestingSupport/SubsystemRAII.h"
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/Core/PluginManager.h"
-#include "lldb/Core/Telemetry.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Telemetry/Telemetry.h"
@@ -77,8 +78,13 @@ class FakePlugin : public telemetry::TelemetryManager {
 
 using namespace lldb_private::telemetry;
 
+class TelemetryTest : public testing::Test {
+public:
+  lldb_private::SubsystemRAII<lldb_private::FakePlugin> subsystems;
+};
+
 #if LLVM_ENABLE_TELEMETRY
-#define TELEMETRY_TEST(suite, test) TEST(suite, test)
+#define TELEMETRY_TEST(suite, test) TEST_F(suite, test)
 #else
 #define TELEMETRY_TEST(suite, test) TEST(DISABLED_##suite, test)
 #endif


        


More information about the lldb-commits mailing list