Adrian Prantl f8cc183ea2
Fix the dsymutil heuristic for excluding system interfaces. (#93745)
The function was meant to find the Developer/ dir, but it found a
Developer directory nested deep inside the top-level Developer dir.

The new implementation rejects everything in Xcode.app/Developer in
broad strokes.

rdar://128571037
2024-05-30 12:23:20 -07:00

30 lines
962 B
C++

//===- llvm/unittest/DWARFLinkerParallel/DWARFLinkerTest.cpp --------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "llvm/DWARFLinker/Utils.h"
#include "gtest/gtest.h"
using namespace llvm;
using namespace dwarf_linker;
#define DEVELOPER_DIR "/Applications/Xcode.app/Contents/Developer"
namespace {
TEST(DWARFLinker, PathTest) {
EXPECT_EQ(guessDeveloperDir("/Foo"), "");
EXPECT_EQ(guessDeveloperDir("Foo.sdk"), "");
EXPECT_EQ(guessDeveloperDir(
DEVELOPER_DIR
"/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk"),
DEVELOPER_DIR);
EXPECT_EQ(guessDeveloperDir(DEVELOPER_DIR "/SDKs/MacOSX.sdk"), DEVELOPER_DIR);
}
} // anonymous namespace