diff options
| author | Martin Storsjo <martin@martin.st> | 2018-04-25 21:24:04 +0000 |
|---|---|---|
| committer | Martin Storsjo <martin@martin.st> | 2018-04-25 21:24:04 +0000 |
| commit | aadc1c8ba0dd9788b466765e685106d3d63f0c95 (patch) | |
| tree | 261a54ddfb9d99535573e8c5d8838826bea82660 | |
| parent | 1fab23da1cef52d1752cb5877048c5d771e9b0f1 (diff) | |
| download | bcm5719-llvm-aadc1c8ba0dd9788b466765e685106d3d63f0c95.tar.gz bcm5719-llvm-aadc1c8ba0dd9788b466765e685106d3d63f0c95.zip | |
[test] Add a testcase for MinGW sysroot detections from SVN r330244. NFC.
Differential Revision: https://reviews.llvm.org/D45985
llvm-svn: 330872
| -rw-r--r-- | clang/test/Driver/mingw-sysroot.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/clang/test/Driver/mingw-sysroot.cpp b/clang/test/Driver/mingw-sysroot.cpp new file mode 100644 index 00000000000..d477f314195 --- /dev/null +++ b/clang/test/Driver/mingw-sysroot.cpp @@ -0,0 +1,42 @@ +// REQUIRES: shell +// UNSUPPORTED: system-windows + +// RUN: mkdir -p %T/testroot-gcc/bin +// RUN: [ ! -s %T/testroot-gcc/bin/x86_64-w64-mingw32-gcc ] || rm %T/testroot-gcc/bin/x86_64-w64-mingw32-gcc +// RUN: [ ! -s %T/testroot-gcc/bin/x86_64-w64-mingw32-clang ] || rm %T/testroot-gcc/bin/x86_64-w64-mingw32-clang +// RUN: [ ! -s %T/testroot-gcc/x86_64-w64-mingw32 ] || rm %T/testroot-gcc/x86_64-w64-mingw32 +// RUN: [ ! -s %T/testroot-gcc/lib ] || rm %T/testroot-gcc/lib +// RUN: ln -s %clang %T/testroot-gcc/bin/x86_64-w64-mingw32-gcc +// RUN: ln -s %clang %T/testroot-gcc/bin/x86_64-w64-mingw32-clang +// RUN: ln -s %S/Inputs/mingw_ubuntu_posix_tree/usr/x86_64-w64-mingw32 %T/testroot-gcc/x86_64-w64-mingw32 +// RUN: ln -s %S/Inputs/mingw_ubuntu_posix_tree/usr/lib %T/testroot-gcc/lib + +// RUN: mkdir -p %T/testroot-clang/bin +// RUN: [ ! -s %T/testroot-clang/bin/x86_64-w64-mingw32-clang ] || rm %T/testroot-clang/bin/x86_64-w64-mingw32-clang +// RUN: [ ! -s %T/testroot-clang/x86_64-w64-mingw32 ] || rm %T/testroot-clang/x86_64-w64-mingw32 +// RUN: ln -s %clang %T/testroot-clang/bin/x86_64-w64-mingw32-clang +// RUN: ln -s %S/Inputs/mingw_ubuntu_posix_tree/usr/x86_64-w64-mingw32 %T/testroot-clang/x86_64-w64-mingw32 + + +// If we find a gcc in the path with the right triplet prefix, pick that as +// sysroot: + +// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" %clang -target x86_64-w64-mingw32 -rtlib=platform -stdlib=libstdc++ -c -### %s 2>&1 | FileCheck -check-prefix=CHECK_TESTROOT_GCC %s +// CHECK_TESTROOT_GCC: "{{.*}}/testroot-gcc{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}5.3-posix{{/|\\\\}}include{{/|\\\\}}c++" +// CHECK_TESTROOT_GCC: "{{.*}}/testroot-gcc{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}5.3-posix{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}x86_64-w64-mingw32" +// CHECK_TESTROOT_GCC: "{{.*}}/testroot-gcc{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}5.3-posix{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}backward" +// CHECK_TESTROOT_GCC: "{{.*}}/testroot-gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}include" + + +// If there's a matching sysroot next to the clang binary itself, prefer that +// over a gcc in the path: + +// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" %T/testroot-clang/bin/x86_64-w64-mingw32-clang -target x86_64-w64-mingw32 -rtlib=compiler-rt -stdlib=libstdc++ -c -### %s 2>&1 | FileCheck -check-prefix=CHECK_TESTROOT_CLANG %s +// CHECK_TESTROOT_CLANG: "{{.*}}/testroot-clang{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}include" + + +// If we pick a root based on a sysroot next to the clang binary, which also +// happens to be in the same directory as gcc, make sure we still can pick up +// the libgcc directory: + +// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" %T/testroot-gcc/bin/x86_64-w64-mingw32-clang -target x86_64-w64-mingw32 -rtlib=platform -stdlib=libstdc++ -c -### %s 2>&1 | FileCheck -check-prefix=CHECK_TESTROOT_GCC %s |

