From: Ian Romanick <ian.d.roman...@intel.com>

Signed-off-by: Ian Romanick <ian.d.roman...@intel.com>
---
 tests/util/piglit-util.c | 25 +++++++++++++++++++++++++
 tests/util/piglit-util.h |  4 ++++
 2 files changed, 29 insertions(+)

diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index 71d55a7..20015ce 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -206,6 +206,31 @@ piglit_report_subtest_result(enum piglit_result result, 
const char *format, ...)
        va_end(ap);
 }
 
+enum piglit_result
+piglit_update_result_from_subtest_result(enum piglit_result result,
+                                        enum piglit_result subtest_result)
+{
+       switch (subtest_result) {
+       case PIGLIT_PASS:
+               if (result == PIGLIT_SKIP)
+                       result = PIGLIT_PASS;
+               break;
+       case PIGLIT_FAIL:
+               result = PIGLIT_FAIL;
+               break;
+       case PIGLIT_WARN:
+               if (result != PIGLIT_FAIL)
+                       result = PIGLIT_WARN;
+               break;
+       case PIGLIT_SKIP:
+               /* Only report skip if both result and subtest_result are skip.
+                */
+               break;
+       }
+
+       return result;
+}
+
 #ifndef HAVE_STRCHRNUL
 char *strchrnul(const char *s, int c)
 {
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index 52f053e..6c2fb2d 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -140,6 +140,10 @@ void piglit_report_result(enum piglit_result result);
 void piglit_report_subtest_result(enum piglit_result result,
                                  const char *format, ...) PRINTFLIKE(2, 3);
 
+enum piglit_result
+piglit_update_result_from_subtest_result(enum piglit_result result,
+                                        enum piglit_result subtest_result);
+
 #ifndef HAVE_STRCHRNUL
 char *strchrnul(const char *s, int c);
 #endif
-- 
1.8.1.4

_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to