18
18
19
19
namespace uur {
20
20
21
+ namespace {
22
+ // By default we skip certain platforms that we don't officially support and are unstable
23
+ void checkBlacklisted (ur_platform_handle_t platform) {
24
+ static const std::array<uur::Matcher, 1 > BLACKLISTED_PLATFORMS{
25
+ uur::OpenCL{" AMD Accelerated Parallel Processing" },
26
+ };
27
+
28
+ if (uur::alsoRunKnownFailures ()) {
29
+ return ;
30
+ }
31
+
32
+ ur_adapter_handle_t adapter = 0 ;
33
+ ASSERT_SUCCESS (urPlatformGetInfo (platform, UR_PLATFORM_INFO_ADAPTER,
34
+ sizeof (adapter), &adapter, nullptr ));
35
+ detail::AdapterInfo info = detail::getAdapterInfo (adapter);
36
+
37
+ size_t name_size = 0 ;
38
+ ASSERT_SUCCESS (urPlatformGetInfo (platform, UR_PLATFORM_INFO_NAME, 0 , nullptr ,
39
+ &name_size));
40
+ std::string name (name_size - 1 , ' \0 ' );
41
+ ASSERT_SUCCESS (urPlatformGetInfo (platform, UR_PLATFORM_INFO_NAME, name_size,
42
+ name.data (), nullptr ));
43
+
44
+ for (auto &m : BLACKLISTED_PLATFORMS) {
45
+ if (m.matches (info, name)) {
46
+ GTEST_SKIP () << " Platform '" << name
47
+ << " ' is blacklisted and not tested by default."
48
+ " Set `UR_CTS_ALSO_RUN_KNOWN_FAILURES` in the "
49
+ " environment to disable the blacklist." ;
50
+ }
51
+ }
52
+ }
53
+ } // namespace
54
+
21
55
struct urAdapterTest : ::testing::Test,
22
56
::testing::WithParamInterface<ur_adapter_handle_t > {
23
57
void SetUp () override { adapter = GetParam (); }
@@ -31,7 +65,10 @@ struct urAdapterTest : ::testing::Test,
31
65
// platform.
32
66
struct urPlatformTest : ::testing::Test,
33
67
::testing::WithParamInterface<ur_platform_handle_t > {
34
- void SetUp () override { platform = GetParam (); }
68
+ void SetUp () override {
69
+ platform = GetParam ();
70
+ UUR_RETURN_ON_FATAL_FAILURE (checkBlacklisted (platform));
71
+ }
35
72
36
73
ur_platform_handle_t platform = nullptr ;
37
74
};
@@ -84,6 +121,8 @@ struct urDeviceTest : ::testing::Test,
84
121
device = GetParam ().device ;
85
122
platform = GetParam ().platform ;
86
123
adapter = GetParam ().adapter ;
124
+
125
+ UUR_RETURN_ON_FATAL_FAILURE (checkBlacklisted (platform));
87
126
}
88
127
89
128
ur_device_handle_t device = nullptr ;
@@ -122,7 +161,10 @@ template <class T>
122
161
struct urPlatformTestWithParam
123
162
: ::testing::Test,
124
163
::testing::WithParamInterface<std::tuple<ur_platform_handle_t , T>> {
125
- void SetUp () override { platform = std::get<0 >(this ->GetParam ()); }
164
+ void SetUp () override {
165
+ platform = std::get<0 >(this ->GetParam ());
166
+ UUR_RETURN_ON_FATAL_FAILURE (checkBlacklisted (platform));
167
+ }
126
168
const T &getParam () const { return std::get<1 >(this ->GetParam ()); }
127
169
ur_platform_handle_t platform;
128
170
};
@@ -154,6 +196,8 @@ struct urDeviceTestWithParam
154
196
device = device_tuple.device ;
155
197
platform = device_tuple.platform ;
156
198
adapter = device_tuple.adapter ;
199
+
200
+ UUR_RETURN_ON_FATAL_FAILURE (checkBlacklisted (platform));
157
201
}
158
202
// TODO - I don't like the confusion with GetParam();
159
203
const T &getParam () const { return std::get<1 >(this ->GetParam ()); }
0 commit comments