Skip to content

Commit 4150bdf

Browse files
authored
[SYCL][E2E] Fix SDK detection on Windows (#17792)
The `shlex.quote` API doesn't do the right thing on Windows and that is documented [here](https://docs.python.org/3/library/shlex.html#shlex.quote), so do it manually. Manually verified it's broken without this change and this fixes it. I looked and couldn't find any single utility that covers this functionality. --------- Signed-off-by: Sarnie, Nick <[email protected]>
1 parent b81f543 commit 4150bdf

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

sycl/test-e2e/lit.cfg.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,12 @@ def check_igc_tag_and_add_feature():
246246
if "igc-dev" in contents:
247247
config.available_features.add("igc-dev")
248248

249+
250+
def quote_path(path):
251+
if platform.system() == "Windows":
252+
return f'"{path}"'
253+
return shlex.quote(path)
254+
249255
# Call the function to perform the check and add the feature
250256
check_igc_tag_and_add_feature()
251257

@@ -305,10 +311,10 @@ def open_check_file(file_name):
305311
file=fp,
306312
)
307313

308-
config.level_zero_libs_dir = shlex.quote(
314+
config.level_zero_libs_dir = quote_path(
309315
lit_config.params.get("level_zero_libs_dir", config.level_zero_libs_dir)
310316
)
311-
config.level_zero_include = shlex.quote(
317+
config.level_zero_include = quote_path(
312318
lit_config.params.get(
313319
"level_zero_include",
314320
(
@@ -416,10 +422,10 @@ def open_check_file(file_name):
416422
file=fp,
417423
)
418424

419-
config.cuda_libs_dir = shlex.quote(
425+
config.cuda_libs_dir = quote_path(
420426
lit_config.params.get("cuda_libs_dir", config.cuda_libs_dir)
421427
)
422-
config.cuda_include = shlex.quote(
428+
config.cuda_include = quote_path(
423429
lit_config.params.get(
424430
"cuda_include",
425431
(config.cuda_include if config.cuda_include else config.sycl_include),
@@ -465,10 +471,10 @@ def open_check_file(file_name):
465471
),
466472
file=fp,
467473
)
468-
config.hip_libs_dir = shlex.quote(
474+
config.hip_libs_dir = quote_path(
469475
lit_config.params.get("hip_libs_dir", config.hip_libs_dir)
470476
)
471-
config.hip_include = shlex.quote(
477+
config.hip_include = quote_path(
472478
lit_config.params.get(
473479
"hip_include",
474480
(config.hip_include if config.hip_include else config.sycl_include),

0 commit comments

Comments
 (0)