[RFC] Move logic for test registration to the test harness (#2151)

And use in device_timer suite.

Signed-off-by: Kévin Petit <kpet@free.fr>
This commit is contained in:
Kévin Petit
2024-11-26 17:55:09 +00:00
committed by GitHub
parent df5e87bf97
commit 0a1456d8f9
36 changed files with 307 additions and 352 deletions

View File

@@ -83,25 +83,25 @@ int test_op_lifetime(cl_device_id deviceID,
return 0;
}
#define TEST_LIFETIME(name) \
TEST_SPIRV_FUNC(op_##name) \
{ \
const int num = 1 << 10; \
RandomSeed seed(gRandomSeed); \
\
std::vector<cl_int> lhs(num); \
std::vector<cl_int> rhs(num); \
std::vector<cl_int> out(num); \
\
for (int i = 0; i < num; i++) { \
lhs[i] = genrand<int>(seed); \
rhs[i] = genrand<int>(seed); \
out[i] = lhs[i] - rhs[i]; \
} \
\
return test_op_lifetime(deviceID, context, queue, \
#name, \
lhs, rhs, out); \
} \
#define TEST_LIFETIME(name) \
REGISTER_TEST(op_##name) \
{ \
const int num = 1 << 10; \
RandomSeed seed(gRandomSeed); \
\
std::vector<cl_int> lhs(num); \
std::vector<cl_int> rhs(num); \
std::vector<cl_int> out(num); \
\
for (int i = 0; i < num; i++) \
{ \
lhs[i] = genrand<int>(seed); \
rhs[i] = genrand<int>(seed); \
out[i] = lhs[i] - rhs[i]; \
} \
\
return test_op_lifetime(deviceID, context, queue, #name, lhs, rhs, \
out); \
}
TEST_LIFETIME(lifetime_simple)