[Mesa-dev] [PATCH 2/3] util: Add a new little helper for making a piglit_result from subtest results.

Eric Anholt eric at anholt.net
Fri Jan 20 14:45:21 PST 2012


---
 tests/util/piglit-util.c |   25 +++++++++++++++++++++++++
 tests/util/piglit-util.h |    1 +
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index 9c4f0a5..d834487 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -421,3 +421,28 @@ piglit_set_rlimit(unsigned long lim)
 	printf("Cannot reset rlimit on this platform.\n\n");
 #endif
 }
+
+/* Merges the PASS/FAIL/SKIP for @subtest into the overall result
+ * @all.
+ *
+ * The @all should start out initialized to PIGLIT_SKIP.
+ */
+void
+piglit_merge_result(enum piglit_result *all, enum piglit_result subtest)
+{
+	switch (subtest) {
+	case PIGLIT_FAIL:
+		*all = PIGLIT_FAIL;
+		break;
+	case PIGLIT_WARN:
+		if (*all == PIGLIT_SKIP || *all == PIGLIT_PASS)
+			*all = PIGLIT_WARN;
+		break;
+	case PIGLIT_PASS:
+		if (*all == PIGLIT_SKIP)
+			*all = PIGLIT_PASS;
+		break;
+	case PIGLIT_SKIP:
+		break;
+	}
+}
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index 1c8c740..7040432 100755
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -184,6 +184,7 @@ piglit_check_gl_error(GLenum expected_error);
 void piglit_reset_gl_error(void);
 
 int FindLine(const char *program, int position);
+void piglit_merge_result(enum piglit_result *all, enum piglit_result subtest);
 void piglit_report_result(enum piglit_result result);
 void piglit_require_gl_version(int required_version_times_10);
 void piglit_require_extension(const char *name);
-- 
1.7.7.3



More information about the mesa-dev mailing list