1 //===- llvm/unittest/DWARFLinkerParallel/DWARFLinkerTest.cpp --------------===// 2 // 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 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "llvm/DWARFLinker/Utils.h" 10 #include "gtest/gtest.h" 11 12 using namespace llvm; 13 using namespace dwarf_linker; 14 15 #define DEVELOPER_DIR "/Applications/Xcode.app/Contents/Developer" 16 17 namespace { 18 TEST(DWARFLinker,PathTest)19TEST(DWARFLinker, PathTest) { 20 EXPECT_EQ(guessDeveloperDir("/Foo"), ""); 21 EXPECT_EQ(guessDeveloperDir("Foo.sdk"), ""); 22 EXPECT_EQ(guessDeveloperDir( 23 DEVELOPER_DIR 24 "/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk"), 25 DEVELOPER_DIR); 26 EXPECT_EQ(guessDeveloperDir(DEVELOPER_DIR "/SDKs/MacOSX.sdk"), DEVELOPER_DIR); 27 EXPECT_TRUE( 28 isInToolchainDir("/Library/Developer/Toolchains/" 29 "swift-DEVELOPMENT-SNAPSHOT-2024-05-15-a.xctoolchain/" 30 "usr/lib/swift/macosx/_StringProcessing.swiftmodule/" 31 "arm64-apple-macos.private.swiftinterface")); 32 EXPECT_FALSE(isInToolchainDir("/Foo/not-an.xctoolchain/Bar/Baz")); 33 } 34 35 } // anonymous namespace 36