[Lldb-commits] [lldb] [lldb][progress][NFC] Add unit test for progress reports (PR #79533)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 26 08:13:59 PST 2024


================
@@ -0,0 +1,105 @@
+#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
+#include "Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/Progress.h"
+#include "lldb/Host/FileSystem.h"
+#include "lldb/Host/HostInfo.h"
+#include "lldb/Utility/Listener.h"
+#include "gtest/gtest.h"
+#include <thread>
+
+using namespace lldb;
+using namespace lldb_private;
+
+namespace {
+class ProgressReportTest : public ::testing::Test {
+public:
+  void SetUp() override {
+    FileSystem::Initialize();
+    HostInfo::Initialize();
+    PlatformMacOSX::Initialize();
+    Debugger::Initialize(nullptr);
+  }
+  void TearDown() override {
+    Debugger::Terminate();
+    PlatformMacOSX::Terminate();
+    HostInfo::Terminate();
+    FileSystem::Terminate();
+  }
----------------
JDevlieghere wrote:

There's a utility that simplifies this called `SubsystemRAII`. Here's how you use that:

```
#include "TestingSupport/SubsystemRAII.h"

class ProgressReportTest : public ::testing::Test {
SubsystemRAII<FileSystem, HostInfo, PlatformMacOSX, Debugger> subsystems;
}
```

https://github.com/llvm/llvm-project/pull/79533


More information about the lldb-commits mailing list