Invert an #ifdef in XcodeSDKModuleTests.cpp and actually make the test work.

This commit is contained in:
Adrian Prantl 2020-04-24 18:37:45 -07:00
parent f83833868b
commit a0919ac080
3 changed files with 16 additions and 49 deletions

View file

@ -12,6 +12,7 @@ add_lldb_unittest(SymbolFileDWARFTests
lldbPluginSymbolFilePDB
lldbPluginTypeSystemClang
lldbUtilityHelpers
lldbPluginPlatformMacOSX
LINK_COMPONENTS
Support
DebugInfoPDB

View file

@ -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

View file

@ -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 @@ debug_info:
...
)";
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);
}