Skip to content

Commit 153fab3

Browse files
authored
Use --sysroot for device libraries in sycl-device-lib-nvptx.cpp (#15282)
Adds the `--sysroot` option to `clang` invocations in `clang/test/Driver/sycl-device-lib-nvptx.cpp` , pointing the compiler to `clang/test/Driver/Inputs/SYCL`, so that it uses the mock files for libraries, making the test pass even when DPC++ is not configured with `--cuda` (similarly to how it's done for other SYCL driver lit tests).
1 parent c407665 commit 153fab3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clang/test/Driver/Inputs/SYCL/lib/devicelib--cuda.bc

Whitespace-only changes.

clang/test/Driver/sycl-device-lib-nvptx.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
// Check if internal libraries are still linked against when linkage of all
88
// device libs is manually excluded.
9-
// RUN: %clangxx -ccc-print-phases -std=c++11 -fsycl -fno-sycl-device-lib=all \
9+
// RUN: %clangxx -ccc-print-phases -std=c++11 -fsycl -fno-sycl-device-lib=all --sysroot=%S/Inputs/SYCL \
1010
// RUN: -fsycl-targets=nvptx64-nvidia-cuda %s 2>&1 \
1111
// RUN: | FileCheck -check-prefix=CHK-NO-DEVLIB %s
1212

@@ -20,20 +20,20 @@
2020
// CHK-NO-DEVLIB: {{[0-9]+}}: linker, {{{.*}}[[LIB1]], [[LIB2]], [[LIB3]]{{.*}}}, ir, (device-sycl, sm_50)
2121

2222
// Check that the -fsycl-device-lib flag has no effect when "all" is specified.
23-
// RUN: %clangxx -ccc-print-phases -std=c++11 -fsycl -fsycl-device-lib=all \
23+
// RUN: %clangxx -ccc-print-phases -std=c++11 -fsycl -fsycl-device-lib=all --sysroot=%S/Inputs/SYCL \
2424
// RUN: -fsycl-targets=nvptx64-nvidia-cuda %s 2>&1 \
2525
// RUN: | FileCheck -check-prefix=CHK-ALL %s
2626

2727
// Check that the -fsycl-device-lib flag has no effect when subsets of libs
2828
// are specified.
29-
// RUN: %clangxx -ccc-print-phases -std=c++11 \
29+
// RUN: %clangxx -ccc-print-phases -std=c++11 --sysroot=%S/Inputs/SYCL \
3030
// RUN: -fsycl -fsycl-device-lib=libc,libm-fp32,libm-fp64,libimf-fp32,libimf-fp64,libimf-bf16,libm-bfloat16 \
3131
// RUN: -fsycl-targets=nvptx64-nvidia-cuda %s 2>&1 \
3232
// RUN: | FileCheck -check-prefix=CHK-ALL %s
3333

3434
// Check that -fno-sycl-device-lib is ignored when it does not contain "all".
3535
// A warning should be printed that the flag got ignored.
36-
// RUN: %clangxx -ccc-print-phases -std=c++11 -fsycl \
36+
// RUN: %clangxx -ccc-print-phases -std=c++11 -fsycl --sysroot=%S/Inputs/SYCL \
3737
// RUN: -fno-sycl-device-lib=libc,libm-fp32,libm-fp64,libimf-fp32,libimf-fp64,libimf-bf16,libm-bfloat16 \
3838
// RUN: -fsycl-targets=nvptx64-nvidia-cuda %s 2>&1 \
3939
// RUN: | FileCheck -check-prefixes=CHK-UNUSED-WARN,CHK-ALL %s

0 commit comments

Comments
 (0)