From e86cb0a48b56937674c3653a5535e3502fbe93f7 Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Mon, 26 Dec 2022 06:06:28 -0500 Subject: [PATCH] [SYCL][NFC] Use unique (or no at all) output files in LIT tests This fixes sporadic issue with `check-sycl` on Windows. Apparently we had a number of tests, which didn't specify `-o %t.out` and it caused some tests to write to the same default `a.exe` and fail with error like: ``` LINK : fatal error LNK1104: cannot open file 'a.exe' ``` To resolve this, switch most of such tests to use `-fsyntax-only` or explicitly added `-o %t.out` to prevent possible races. "bad" tests were discovered using `grep -rnP 'clangxx(?!.*\-o)' sycl/test/` --- sycl/test/abi/layout_accessors_host.cpp | 2 +- sycl/test/abi/layout_array.cpp | 4 ++-- sycl/test/abi/layout_buffer.cpp | 2 +- sycl/test/abi/layout_handler.cpp | 2 +- sycl/test/abi/layout_image.cpp | 2 +- sycl/test/abi/layout_vec.cpp | 4 ++-- sycl/test/abi/vtable.cpp | 2 +- .../basic_tests/accessor/iterator-member-types.cpp | 2 +- .../basic_tests/boost_mp11_import_sanity_check.cpp | 2 +- sycl/test/basic_tests/interop-backend-traits.cpp | 10 +++++----- sycl/test/basic_tests/iostream_clean_compile_1.cpp | 4 ++-- sycl/test/basic_tests/iostream_clean_compile_2.cpp | 4 ++-- sycl/test/basic_tests/relational_builtins.cpp | 4 ++-- sycl/test/basic_tests/span.cpp | 2 +- sycl/test/gdb/accessors.cpp | 2 +- sycl/test/gdb/printers.cpp | 2 +- sycl/test/gdb/private-memory.cpp | 2 +- sycl/test/invoke_simd/invoke_simd.cpp | 4 +++- sycl/test/regression/print_args.cpp | 2 +- 19 files changed, 30 insertions(+), 28 deletions(-) diff --git a/sycl/test/abi/layout_accessors_host.cpp b/sycl/test/abi/layout_accessors_host.cpp index 6f5d952582aba..0f08cf76be4fe 100644 --- a/sycl/test/abi/layout_accessors_host.cpp +++ b/sycl/test/abi/layout_accessors_host.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx -fsycl -c -fno-color-diagnostics -Xclang -fdump-record-layouts %s | FileCheck %s +// RUN: %clangxx -fsycl -c -fno-color-diagnostics -Xclang -fdump-record-layouts %s -o %t.out | FileCheck %s // REQUIRES: linux // UNSUPPORTED: libcxx diff --git a/sycl/test/abi/layout_array.cpp b/sycl/test/abi/layout_array.cpp index 072ce0a6f2bb0..422bcda38bbbc 100644 --- a/sycl/test/abi/layout_array.cpp +++ b/sycl/test/abi/layout_array.cpp @@ -1,5 +1,5 @@ -// RUN: %clangxx -fsycl -c -fno-color-diagnostics -Xclang -fdump-record-layouts %s | FileCheck %s -// RUN: %clangxx -fsycl -fsycl-device-only -c -fno-color-diagnostics -Xclang -fdump-record-layouts %s | FileCheck %s +// RUN: %clangxx -fsycl -c -fno-color-diagnostics -Xclang -fdump-record-layouts %s -o %t.out | FileCheck %s +// RUN: %clangxx -fsycl -fsycl-device-only -c -fno-color-diagnostics -Xclang -fdump-record-layouts %s -o %t.out | FileCheck %s // REQUIRES: linux // UNSUPPORTED: libcxx diff --git a/sycl/test/abi/layout_buffer.cpp b/sycl/test/abi/layout_buffer.cpp index 4ccf718d39c2b..2a5917d004344 100644 --- a/sycl/test/abi/layout_buffer.cpp +++ b/sycl/test/abi/layout_buffer.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx -fsycl -c -fno-color-diagnostics -Xclang -fdump-record-layouts %s | FileCheck %s +// RUN: %clangxx -fsycl -c -fno-color-diagnostics -Xclang -fdump-record-layouts %s -o %t.out | FileCheck %s // REQUIRES: linux // UNSUPPORTED: libcxx diff --git a/sycl/test/abi/layout_handler.cpp b/sycl/test/abi/layout_handler.cpp index 4625125d44b83..cd2a1e03a2d46 100644 --- a/sycl/test/abi/layout_handler.cpp +++ b/sycl/test/abi/layout_handler.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx -fsycl -c -fno-color-diagnostics -Xclang -fdump-record-layouts %s | FileCheck %s +// RUN: %clangxx -fsycl -c -fno-color-diagnostics -Xclang -fdump-record-layouts %s -o %t.out | FileCheck %s // REQUIRES: linux // UNSUPPORTED: libcxx diff --git a/sycl/test/abi/layout_image.cpp b/sycl/test/abi/layout_image.cpp index 854cd361d45d8..b3d0e0a40ab87 100644 --- a/sycl/test/abi/layout_image.cpp +++ b/sycl/test/abi/layout_image.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx -fsycl -c -fno-color-diagnostics -Xclang -fdump-record-layouts %s | FileCheck %s +// RUN: %clangxx -fsycl -fsyntax-only -fno-color-diagnostics -Xclang -fdump-record-layouts %s | FileCheck %s // REQUIRES: linux // UNSUPPORTED: libcxx diff --git a/sycl/test/abi/layout_vec.cpp b/sycl/test/abi/layout_vec.cpp index b821b9ecca66e..8f70f2835bf72 100644 --- a/sycl/test/abi/layout_vec.cpp +++ b/sycl/test/abi/layout_vec.cpp @@ -1,5 +1,5 @@ -// RUN: %clangxx -fsycl -c -fno-color-diagnostics -Xclang -fdump-record-layouts %s | FileCheck %s -// RUN: %clangxx -fsycl -fsycl-device-only -c -fno-color-diagnostics -Xclang -fdump-record-layouts %s | FileCheck %s +// RUN: %clangxx -fsycl -c -fno-color-diagnostics -Xclang -fdump-record-layouts %s -o %t.out | FileCheck %s +// RUN: %clangxx -fsycl -fsycl-device-only -c -fno-color-diagnostics -Xclang -fdump-record-layouts %s -o %t.out | FileCheck %s // REQUIRES: linux // UNSUPPORTED: libcxx diff --git a/sycl/test/abi/vtable.cpp b/sycl/test/abi/vtable.cpp index 11a4189ebaa00..f4ebcd084a473 100644 --- a/sycl/test/abi/vtable.cpp +++ b/sycl/test/abi/vtable.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx -fsycl -c -fno-color-diagnostics -Xclang -fdump-vtable-layouts %s | FileCheck %s +// RUN: %clangxx -fsycl -c -fno-color-diagnostics -Xclang -fdump-vtable-layouts %s -o %t.out | FileCheck %s // REQUIRES: linux #include diff --git a/sycl/test/basic_tests/accessor/iterator-member-types.cpp b/sycl/test/basic_tests/accessor/iterator-member-types.cpp index d607479c4a074..ad41af8e12f6d 100644 --- a/sycl/test/basic_tests/accessor/iterator-member-types.cpp +++ b/sycl/test/basic_tests/accessor/iterator-member-types.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx -fsycl -c %s +// RUN: %clangxx -fsycl -fsyntax-only %s // // Purpose of this test is to check that [accessor|host_accessor]::iterator and // ::const_iterator are aliased to the correct type. diff --git a/sycl/test/basic_tests/boost_mp11_import_sanity_check.cpp b/sycl/test/basic_tests/boost_mp11_import_sanity_check.cpp index 0782f01cf014d..fb547959499a1 100644 --- a/sycl/test/basic_tests/boost_mp11_import_sanity_check.cpp +++ b/sycl/test/basic_tests/boost_mp11_import_sanity_check.cpp @@ -16,7 +16,7 @@ // http://www.boost.org/LICENSE_1_0.txt //===----------------------------------------------------------------------===// -// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -c %s +// RUN: %clangxx -fsycl -fsyntax-only -fsycl-targets=%sycl_triple %s // This is a sanity check test to verify that the automatic boost/mp11 import // into SYCL is not badly broken. diff --git a/sycl/test/basic_tests/interop-backend-traits.cpp b/sycl/test/basic_tests/interop-backend-traits.cpp index 13ba493af05af..b76b5ca1dc8e4 100644 --- a/sycl/test/basic_tests/interop-backend-traits.cpp +++ b/sycl/test/basic_tests/interop-backend-traits.cpp @@ -1,8 +1,8 @@ -// RUN: %clangxx -fsycl -DUSE_OPENCL %s -// RUN: %clangxx %fsycl-host-only -DUSE_L0 %s -// RUN: %clangxx -fsycl -DUSE_CUDA %s -// RUN: %clangxx -fsycl -DUSE_HIP %s -// RUN: %clangxx -fsycl -DUSE_CUDA_EXPERIMENTAL %s +// RUN: %clangxx -fsycl -fsyntax-only -DUSE_OPENCL %s +// RUN: %clangxx %fsycl-host-only -fsyntax-only -DUSE_L0 %s +// RUN: %clangxx -fsycl -fsyntax-only -DUSE_CUDA %s +// RUN: %clangxx -fsycl -fsyntax-only -DUSE_HIP %s +// RUN: %clangxx -fsycl -fsyntax-only -DUSE_CUDA_EXPERIMENTAL %s #ifdef USE_OPENCL #include diff --git a/sycl/test/basic_tests/iostream_clean_compile_1.cpp b/sycl/test/basic_tests/iostream_clean_compile_1.cpp index 58bb4ad171629..58d25fc7350cc 100644 --- a/sycl/test/basic_tests/iostream_clean_compile_1.cpp +++ b/sycl/test/basic_tests/iostream_clean_compile_1.cpp @@ -1,5 +1,5 @@ -// RUN: %clangxx -Wno-unused-command-line-argument -Werror -fsycl %s -c +// RUN: %clangxx -Wno-unused-command-line-argument -Werror -fsycl -fsyntax-only %s #include #include -void foo() { std::cout << 42; } \ No newline at end of file +void foo() { std::cout << 42; } diff --git a/sycl/test/basic_tests/iostream_clean_compile_2.cpp b/sycl/test/basic_tests/iostream_clean_compile_2.cpp index b1026c7a8cae5..e8af73abf5833 100644 --- a/sycl/test/basic_tests/iostream_clean_compile_2.cpp +++ b/sycl/test/basic_tests/iostream_clean_compile_2.cpp @@ -1,7 +1,7 @@ -// RUN: %clangxx -Wno-unused-command-line-argument -Werror -fsycl %s -c +// RUN: %clangxx -Wno-unused-command-line-argument -Werror -fsycl -fsyntax-only %s // clang-format off #include #include // clang-format on -void foo() { std::cout << 42; } \ No newline at end of file +void foo() { std::cout << 42; } diff --git a/sycl/test/basic_tests/relational_builtins.cpp b/sycl/test/basic_tests/relational_builtins.cpp index e0a74c260999e..88b97d3980412 100644 --- a/sycl/test/basic_tests/relational_builtins.cpp +++ b/sycl/test/basic_tests/relational_builtins.cpp @@ -1,5 +1,5 @@ -// RUN: %clangxx -DSYCL2020_CONFORMANT_APIS -fsycl %s -// RUN: %clangxx -sycl-std=121 -fsycl %s +// RUN: %clangxx -DSYCL2020_CONFORMANT_APIS -fsycl -fsyntax-only %s +// RUN: %clangxx -sycl-std=121 -fsycl -fsyntax-only %s #include diff --git a/sycl/test/basic_tests/span.cpp b/sycl/test/basic_tests/span.cpp index 634ed0085227e..f390cd24f4b59 100644 --- a/sycl/test/basic_tests/span.cpp +++ b/sycl/test/basic_tests/span.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx -fsycl -c %s +// RUN: %clangxx -fsycl -fsyntax-only %s //==--------------- span.cpp - SYCL span test ------------------------------==// // diff --git a/sycl/test/gdb/accessors.cpp b/sycl/test/gdb/accessors.cpp index 3649eb39d6c30..240cc81763999 100644 --- a/sycl/test/gdb/accessors.cpp +++ b/sycl/test/gdb/accessors.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx -c -fno-color-diagnostics -std=c++17 -I %sycl_include/sycl -I %sycl_include -Xclang -ast-dump %s | FileCheck %s +// RUN: %clangxx -fsyntax-only -fno-color-diagnostics -std=c++17 -I %sycl_include/sycl -I %sycl_include -Xclang -ast-dump %s | FileCheck %s // RUN: %clangxx -c -fno-color-diagnostics -std=c++17 -I %sycl_include/sycl -I %sycl_include -Xclang -emit-llvm -g %s -o - | FileCheck %s --check-prefixes CHECK-DEBUG-INFO // UNSUPPORTED: windows #include diff --git a/sycl/test/gdb/printers.cpp b/sycl/test/gdb/printers.cpp index 7b229cbcc0bb3..92f1c00f4b7fa 100644 --- a/sycl/test/gdb/printers.cpp +++ b/sycl/test/gdb/printers.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx -c -fno-color-diagnostics -std=c++17 -I %sycl_include/sycl -I %sycl_include -Xclang -ast-dump %s | FileCheck %s +// RUN: %clangxx -fsyntax-only -fno-color-diagnostics -std=c++17 -I %sycl_include/sycl -I %sycl_include -Xclang -ast-dump %s | FileCheck %s // UNSUPPORTED: windows #include #include diff --git a/sycl/test/gdb/private-memory.cpp b/sycl/test/gdb/private-memory.cpp index 4bb70f9233978..225eab17778d9 100644 --- a/sycl/test/gdb/private-memory.cpp +++ b/sycl/test/gdb/private-memory.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx -c -fsycl -fno-color-diagnostics -Xclang -ast-dump %s | FileCheck %s +// RUN: %clangxx -fsyntax-only -fsycl -fno-color-diagnostics -Xclang -ast-dump %s | FileCheck %s // UNSUPPORTED: windows #include #include diff --git a/sycl/test/invoke_simd/invoke_simd.cpp b/sycl/test/invoke_simd/invoke_simd.cpp index 65db9203ced2c..766b730552ae1 100644 --- a/sycl/test/invoke_simd/invoke_simd.cpp +++ b/sycl/test/invoke_simd/invoke_simd.cpp @@ -1,4 +1,6 @@ -// RUN: %clangxx -c -fsycl -fno-sycl-device-code-split-esimd -Xclang -fsycl-allow-func-ptr %s +// RUN: %clangxx -fsycl -fsyntax-only -fno-sycl-device-code-split-esimd -Xclang -fsycl-allow-func-ptr %s +// FIXME: check if -fno-sycl-device-code-split-esimd affects any pre-link steps +// and remove the flag if that is not the case // The tests checks that invoke_simd API is compileable. diff --git a/sycl/test/regression/print_args.cpp b/sycl/test/regression/print_args.cpp index 99ee9c209fe0b..fc6dfa5cbb8d3 100644 --- a/sycl/test/regression/print_args.cpp +++ b/sycl/test/regression/print_args.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx -fsycl %s -c +// RUN: %clangxx -fsycl -fsyntax-only %s // Regression tests for https://github.com/intel/llvm/issues/1011 // Checks that SYCL headers call internal templated function 'printArgs'