[Piglit] [PATCH 2/4] util: Add piglit_result_to_string() helper

Tom Stellard tom at stellard.net
Wed Dec 5 10:00:19 PST 2012


From: Tom Stellard <thomas.stellard at amd.com>

---
 tests/util/piglit-util.c | 12 ++++++++++++
 tests/util/piglit-util.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index c061def..72bba21 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -158,6 +158,18 @@ int piglit_find_line(const char *program, int position)
 	return line;
 }
 
+const char *
+piglit_result_to_string(enum piglit_result result)
+{
+        switch (result) {
+        case PIGLIT_FAIL: return "fail";
+        case PIGLIT_SKIP: return "skip";
+        case PIGLIT_WARN: return "warn";
+        case PIGLIT_PASS: return "pass";
+        }
+        return "Unknown result";
+}
+
 void
 piglit_report_result(enum piglit_result result)
 {
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index e22246a..2bbc767 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -133,6 +133,7 @@ bool piglit_is_extension_in_array(const char **haystack, const char *needle);
 
 int piglit_find_line(const char *program, int position);
 void piglit_merge_result(enum piglit_result *all, enum piglit_result subtest);
+const char * piglit_result_to_string(enum piglit_result result);
 void piglit_report_result(enum piglit_result result);
 
 #ifndef HAVE_STRCHRNUL
-- 
1.7.11.4



More information about the Piglit mailing list