Martin Storsjo | aadc1c8 | 2018-04-25 21:24:04 +0000 | [diff] [blame] | 1 | // REQUIRES: shell |
| 2 | // UNSUPPORTED: system-windows |
| 3 | |
Nico Weber | e01ec11 | 2020-04-05 13:07:50 -0400 | [diff] [blame] | 4 | // RUN: rm -rf %T/testroot-gcc |
Martin Storsjo | aadc1c8 | 2018-04-25 21:24:04 +0000 | [diff] [blame] | 5 | // RUN: mkdir -p %T/testroot-gcc/bin |
Martin Storsjo | aadc1c8 | 2018-04-25 21:24:04 +0000 | [diff] [blame] | 6 | // RUN: ln -s %clang %T/testroot-gcc/bin/x86_64-w64-mingw32-gcc |
| 7 | // RUN: ln -s %clang %T/testroot-gcc/bin/x86_64-w64-mingw32-clang |
| 8 | // RUN: ln -s %S/Inputs/mingw_ubuntu_posix_tree/usr/x86_64-w64-mingw32 %T/testroot-gcc/x86_64-w64-mingw32 |
| 9 | // RUN: ln -s %S/Inputs/mingw_ubuntu_posix_tree/usr/lib %T/testroot-gcc/lib |
| 10 | |
Nico Weber | e01ec11 | 2020-04-05 13:07:50 -0400 | [diff] [blame] | 11 | // RUN: rm -rf %T/testroot-clang |
Martin Storsjo | aadc1c8 | 2018-04-25 21:24:04 +0000 | [diff] [blame] | 12 | // RUN: mkdir -p %T/testroot-clang/bin |
Martin Storsjo | aadc1c8 | 2018-04-25 21:24:04 +0000 | [diff] [blame] | 13 | // RUN: ln -s %clang %T/testroot-clang/bin/x86_64-w64-mingw32-clang |
| 14 | // RUN: ln -s %S/Inputs/mingw_ubuntu_posix_tree/usr/x86_64-w64-mingw32 %T/testroot-clang/x86_64-w64-mingw32 |
| 15 | |
| 16 | |
| 17 | // If we find a gcc in the path with the right triplet prefix, pick that as |
| 18 | // sysroot: |
| 19 | |
| 20 | // 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 |
| 21 | // CHECK_TESTROOT_GCC: "{{.*}}/testroot-gcc{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}5.3-posix{{/|\\\\}}include{{/|\\\\}}c++" |
| 22 | // CHECK_TESTROOT_GCC: "{{.*}}/testroot-gcc{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}5.3-posix{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}x86_64-w64-mingw32" |
| 23 | // CHECK_TESTROOT_GCC: "{{.*}}/testroot-gcc{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}5.3-posix{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}backward" |
| 24 | // CHECK_TESTROOT_GCC: "{{.*}}/testroot-gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}include" |
| 25 | |
| 26 | |
| 27 | // If there's a matching sysroot next to the clang binary itself, prefer that |
| 28 | // over a gcc in the path: |
| 29 | |
| 30 | // 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 |
| 31 | // CHECK_TESTROOT_CLANG: "{{.*}}/testroot-clang{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}include" |
| 32 | |
| 33 | |
| 34 | // If we pick a root based on a sysroot next to the clang binary, which also |
| 35 | // happens to be in the same directory as gcc, make sure we still can pick up |
| 36 | // the libgcc directory: |
| 37 | |
| 38 | // 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 |