Skip to content

Commit a9bf0b6

Browse files
committed
[SYCL][CUDA] Pass SYCL_BE to LIT unit tests
Pass the SYCL_BE environment variable to the SYCL-Unit unit tests. Signed-off-by: Bjoern Knafla <[email protected]>
1 parent 8064200 commit a9bf0b6

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed

sycl/test/Unit/lit.cfg.py

+3
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,6 @@ def find_shlibpath_var():
6666
else:
6767
lit_config.warning("unable to inject shared library path on '{}'"
6868
.format(platform.system()))
69+
70+
config.environment['SYCL_BE'] = lit_config.params.get('SYCL_BE', "PI_OPENCL")
71+
lit_config.note("Backend (SYCL_BE): {}".format(config.environment['SYCL_BE']))
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
2-
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out | FileCheck %s
3-
// RUN: %CPU_RUN_PLACEHOLDER %t.out %CPU_CHECK_PLACEHOLDER
4-
// RUN: %GPU_RUN_PLACEHOLDER %t.out %GPU_CHECK_PLACEHOLDER
5-
// RUN: %ACC_RUN_PLACEHOLDER %t.out %ACC_CHECK_PLACEHOLDER
2+
// RUN: env SYCL_BE=%sycl_be %t.out | FileCheck %s
63
//==------------------- handler.cpp ----------------------------------------==//
7-
//
84
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
95
// See https://llvm.org/LICENSE.txt for license information.
106
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
117
//
128
//===----------------------------------------------------------------------===//
139

1410
#include <CL/sycl.hpp>
11+
#include <cassert>
1512

1613
using namespace cl;
1714

1815
int main() {
1916

20-
bool Failed = false;
21-
2217
sycl::queue Queue([](sycl::exception_list ExceptionList) {
2318
if (ExceptionList.size() != 1) {
2419
std::cerr << "Should be one exception in exception list" << std::endl;
@@ -33,8 +28,9 @@ int main() {
3328
CGH.single_task<class Dummy2>([]() {});
3429
});
3530
Queue.throw_asynchronous();
36-
} catch (sycl::exception &E) {
31+
assert(!"Expected exception not caught");
32+
} catch (sycl::exception &ExpectedException) {
3733
// CHECK: Attempt to set multiple actions for the command group
38-
std::cout << E.what() << std::endl;
34+
std::cout << ExpectedException.what() << std::endl;
3935
}
4036
}

sycl/test/basic_tests/queue.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
2-
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
3-
// RUN: %CPU_RUN_PLACEHOLDER %t.out
4-
// RUN: %GPU_RUN_PLACEHOLDER %t.out
5-
// RUN: %ACC_RUN_PLACEHOLDER %t.out
2+
// RUN: env SYCL_BE=%sycl_be %t.out
63
//==--------------- queue.cpp - SYCL queue test ----------------------------==//
74
//
85
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.

sycl/test/lit.cfg.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
llvm_config.add_tool_substitutions(['llvm-spirv'], [config.sycl_tools_dir])
7474

7575
backend=lit_config.params.get('SYCL_BE', "PI_OPENCL")
76-
lit_config.note("Backend: {BACKEND}".format(BACKEND=backend))
76+
lit_config.note("Backend (SYCL_BE): {}".format(backend))
7777
config.substitutions.append( ('%sycl_be', backend) )
7878

7979
get_device_count_by_type_path = os.path.join(config.llvm_tools_dir, "get_device_count_by_type")

0 commit comments

Comments
 (0)