@@ -29,16 +29,75 @@ int main(int argc, char *argv[]) {
2929
3030 // Compile the bundles.
3131 auto KBObj1 = sycl::compile (KBInput1);
32+ auto KBObj1Extra = sycl::compile (KBInput1);
3233 auto KBObj2 = sycl::compile (KBInput2);
34+ auto KBObj2Extra = sycl::compile (KBInput2);
3335#elif defined(SYCLBIN_OBJECT_STATE)
3436 auto KBObj1 = syclex::get_kernel_bundle<sycl::bundle_state::object>(
3537 Q.get_context (), {Q.get_device ()}, std::string{argv[1 ]});
38+ auto KBObj1Extra = syclex::get_kernel_bundle<sycl::bundle_state::object>(
39+ Q.get_context (), {Q.get_device ()}, std::string{argv[1 ]});
3640 auto KBObj2 = syclex::get_kernel_bundle<sycl::bundle_state::object>(
3741 Q.get_context (), {Q.get_device ()}, std::string{argv[2 ]});
42+ auto KBObj2Extra = syclex::get_kernel_bundle<sycl::bundle_state::object>(
43+ Q.get_context (), {Q.get_device ()}, std::string{argv[2 ]});
3844#else // defined(SYCLBIN_EXECUTABLE_STATE)
3945#error "Test does not work with executable state."
4046#endif
4147
48+ // Check that linking without all symbols resolved will result in an
49+ // exception.
50+ try {
51+ auto KBExeFail = syclexp::link (
52+ {KBObj2}, syclexp::properties{syclexp::fast_link{USE_FAST_LINK}});
53+ std::cout << " No exception thrown for only KBObj2" << std::endl;
54+ ++Failed;
55+ } catch (sycl::exception &E) {
56+ if (E.code () != sycl::make_error_code (sycl::errc::invalid)) {
57+ std::cout << " Unexpected exception code for only KBObj2" << std::endl;
58+ ++Failed;
59+ }
60+ } catch (...) {
61+ std::cout << " Caught unexpected exception for only KBObj2" << std::endl;
62+ ++Failed;
63+ }
64+
65+ // Check that linking bundles with conflicting kernels will result in an
66+ // exception.
67+ try {
68+ auto KBExeFail =
69+ syclexp::link ({KBObj1, KBObj1Extra, KBObj2},
70+ syclexp::properties{syclexp::fast_link{USE_FAST_LINK}});
71+ std::cout << " No exception thrown for double KBObj1" << std::endl;
72+ ++Failed;
73+ } catch (sycl::exception &E) {
74+ if (E.code () != sycl::make_error_code (sycl::errc::invalid)) {
75+ std::cout << " Unexpected exception code for double KBObj1" << std::endl;
76+ ++Failed;
77+ }
78+ } catch (...) {
79+ std::cout << " Caught unexpected exception for double KBObj1" << std::endl;
80+ ++Failed;
81+ }
82+
83+ // Check that linking bundles with conflicting exported symbols will result in
84+ // an exception.
85+ try {
86+ auto KBExeFail =
87+ syclexp::link ({KBObj1, KBObj2, KBObj2Extra},
88+ syclexp::properties{syclexp::fast_link{USE_FAST_LINK}});
89+ std::cout << " No exception thrown for double KBObj2" << std::endl;
90+ ++Failed;
91+ } catch (sycl::exception &E) {
92+ if (E.code () != sycl::make_error_code (sycl::errc::invalid)) {
93+ std::cout << " Unexpected exception code for double KBObj2" << std::endl;
94+ ++Failed;
95+ }
96+ } catch (...) {
97+ std::cout << " Caught unexpected exception for double KBObj2" << std::endl;
98+ ++Failed;
99+ }
100+
42101 // Link the bundles.
43102 auto KBExe = syclexp::link (
44103 {KBObj1, KBObj2}, syclexp::properties{syclexp::fast_link{USE_FAST_LINK}});
0 commit comments