1 // REQUIRES: x86-registered-target
2 // REQUIRES: nvptx-registered-target
3 // This tests uses the PATH environment variable.
4 // REQUIRES: !system-windows
6 // RUN: env PATH=%S/Inputs/CUDA/usr/local/cuda/bin \
7 // RUN: %clang -v --target=i386-unknown-linux --sysroot=%S/no-cuda-there \
8 // RUN: 2>&1 | FileCheck %s
9 // RUN: env PATH=%S/Inputs/CUDA/usr/local/cuda/bin \
10 // RUN: %clang -v --target=i386-apple-macosx --sysroot=%S/no-cuda-there \
11 // RUN: 2>&1 | FileCheck %s
12 // RUN: env PATH=%S/Inputs/CUDA/usr/local/cuda/bin \
13 // RUN: %clang -v --target=x86_64-unknown-linux --sysroot=%S/no-cuda-there \
14 // RUN: 2>&1 | FileCheck %s
15 // RUN: env PATH=%S/Inputs/CUDA/usr/local/cuda/bin \
16 // RUN: %clang -v --target=x86_64-apple-macosx --sysroot=%S/no-cuda-there \
17 // RUN: 2>&1 | FileCheck %s
20 // Check that we follow ptxas binaries that are symlinks.
21 // RUN: env PATH=%S/Inputs/CUDA-symlinks/usr/bin \
22 // RUN: %clang -v --target=i386-unknown-linux --sysroot=%S/no-cuda-there \
23 // RUN: 2>&1 | FileCheck %s --check-prefix SYMLINKS
24 // RUN: env PATH=%S/Inputs/CUDA-symlinks/usr/bin \
25 // RUN: %clang -v --target=i386-apple-macosx --sysroot=%S/no-cuda-there \
26 // RUN: 2>&1 | FileCheck %s --check-prefix SYMLINKS
27 // RUN: env PATH=%S/Inputs/CUDA-symlinks/usr/bin \
28 // RUN: %clang -v --target=x86_64-unknown-linux --sysroot=%S/no-cuda-there \
29 // RUN: 2>&1 | FileCheck %s --check-prefix SYMLINKS
30 // RUN: env PATH=%S/Inputs/CUDA-symlinks/usr/bin \
31 // RUN: %clang -v --target=x86_64-apple-macosx --sysroot=%S/no-cuda-there \
32 // RUN: 2>&1 | FileCheck %s --check-prefix SYMLINKS
35 // We only take a CUDA installation from PATH if it contains libdevice.
36 // RUN: env PATH=%S/Inputs/CUDA-nolibdevice/usr/local/cuda/bin \
37 // RUN: %clang -v --target=i386-unknown-linux --sysroot=%S/no-cuda-there \
38 // RUN: 2>&1 | FileCheck %s --check-prefix NOCUDA
39 // RUN: env PATH=%S/Inputs/CUDA-nolibdevice/usr/local/cuda/bin \
40 // RUN: %clang -v --target=i386-apple-macosx --sysroot=%S/no-cuda-there \
41 // RUN: 2>&1 | FileCheck %s --check-prefix NOCUDA
42 // RUN: env PATH=%S/Inputs/CUDA-nolibdevice/usr/local/cuda/bin \
43 // RUN: %clang -v --target=x86_64-unknown-linux --sysroot=%S/no-cuda-there \
44 // RUN: 2>&1 | FileCheck %s --check-prefix NOCUDA
45 // RUN: env PATH=%S/Inputs/CUDA-nolibdevice/usr/local/cuda/bin \
46 // RUN: %clang -v --target=x86_64-apple-macosx --sysroot=%S/no-cuda-there \
47 // RUN: 2>&1 | FileCheck %s --check-prefix NOCUDA
49 // We even require libdevice if -nocudalib is passed to avoid false positives
50 // if the distribution merges CUDA into /usr and ptxas ends up /usr/bin.
51 // RUN: env PATH=%S/Inputs/CUDA-nolibdevice/usr/local/cuda/bin \
52 // RUN: %clang -v --target=i386-unknown-linux --sysroot=%S/no-cuda-there -nocudalib \
53 // RUN: 2>&1 | FileCheck %s --check-prefix NOCUDA
54 // RUN: env PATH=%S/Inputs/CUDA-nolibdevice/usr/local/cuda/bin \
55 // RUN: %clang -v --target=i386-apple-macosx --sysroot=%S/no-cuda-there -nocudalib \
56 // RUN: 2>&1 | FileCheck %s --check-prefix NOCUDA
57 // RUN: env PATH=%S/Inputs/CUDA-nolibdevice/usr/local/cuda/bin \
58 // RUN: %clang -v --target=x86_64-unknown-linux --sysroot=%S/no-cuda-there -nocudalib \
59 // RUN: 2>&1 | FileCheck %s --check-prefix NOCUDA
60 // RUN: env PATH=%S/Inputs/CUDA-nolibdevice/usr/local/cuda/bin \
61 // RUN: %clang -v --target=x86_64-apple-macosx --sysroot=%S/no-cuda-there -nocudalib \
62 // RUN: 2>&1 | FileCheck %s --check-prefix NOCUDA
65 // Check that the CUDA installation in PATH is not taken when passing
66 // the option --cuda-path-ignore-env.
67 // RUN: env PATH=%S/Inputs/CUDA/usr/local/cuda/bin \
68 // RUN: %clang -v --target=i386-unknown-linux --sysroot=%S/no-cuda-there --cuda-path-ignore-env \
69 // RUN: 2>&1 | FileCheck %s --check-prefix NOCUDA
70 // RUN: env PATH=%S/Inputs/CUDA/usr/local/cuda/bin \
71 // RUN: %clang -v --target=i386-apple-macosx --sysroot=%S/no-cuda-there --cuda-path-ignore-env \
72 // RUN: 2>&1 | FileCheck %s --check-prefix NOCUDA
73 // RUN: env PATH=%S/Inputs/CUDA/usr/local/cuda/bin \
74 // RUN: %clang -v --target=x86_64-unknown-linux --sysroot=%S/no-cuda-there --cuda-path-ignore-env \
75 // RUN: 2>&1 | FileCheck %s --check-prefix NOCUDA
76 // RUN: env PATH=%S/Inputs/CUDA/usr/local/cuda/bin \
77 // RUN: %clang -v --target=x86_64-apple-macosx --sysroot=%S/no-cuda-there --cuda-path-ignore-env \
78 // RUN: 2>&1 | FileCheck %s --check-prefix NOCUDA
80 // CHECK: Found CUDA installation: {{.*}}/Inputs/CUDA/usr/local/cuda
81 // SYMLINKS: Found CUDA installation: {{.*}}/Inputs/CUDA-symlinks/opt/cuda
82 // NOCUDA-NOT: Found CUDA installation: