|
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 | + |
| 195 | +# Use this to make sure that any dynamic checks below are done in the build |
| 196 | +# directory and not where the sources are located. This is important for the |
| 197 | +# in-tree configuration (as opposite to the standalone one). |
| 198 | +def open_check_file(file_name): |
| 199 | + return open(os.path.join(config.sycl_obj_root, file_name), "w") |
197 | 200 |
|
198 | 201 | # check if compiler supports CL command line options
|
199 | 202 | cl_options = False
|
|
204 | 207 |
|
205 | 208 | # Check for Level Zero SDK
|
206 | 209 | check_l0_file = "l0_include.cpp"
|
207 |
| -with open(check_l0_file, "w") as fp: |
| 210 | +with open_check_file(check_l0_file) as fp: |
208 | 211 | print(
|
209 | 212 | textwrap.dedent(
|
210 | 213 | """
|
|
254 | 257 |
|
255 | 258 | # Check for sycl-preview library
|
256 | 259 | check_preview_breaking_changes_file = "preview_breaking_changes_link.cpp"
|
257 |
| -with open(check_preview_breaking_changes_file, "w") as fp: |
| 260 | +with open_check_file(check_preview_breaking_changes_file) as fp: |
258 | 261 | print(
|
259 | 262 | textwrap.dedent(
|
260 | 263 | """
|
|
278 | 281 |
|
279 | 282 | # Check for CUDA SDK
|
280 | 283 | check_cuda_file = "cuda_include.cpp"
|
281 |
| -with open(check_cuda_file, "w") as fp: |
| 284 | +with open_check_file(check_cuda_file) as fp: |
282 | 285 | print(
|
283 | 286 | textwrap.dedent(
|
284 | 287 | """
|
|
637 | 640 | # be ill-formed (compilation stops with non-zero exit code) if the feature
|
638 | 641 | # test macro for kernel fusion is not defined.
|
639 | 642 | check_fusion_file = "check_fusion.cpp"
|
640 |
| -with open(check_fusion_file, "w") as ff: |
| 643 | +with open_check_file(check_fusion_file) as ff: |
641 | 644 | ff.write("#include <sycl/sycl.hpp>\n")
|
642 | 645 | ff.write("#ifndef SYCL_EXT_CODEPLAY_KERNEL_FUSION\n")
|
643 | 646 | ff.write('#error "Feature test for fusion failed"\n')
|
|
0 commit comments