|
190 | 190 |
|
191 | 191 | if lit_config.params.get("enable-perf-tests", False):
|
192 | 192 | 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") |
197 | 199 |
|
198 | 200 | # check if compiler supports CL command line options
|
199 | 201 | cl_options = False
|
|
204 | 206 |
|
205 | 207 | # Check for Level Zero SDK
|
206 | 208 | 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: |
208 | 210 | print(
|
209 | 211 | textwrap.dedent(
|
210 | 212 | """
|
|
254 | 256 |
|
255 | 257 | # Check for sycl-preview library
|
256 | 258 | 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: |
258 | 260 | print(
|
259 | 261 | textwrap.dedent(
|
260 | 262 | """
|
|
278 | 280 |
|
279 | 281 | # Check for CUDA SDK
|
280 | 282 | 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: |
282 | 284 | print(
|
283 | 285 | textwrap.dedent(
|
284 | 286 | """
|
|
637 | 639 | # be ill-formed (compilation stops with non-zero exit code) if the feature
|
638 | 640 | # test macro for kernel fusion is not defined.
|
639 | 641 | 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: |
641 | 643 | ff.write("#include <sycl/sycl.hpp>\n")
|
642 | 644 | ff.write("#ifndef SYCL_EXT_CODEPLAY_KERNEL_FUSION\n")
|
643 | 645 | ff.write('#error "Feature test for fusion failed"\n')
|
|
0 commit comments