brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · 055b653 Raw
65 lines · cpp
1// General tests that the header search paths for libc++ detected by the driver2// and passed to CC1 are correct on Darwin platforms. This test copies the clang3// binary, which won't work if it uses any dynamic libraries (BUILD_SHARED_LIBS,4// LLVM_LINK_LLVM_DYLIB, or CLANG_LINK_CLANG_DYLIB).5 6// UNSUPPORTED: system-windows7// REQUIRES: static-libs8 9// ----------------------------------------------------------------------------10// On Darwin, libc++ can be installed in one of the following places:11// 1. Alongside the compiler in <install>/include/c++/v112// 2. Alongside the compiler in <clang-executable-folder>/../include/c++/v113// 3. In a SDK (or a custom sysroot) in <sysroot>/usr/include/c++/v114 15// The build folders do not have an `include/c++/v1`; create a new16// local folder hierarchy that meets this requirement.17// Note: this might not work with weird RPATH configurations.18// RUN: rm -rf %t/install19// RUN: mkdir -p %t/install/bin20// RUN: cp %clang %t/install/bin/clang21// RUN: mkdir -p %t/install/include/c++/v122 23// Headers in (1) and in (2) -> (1) is preferred over (2)24// RUN: rm -rf %t/symlinked125// RUN: mkdir -p %t/symlinked1/bin26// RUN: ln -sf %t/install/bin/clang %t/symlinked1/bin/clang27// RUN: mkdir -p %t/symlinked1/include/c++/v128 29// RUN: %t/symlinked1/bin/clang -### %s -no-canonical-prefixes -fsyntax-only 2>&1 \30// RUN:     --target=x86_64-apple-darwin \31// RUN:     -stdlib=libc++ \32// RUN:     -isysroot %S/Inputs/basic_darwin_sdk_usr_cxx_v1 \33// RUN:   | FileCheck -DSYMLINKED=%t/symlinked1 \34// RUN:               -DTOOLCHAIN=%t/install \35// RUN:               -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_cxx_v1 \36// RUN:               --check-prefix=CHECK-SYMLINKED-INCLUDE-CXX-V1 %s37// CHECK-SYMLINKED-INCLUDE-CXX-V1: "-internal-isystem" "[[SYMLINKED]]/bin/../include/c++/v1"38// CHECK-SYMLINKED-INCLUDE-CXX-V1-NOT: "-internal-isystem" "[[TOOLCHAIN]]/bin/../include/c++/v1"39// CHECK-SYMLINKED-INCLUDE-CXX-V1-NOT: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/v1"40 41// Headers in (2) and in (3) -> (2) is preferred over (3)42// RUN: rm -rf %t/symlinked243// RUN: mkdir -p %t/symlinked2/bin44// RUN: ln -sf %t/install/bin/clang %t/symlinked2/bin/clang45 46// RUN: %t/symlinked2/bin/clang -### %s -fsyntax-only 2>&1 \47// RUN:     --target=x86_64-apple-darwin \48// RUN:     -stdlib=libc++ \49// RUN:     -isysroot %S/Inputs/basic_darwin_sdk_usr_cxx_v1 \50// RUN:   | FileCheck -DTOOLCHAIN=%t/install \51// RUN:               -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_cxx_v1 \52// RUN:               --check-prefix=CHECK-TOOLCHAIN-INCLUDE-CXX-V1 %s53// CHECK-TOOLCHAIN-INCLUDE-CXX-V1: "-internal-isystem" "[[TOOLCHAIN]]/bin/../include/c++/v1"54// CHECK-TOOLCHAIN-INCLUDE-CXX-V1-NOT: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/v1"55 56// Headers in (2) and nowhere else -> (2) is used57// RUN: %t/symlinked2/bin/clang -### %s -fsyntax-only 2>&1 \58// RUN:     --target=x86_64-apple-darwin \59// RUN:     -stdlib=libc++ \60// RUN:     -isysroot %S/Inputs/basic_darwin_sdk_usr_cxx_v1 \61// RUN:   | FileCheck -DTOOLCHAIN=%t/install \62// RUN:               -DSYSROOT=%S/Inputs/basic_darwin_sdk_no_libcxx \63// RUN:               --check-prefix=CHECK-TOOLCHAIN-NO-SYSROOT %s64// CHECK-TOOLCHAIN-NO-SYSROOT: "-internal-isystem" "[[TOOLCHAIN]]/bin/../include/c++/v1"65