Skip to content

Commit

Permalink
[LLDB] Attempt to fix DumpDataExtractorTest
Browse files Browse the repository at this point in the history
This test was broken by 710276a 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.
  • Loading branch information
Walter Erquinigo committed Sep 18, 2023
1 parent 7bac0bc commit 014c41d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lldb/unittests/Core/DumpDataExtractorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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};
Expand Down

0 comments on commit 014c41d

Please sign in to comment.