[Lldb-commits] [lldb] a0919ac - Invert an #ifdef in XcodeSDKModuleTests.cpp and actually make the test work.
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Fri Apr 24 18:39:50 PDT 2020
Author: Adrian Prantl
Date: 2020-04-24T18:39:40-07:00
New Revision: a0919ac080951dec5047f18319a2974b6c6258e5
URL: https://github.com/llvm/llvm-project/commit/a0919ac080951dec5047f18319a2974b6c6258e5
DIFF: https://github.com/llvm/llvm-project/commit/a0919ac080951dec5047f18319a2974b6c6258e5.diff
LOG: Invert an #ifdef in XcodeSDKModuleTests.cpp and actually make the test work.
Added:
Modified:
lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp
Removed:
################################################################################
diff --git a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
index ece8266d7ffd..64a7b78c478a 100644
--- a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
+++ b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
@@ -12,6 +12,7 @@ add_lldb_unittest(SymbolFileDWARFTests
lldbPluginSymbolFilePDB
lldbPluginTypeSystemClang
lldbUtilityHelpers
+ lldbPluginPlatformMacOSX
LINK_COMPONENTS
Support
DebugInfoPDB
diff --git a/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp b/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
index 21c2d165c37b..44251e944df6 100644
--- a/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
+++ b/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
@@ -116,46 +116,3 @@ TEST_F(DWARFASTParserClangTests,
testing::UnorderedElementsAre(decl_ctxs[0], decl_ctxs[3]));
}
-
-#ifndef __APPLE__
-TEST_F(DWARFASTParserClangTests, TestXcodeSDK) {
- PlatformDarwin::Initialize();
- const char *yamldata = R"(
-debug_str:
- - MacOSX10.9.sdk
-debug_abbrev:
- - Code: 0x00000001
- Tag: DW_TAG_compile_unit
- Children: DW_CHILDREN_no
- Attributes:
- - Attribute: DW_AT_language
- Form: DW_FORM_data2
- - Attribute: DW_AT_APPLE_sdk
- Form: DW_FORM_strp
-debug_info:
- - Length:
- TotalLength: 8
- Version: 2
- AbbrOffset: 0
- AddrSize: 8
- Entries:
- - AbbrCode: 0x00000001
- Values:
- - Value: 0x000000000000000C
- - Value: 0x0000000000000000
- - AbbrCode: 0x00000000
- Values: []
-...
-)";
-
- YAMLModuleTester t(yamldata, "x86_64-apple-macosx");
- auto dwarf_unit_sp = t.GetDwarfUnit();
- auto *dwarf_cu = llvm::cast<DWARFCompileUnit>(dwarf_unit_sp.get());
- ASSERT_TRUE((bool)dwarf_cu);
- ASSERT_TRUE((bool)dwarf_cu->GetSymbolFileDWARF().GetCompUnitForDWARFCompUnit(
- *dwarf_cu));
- auto module = t.GetModule();
- XcodeSDK sdk = module->GetXcodeSDK();
- ASSERT_EQ(sdk.GetType(), XcodeSDK::Type::MacOSX);
-}
-#endif
diff --git a/lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp b/lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp
index 43c67c65bfe7..efc9fe1763a5 100644
--- a/lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp
+++ b/lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp
@@ -6,21 +6,29 @@
//
//===----------------------------------------------------------------------===//
-#include "Plugins/SymbolFile/DWARF/DWARFASTParserClang.h"
+#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
#include "Plugins/SymbolFile/DWARF/DWARFCompileUnit.h"
#include "Plugins/SymbolFile/DWARF/DWARFDIE.h"
+#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
#include "TestingSupport/Symbol/YAMLModuleTester.h"
+#include "lldb/Core/PluginManager.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
using namespace lldb;
using namespace lldb_private;
-#ifndef __APPLE__
+#ifdef __APPLE__
namespace {
class XcodeSDKModuleTests : public testing::Test {
- void SetUp() override { PlatformDarwin::Initialize(); }
- void TearDown() override { PlatformDarwin::Terminate(); }
+ void SetUp() override {
+ HostInfoBase::Initialize();
+ PlatformMacOSX::Initialize();
+ }
+ void TearDown() override {
+ PlatformMacOSX::Terminate();
+ HostInfoBase::Terminate();
+ }
};
} // namespace
@@ -54,13 +62,14 @@ TEST_F(XcodeSDKModuleTests, TestModuleGetXcodeSDK) {
...
)";
- YAMLModuleTester t(yamldata, "x86_64-apple-macosx");
+ auto triple = "x86_64-apple-macosx";
+ YAMLModuleTester t(yamldata, triple);
+ auto module = t.GetModule();
auto dwarf_unit_sp = t.GetDwarfUnit();
auto *dwarf_cu = llvm::cast<DWARFCompileUnit>(dwarf_unit_sp.get());
ASSERT_TRUE((bool)dwarf_cu);
ASSERT_TRUE((bool)dwarf_cu->GetSymbolFileDWARF().GetCompUnitForDWARFCompUnit(
*dwarf_cu));
- auto module = t.GetModule();
XcodeSDK sdk = module->GetXcodeSDK();
ASSERT_EQ(sdk.GetType(), XcodeSDK::Type::MacOSX);
}
More information about the lldb-commits
mailing list