1 //===-- PlatformMacOSXTest.cpp ------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "gtest/gtest.h"
11 #include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
12 #include "TestingSupport/SubsystemRAII.h"
13 #include "lldb/Host/FileSystem.h"
14 #include "lldb/Host/HostInfo.h"
15 #include "lldb/Target/Platform.h"
18 using namespace lldb_private
;
20 class PlatformMacOSXTest
: public ::testing::Test
{
21 SubsystemRAII
<FileSystem
, HostInfo
, PlatformMacOSX
> subsystems
;
25 static bool containsArch(const std::vector
<ArchSpec
> &archs
,
26 const ArchSpec
&arch
) {
27 return std::find_if(archs
.begin(), archs
.end(), [&](const ArchSpec
&other
) {
28 return arch
.IsExactMatch(other
);
32 TEST_F(PlatformMacOSXTest
, TestGetSupportedArchitectures
) {
33 PlatformMacOSX platform
;
35 const ArchSpec
x86_macosx_arch("x86_64-apple-macosx");
37 EXPECT_TRUE(containsArch(platform
.GetSupportedArchitectures(x86_macosx_arch
),
40 containsArch(platform
.GetSupportedArchitectures({}), x86_macosx_arch
));
42 #if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
43 const ArchSpec
arm64_macosx_arch("arm64-apple-macosx");
44 const ArchSpec
arm64_ios_arch("arm64-apple-ios");
46 EXPECT_TRUE(containsArch(
47 platform
.GetSupportedArchitectures(arm64_macosx_arch
), arm64_ios_arch
));
49 containsArch(platform
.GetSupportedArchitectures({}), arm64_ios_arch
));
50 EXPECT_FALSE(containsArch(platform
.GetSupportedArchitectures(arm64_ios_arch
),