[Piglit] [PATCH 1/3] framework: add helper for checking extension existence
Tapani Pälli
tapani.palli at intel.com
Tue Feb 27 08:10:10 UTC 2018
Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
---
include/tapi/t_result.h | 1 +
src/framework/test/t_result.c | 16 +++++++++++-----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/include/tapi/t_result.h b/include/tapi/t_result.h
index 71bc980..7a4a898 100644
--- a/include/tapi/t_result.h
+++ b/include/tapi/t_result.h
@@ -59,6 +59,7 @@ noreturn void t_pass(void);
#define t_assertf(cond, format, ...) __t_assertf(__FILE__, __LINE__, (cond), #cond, format, ##__VA_ARGS__)
#define t_assertfv(cond, format, va) __t_assertfv(__FILE__, __LINE__, (cond), #cond, format, va)
+bool t_has_ext(const char *extension_name);
void t_require_ext(const char *extension_name);
noreturn void __t_skip(const char *file, int line);
diff --git a/src/framework/test/t_result.c b/src/framework/test/t_result.c
index 6aae081..80ab731 100644
--- a/src/framework/test/t_result.c
+++ b/src/framework/test/t_result.c
@@ -186,22 +186,28 @@ __t_assertfv(const char *file, int line, bool cond, const char *cond_string,
t_end(TEST_RESULT_FAIL);
}
-void
-t_require_ext(const char *name)
+bool
+t_has_ext(const char *name)
{
GET_CURRENT_TEST(t);
for (uint32_t i = 0; i < t->vk.instance_extension_count; i++) {
if (!strcmp(name, t->vk.instance_extension_props[i].extensionName))
- return;
+ return true;
}
for (uint32_t i = 0; i < t->vk.device_extension_count; i++) {
if (!strcmp(name, t->vk.device_extension_props[i].extensionName))
- return;
+ return true;
}
+ return false;
+}
- t_skip();
+void
+t_require_ext(const char *name)
+{
+ if (!t_has_ext(name))
+ t_skip();
}
static bool
--
2.14.3
More information about the Piglit
mailing list