forked from intel/llvm-test-suite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-log.cpp
More file actions
56 lines (49 loc) · 1.56 KB
/
build-log.cpp
File metadata and controls
56 lines (49 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// XFAIL: cuda
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -DGPU %s -o %t_gpu.out
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t_gpu.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
//
//==--- build-log.cpp - Test log message from faild build ----------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===--------------------------------------------------------------===//
#include <CL/sycl.hpp>
SYCL_EXTERNAL
void symbol_that_does_not_exist();
void test() {
cl::sycl::queue Queue;
// Submitting this kernel should result in a compile_program_error exception
// with a message indicating "CL_BUILD_PROGRAM_FAILURE".
auto Kernel = []() {
#ifdef __SYCL_DEVICE_ONLY__
#ifdef GPU
asm volatile("undefined\n");
#else // GPU
symbol_that_does_not_exist();
#endif // GPU
#endif // __SYCL_DEVICE_ONLY__
};
std::string Msg;
int Result;
try {
Queue.submit([&](cl::sycl::handler &CGH) {
CGH.single_task<class SingleTask>(Kernel);
});
assert(false && "There must be compilation error");
} catch (const cl::sycl::compile_program_error &e) {
std::string Msg(e.what());
std::cerr << Msg << std::endl;
assert(Msg.find("CL_BUILD_PROGRAM_FAILURE") != std::string::npos);
} catch (...) {
assert(false && "There must be cl::sycl::compile_program_error");
}
}
int main() {
test();
return 0;
}