[Lldb-commits] [lldb] 014c41d - [LLDB] Attempt to fix DumpDataExtractorTest

Walter Erquinigo via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 18 14:30:54 PDT 2023


Author: Walter Erquinigo
Date: 2023-09-18T21:30:42Z
New Revision: 014c41d688f961cdb81cf92e6ba97100a49766a6

URL: https://github.com/llvm/llvm-project/commit/014c41d688f961cdb81cf92e6ba97100a49766a6
DIFF: https://github.com/llvm/llvm-project/commit/014c41d688f961cdb81cf92e6ba97100a49766a6.diff

LOG: [LLDB] Attempt to fix DumpDataExtractorTest

This test was broken by 710276a2505514634a7cc805461b1219dcef9337 because
DumpDataExtractor now accesses the Target properties, which someone ends
up relying on the file system.

This is an instance of this error https://lab.llvm.org/buildbot/#/builders/96/builds/45607/steps/6/logs/stdio

I cannot reproduce this locally, but it seems that the error happens
because we are not initializing the FileSystem and the Host as part of
the test setup.

Added: 
    

Modified: 
    lldb/unittests/Core/DumpDataExtractorTest.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/unittests/Core/DumpDataExtractorTest.cpp b/lldb/unittests/Core/DumpDataExtractorTest.cpp
index bbe5e9e5ed9e299..3332cf6f07fd180 100644
--- a/lldb/unittests/Core/DumpDataExtractorTest.cpp
+++ b/lldb/unittests/Core/DumpDataExtractorTest.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "lldb/Core/DumpDataExtractor.h"
+#include "lldb/Host/FileSystem.h"
+#include "lldb/Host/HostInfo.h"
 #include "lldb/Utility/DataBufferHeap.h"
 #include "lldb/Utility/DataExtractor.h"
 #include "lldb/Utility/Endian.h"
@@ -18,6 +20,20 @@
 using namespace lldb;
 using namespace lldb_private;
 
+// This is needed for the tests because they rely on the Target global
+// properties.
+class DumpDataExtractorTest : public ::testing::Test {
+public:
+  void SetUp() override {
+    FileSystem::Initialize();
+    HostInfo::Initialize();
+  }
+  void TearDown() override {
+    HostInfo::Terminate();
+    FileSystem::Terminate();
+  }
+};
+
 static void TestDumpWithAddress(uint64_t base_addr, size_t item_count,
                                 llvm::StringRef expected) {
   std::vector<uint8_t> data{0x11, 0x22};


        


More information about the lldb-commits mailing list