@@ -159,15 +159,21 @@ struct urSamplerTest : urContextTest {
159159 UR_SAMPLER_ADDRESSING_MODE_CLAMP, /* addressing mode */
160160 UR_SAMPLER_FILTER_MODE_LINEAR, /* filterMode */
161161 };
162- ASSERT_SUCCESS (urSamplerCreate (context, &sampler_desc, &sampler));
162+ auto ret = urSamplerCreate (context, &sampler_desc, &sampler);
163+ if (ret == UR_RESULT_ERROR_UNSUPPORTED_FEATURE ||
164+ ret == UR_RESULT_ERROR_UNINITIALIZED) {
165+ GTEST_SKIP () << " urSamplerCreate not supported" ;
166+ }
163167 }
164168
165169 void TearDown () override {
166- EXPECT_SUCCESS (urSamplerRelease (sampler));
170+ if (sampler) {
171+ EXPECT_SUCCESS (urSamplerRelease (sampler));
172+ }
167173 UUR_RETURN_ON_FATAL_FAILURE (urContextTest::TearDown ());
168174 }
169175
170- ur_sampler_handle_t sampler;
176+ ur_sampler_handle_t sampler = nullptr ;
171177 ur_sampler_desc_t sampler_desc;
172178};
173179
@@ -263,15 +269,22 @@ template <class T> struct urSamplerTestWithParam : urContextTestWithParam<T> {
263269 UR_SAMPLER_ADDRESSING_MODE_CLAMP, /* addressing mode */
264270 UR_SAMPLER_FILTER_MODE_LINEAR, /* filterMode */
265271 };
266- ASSERT_SUCCESS (urSamplerCreate (this ->context , &sampler_desc, &sampler));
272+ auto ret = urSamplerCreate (this ->context , &sampler_desc, &sampler);
273+ if (ret == UR_RESULT_ERROR_UNSUPPORTED_FEATURE ||
274+ ret == UR_RESULT_ERROR_UNINITIALIZED) {
275+ GTEST_SKIP () << " urSamplerCreate not supported" ;
276+ }
267277 }
268278
269279 void TearDown () override {
270- EXPECT_SUCCESS (urSamplerRelease (sampler));
280+ if (sampler) {
281+ EXPECT_SUCCESS (urSamplerRelease (sampler));
282+ }
283+
271284 UUR_RETURN_ON_FATAL_FAILURE (urContextTestWithParam<T>::TearDown ());
272285 }
273286
274- ur_sampler_handle_t sampler;
287+ ur_sampler_handle_t sampler = nullptr ;
275288 ur_sampler_desc_t sampler_desc;
276289};
277290
0 commit comments