[Piglit] [PATCH 1/5] util: move SUBTEST and SUBTESTCONDITION to piglit-util

Alejandro PiƱeiro apinheiro at igalia.com
Wed Jan 11 21:46:52 UTC 2017


Defined on dsa-utils.h. Plan to use on other tests.
---
 tests/spec/arb_direct_state_access/dsa-utils.h | 16 ----------------
 tests/util/piglit-util.h                       | 23 +++++++++++++++++++++++
 2 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/tests/spec/arb_direct_state_access/dsa-utils.h b/tests/spec/arb_direct_state_access/dsa-utils.h
index 1f84f95..cd6c56b 100644
--- a/tests/spec/arb_direct_state_access/dsa-utils.h
+++ b/tests/spec/arb_direct_state_access/dsa-utils.h
@@ -39,22 +39,6 @@ extern "C" {
 
 #include "piglit-util-gl.h"
 
-#define SUBTEST(error, global, ...) \
-do { \
-	bool local = piglit_check_gl_error((error)); \
-	global = global && local; \
-	piglit_report_subtest_result(local ? PIGLIT_PASS : PIGLIT_FAIL, \
-	                             __VA_ARGS__); \
-} while (0)
-
-#define SUBTESTCONDITION(condition, global, ...) \
-do { \
-	bool cond = (condition); \
-	global = global && cond; \
-	piglit_report_subtest_result(cond ? PIGLIT_PASS : PIGLIT_FAIL, \
-	                             __VA_ARGS__); \
-} while (0)
-
 GLuint dsa_create_program(GLenum target);
 
 void dsa_texture_with_unit(GLuint prog, GLuint unit);
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index ec580df..550b14c 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -185,6 +185,29 @@ piglit_run_selected_subtests(const struct piglit_subtest *all_subtests,
 #define MAX2(a, b) ((a) > (b) ? (a) : (b))
 #define ALIGN(value, alignment) (((value) + alignment - 1) & ~(alignment - 1))
 
+/**
+ * Utility macro that checks for a given opengl error, and report a
+ * subtest result.
+ */
+#define SUBTEST(error, global, ...) \
+do { \
+	bool local = piglit_check_gl_error((error)); \
+	global = global && local; \
+	piglit_report_subtest_result(local ? PIGLIT_PASS : PIGLIT_FAIL, \
+				     __VA_ARGS__);			\
+} while (0)
+
+/**
+ * Utility macro that checks for a given condition, and report a
+ * subtest result.
+ */
+#define SUBTESTCONDITION(condition, global, ...) \
+do { \
+	bool cond = (condition); \
+	global = global && cond; \
+	piglit_report_subtest_result(cond ? PIGLIT_PASS : PIGLIT_FAIL, \
+				     __VA_ARGS__);		       \
+} while (0)
 
 static inline unsigned
 log2u(unsigned v)
-- 
2.9.3



More information about the Piglit mailing list