<p dir="ltr">Ping</p>
<div class="gmail_quote">On Sep 30, 2015 4:52 PM, "Dylan Baker" <<a href="mailto:baker.dylan.c@gmail.com">baker.dylan.c@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">There are two problems with the way this test reports subtests:<br>
<br>
First, it only reports subtests when they fail. This has all kinds of<br>
problems. It's not at all what the summary code expects, the<br>
summary code expects that subtests are always present, which means that<br>
they will show up under disabled/enabled pages instead of<br>
fixes/regressions, which in turn, will confuse developers.<br>
<br>
Second, it tries to report lots of information as the subtest name. This<br>
causes the JSON parser in python (JSON is used by the tests to<br>
communicate with the runner) to choke and die.<br>
<br>
This patch makes a couple of changes to correct this.<br>
First, it reports the subtest result always, whether pass or fail.<br>
Second, it simplifies the names of the subtests, and passes the other<br>
information to stdout, which the runner will scoop up and record for a<br>
developer to go look at.<br>
<br>
cc: Brian Paul <<a href="mailto:brianp@vmware.com">brianp@vmware.com</a>><br>
Signed-off-by: Dylan Baker <<a href="mailto:dylanx.c.baker@intel.com">dylanx.c.baker@intel.com</a>><br>
---<br>
<br>
Brian: I've tried to make the subtest reporting consistant, but I want<br>
to make sure that I'm not screwing up the logic of the test. I<br>
understand the idea of what it's doing, but not the details.<br>
<br>
<br>
 tests/general/clipflat.c | 44 ++++++++++++++++++++++++++------------------<br>
 1 file changed, 26 insertions(+), 18 deletions(-)<br>
<br>
diff --git a/tests/general/clipflat.c b/tests/general/clipflat.c<br>
index 91e410e..f195185 100644<br>
--- a/tests/general/clipflat.c<br>
+++ b/tests/general/clipflat.c<br>
@@ -1,5 +1,6 @@<br>
 /*<br>
  * Copyright © 2009, 2013 VMware, Inc.<br>
+ * Copyright © 2015 Intel Corporation<br>
  *<br>
  * Permission is hereby granted, free of charge, to any person obtaining a<br>
  * copy of this software and associated documentation files (the "Software"),<br>
@@ -317,12 +318,12 @@ checkResult(GLfloat badColor[3])<br>
<br>
<br>
 static void<br>
-reportFailure(GLenum mode, int drawMode, GLuint facing,<br>
+reportSubtest(GLenum mode, int drawMode, GLuint facing,<br>
               GLuint fill,<br>
-              const GLfloat badColor[3], GLfloat x, GLfloat y)<br>
+              const GLfloat badColor[3], GLfloat x, GLfloat y,<br>
+              const bool fail)<br>
 {<br>
        const char *m, *d, *f, *p;<br>
-       char msg1[100], msg2[100], msg3[100];<br>
<br>
        switch (mode) {<br>
        case GL_TRIANGLES:<br>
@@ -372,22 +373,23 @@ reportFailure(GLenum mode, int drawMode, GLuint facing,<br>
        else<br>
                p = "GL_LINE";<br>
<br>
-       snprintf(msg1, sizeof(msg1), "clipflat: Failure for %s(%s),"<br>
-                " glFrontFace(%s), glPolygonMode(%s)\n",<br>
-                d, m, f, p);<br>
+       if (fail == true) {<br>
+               printf("clipflat: Failure for %s(%s), glFrontFace(%s), "<br>
+                      "glPolygonMode(%s)\n",<br>
+                      d, m, f, p);<br>
<br>
-       if (testing_first_pv)<br>
-               snprintf(msg2, sizeof(msg2),<br>
-                        "\tGL_EXT_provoking_vertex test: "<br>
-                        "GL_FIRST_VERTEX_CONVENTION_EXT mode\n");<br>
-       else<br>
-               msg2[0] = 0;<br>
+               if (testing_first_pv) {<br>
+                   printf("\tGL_EXT_provoking_vertex test: "<br>
+                          "GL_FIRST_VERTEX_CONVENTION_EXT mode\n");<br>
+               }<br>
<br>
-       snprintf(msg3, sizeof(msg3),<br>
-                "\tExpected color (0, 1, 0) but found (%g, %g, %g)\n",<br>
-                badColor[0], badColor[1], badColor[2]);<br>
+               printf("Expected color (0, 1, 0) but found (%g, %g, %g)\n",<br>
+                      badColor[0], badColor[1], badColor[2]);<br>
+       }<br>
<br>
-       piglit_report_subtest_result(PIGLIT_FAIL, "%s%s%s", msg1, msg2, msg3);<br>
+       piglit_report_subtest_result(fail ? PIGLIT_FAIL : PIGLIT_PASS,<br>
+                                    "%s(%s), glFrontFace(%s), glPolygonMode(%s)",<br>
+                                    d, m, f, p);<br>
 }<br>
<br>
<br>
@@ -449,11 +451,17 @@ testPrim(GLenum mode, const GLfloat *verts, GLuint count)<br>
                                                glPopMatrix();<br>
<br>
                                                if (!checkResult(badColor)) {<br>
-                                                       reportFailure(mode, drawMode, facing, fill, badColor, x, y);<br>
-                                                       return false;<br>
+                                                       reportSubtest(mode, drawMode, facing, fill,<br>
+                                                                     badColor, x, y, true);<br>
+                                                       goto failed;<br>
                                                }<br>
                                        }<br>
                                }<br>
+<br>
+                               GLfloat badColor[3];<br>
+                               reportSubtest(mode, drawMode, facing, fill,<br>
+                                             badColor, x, y, false);<br>
+                               failed: continue;<br>
                        }<br>
                }<br>
        }<br>
--<br>
2.6.0<br>
<br>
</blockquote></div>