Skip to content

Commit 008b0d1

Browse files
authored
[SYCL][E2E] Use configure_lit_site_cfg in in-tree builds (#8854)
This provides the added benefit that it will automatically map the config paths from the build directories to the corresponding source ones in `llvm-lit`. With this, one should be able to run lit tests directly from source paths. Note also that this changes the configured cfg file's name from `lit.site.cfg` to `lit.site.cfg.py`, but this aligns us with the predominant style across the llvm project.
1 parent dd23a85 commit 008b0d1

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

sycl/test-e2e/CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,17 @@ set(SYCL_E2E_TESTS_LIT_FLAGS "-sv" CACHE STRING "Flags used when running lit")
3333

3434
find_package(Python3 REQUIRED COMPONENTS Interpreter)
3535

36-
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in"
37-
"${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg")
36+
if(SYCL_TEST_E2E_STANDALONE)
37+
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in"
38+
"${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py")
39+
else()
40+
configure_lit_site_cfg(
41+
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
42+
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
43+
MAIN_CONFIG
44+
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
45+
)
46+
endif() # Standalone.
3847

3948
if(NOT SYCL_TEST_E2E_STANDALONE)
4049
list(APPEND SYCL_E2E_TEST_DEPS

sycl/test-e2e/README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ cmake -G Ninja ...
5656
ninja check-sycl-e2e
5757
```
5858

59-
In addition to this standalone configuration one can enable `check-sycl-e2e`
60-
target for the sycl-toolchain workspace/build by specifying
59+
In addition to this, in an in-tree configuration one can enable
60+
`check-sycl-e2e` target for the sycl-toolchain workspace/build by specifying
6161
`SYCL_TEST_E2E_TARGETS` as part of its cmake configuration. For example, like
6262
this:
6363

@@ -67,6 +67,19 @@ CC=<> CXX=<> python llvm/buildbot/configure.py -o build ... \
6767
--cmake-opt=-DSYCL_E2E_TESTS_LIT_FLAGS="--param;dump_ir=True"``
6868
```
6969

70+
In an in-tree build, individual tests or groups of tests can be conveniently
71+
run directly from their source paths, using the configured `llvm-lit` script:
72+
73+
```
74+
# Implicitly uses cmake parameters SYCL_BE and SYCL_TARGET_DEVICES, detailed
75+
# below
76+
build/bin/llvm-lit -sv sycl/test-e2e/Basic/aspects.cpp
77+
78+
# Explicitly sets SYCL backend and target device(s), overriding SYCL_BE and
79+
# SYCL_TARGET_DEVICES
80+
build/bin/llvm-lit -sv --param sycl_be=level_zero --param target_devices=cpu,gpu sycl/test-e2e/Basic/aspects.cpp
81+
```
82+
7083
# Cmake parameters
7184

7285
These parameters can be used to configure tests:

0 commit comments

Comments
 (0)