Skip to content

Commit 623839f

Browse files
authored
[SYCL][NFC] Fix skipping KernelBundleWith2Kernels test (#5225)
Currently most of unit tests print something and just return if test pre-requisites are not met. llvm-lit reports such tests as "passed" instead of "skipped" because Google Test framework reports test status incorrectly. GTEST_SKIP must be used to indicate the framework "skipped" test status. Fixed a typo in PiMock.hpp. TODO: the same approach must be applied to all other unittests.
1 parent 8f9d0d2 commit 623839f

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

sycl/unittests/helpers/PiMock.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ namespace RT = detail::pi;
6666
/// redefinitions would also affect other platforms' behavior.
6767
/// Therefore, any plugin-related information is fully copied whenever
6868
/// a user-passed SYCL object instance is being mocked.
69-
/// The underlying SYCL platform must be a non-host plaftorm to facilitate
69+
/// The underlying SYCL platform must be a non-host platform to facilitate
7070
/// plugin usage.
7171
///
7272
/// Simple usage examples would look like this:

sycl/unittests/program_manager/EliminatedArgMask.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,11 @@ sycl::detail::ProgramManager::KernelArgMask getKernelArgMaskFromBundle(
191191
// kernel bundle after two kernels are compiled and linked.
192192
TEST(EliminatedArgMask, KernelBundleWith2Kernels) {
193193
sycl::platform Plt{sycl::default_selector()};
194-
if (Plt.is_host()) {
195-
std::cerr << "Test is not supported on host, skipping\n";
196-
return; // test is not supported on host.
197-
} else if (Plt.get_backend() == sycl::backend::ext_oneapi_cuda) {
198-
std::cerr << "Test is not supported on CUDA platform, skipping\n";
199-
return;
200-
} else if (Plt.get_backend() == sycl::backend::ext_oneapi_hip) {
201-
std::cout << "Test is not supported on HIP platform, skipping\n";
202-
return;
194+
if (Plt.is_host() || Plt.get_backend() == sycl::backend::ext_oneapi_cuda ||
195+
Plt.get_backend() == sycl::backend::ext_oneapi_hip) {
196+
std::cerr << "Test is not supported on "
197+
<< Plt.get_info<sycl::info::platform::name>() << ", skipping\n";
198+
GTEST_SKIP(); // test is not supported on selected platform.
203199
}
204200

205201
sycl::unittest::PiMock Mock{Plt};

0 commit comments

Comments
 (0)