Skip to content

Commit 483f880

Browse files
committed
[SYCL][E2E] Fix
Since intel#9078 (itself a fix for intel#8854), the SYCL E2E lit config would change the working directory and never set it back. This impeded LIT's ability to discover tests and test suites, when tasked with sourcing multiple. For example: llvm-lit sycl/test/A sycl/test/B LIT would discover test 'A' by appending its relative path to the CWD (e.g., root/sycl/test/A) and load up the SYCL E2E lit.cfg. This would change directory into the SYCL build directory. When discovering test 'B' it would append its relative path to the SYCL binary dir and fail to find it (e.g., root/build/tools/sycl/test-e2e/sycl/test/B). This would also have the effect of load the SYCL E2E LIT config a second time, even though it was already loaded. With this change, we maintain the CWD but open the temp files using absolute paths. This allows us to run multiple tests from multiple different paths at the same time, even ones from different suites: llvm-lit sycl/test/A clang/test/B llvm/test/C Running multiple individual SYCL tests on the same command line will also only load the SYCL config the once.
1 parent 0f0b699 commit 483f880

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

sycl/test-e2e/lit.cfg.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,12 @@
190190

191191
if lit_config.params.get("enable-perf-tests", False):
192192
config.available_features.add("enable-perf-tests")
193-
# Make sure that any dynamic checks below are done in the build directory and
194-
# not where the sources are located. This is important for the in-tree
195-
# configuration (as opposite to the standalone one).
196-
os.chdir(config.sycl_obj_root)
193+
194+
# Use this to make sure that any dynamic checks below are done in the build
195+
# directory and not where the sources are located. This is important for the
196+
# in-tree configuration (as opposite to the standalone one).
197+
def open_check_file(file_name):
198+
return open(os.path.join(config.sycl_obj_root, file_name), "w")
197199

198200
# check if compiler supports CL command line options
199201
cl_options = False
@@ -204,7 +206,7 @@
204206

205207
# Check for Level Zero SDK
206208
check_l0_file = "l0_include.cpp"
207-
with open(check_l0_file, "w") as fp:
209+
with open_check_file(check_l0_file) as fp:
208210
print(
209211
textwrap.dedent(
210212
"""
@@ -254,7 +256,7 @@
254256

255257
# Check for sycl-preview library
256258
check_preview_breaking_changes_file = "preview_breaking_changes_link.cpp"
257-
with open(check_preview_breaking_changes_file, "w") as fp:
259+
with open_check_file(check_preview_breaking_changes_file) as fp:
258260
print(
259261
textwrap.dedent(
260262
"""
@@ -278,7 +280,7 @@
278280

279281
# Check for CUDA SDK
280282
check_cuda_file = "cuda_include.cpp"
281-
with open(check_cuda_file, "w") as fp:
283+
with open_check_file(check_cuda_file) as fp:
282284
print(
283285
textwrap.dedent(
284286
"""
@@ -637,7 +639,7 @@
637639
# be ill-formed (compilation stops with non-zero exit code) if the feature
638640
# test macro for kernel fusion is not defined.
639641
check_fusion_file = "check_fusion.cpp"
640-
with open(check_fusion_file, "w") as ff:
642+
with open_check_file(check_fusion_file) as ff:
641643
ff.write("#include <sycl/sycl.hpp>\n")
642644
ff.write("#ifndef SYCL_EXT_CODEPLAY_KERNEL_FUSION\n")
643645
ff.write('#error "Feature test for fusion failed"\n')

0 commit comments

Comments
 (0)