[Piglit] [PATCH] gl-3.0-vertexattribipointer: add argv support for running single tests

Brian Paul brianp at vmware.com
Mon Jun 16 12:16:06 PDT 2014


---
 tests/spec/gl-3.0/vertexattribipointer.c |   43 +++++++++++++++++++++++-------
 1 file changed, 34 insertions(+), 9 deletions(-)

diff --git a/tests/spec/gl-3.0/vertexattribipointer.c b/tests/spec/gl-3.0/vertexattribipointer.c
index b69e731..633b881 100644
--- a/tests/spec/gl-3.0/vertexattribipointer.c
+++ b/tests/spec/gl-3.0/vertexattribipointer.c
@@ -63,8 +63,16 @@ static const char *fragShaderText =
 	"   gl_FragColor = color; \n"
 	"} \n";
 
+static const GLenum types[] = {
+	GL_BYTE,
+	GL_UNSIGNED_BYTE,
+	GL_SHORT,
+	GL_UNSIGNED_SHORT,
+	GL_INT,
+	GL_UNSIGNED_INT
+};
 
-static const GLubyte ubyte4_data[] = { 100, 0, 200, 255 };
+static const GLubyte ubyte4_data[] = { 100, 40, 200, 255 };
 static const GLbyte byte4_data[] = { 50, 0, -25, -50 };
 static const GLushort ushort4_data[] = { 16000, 0, 32000, 65535 };
 static const GLshort short4_data[] = { 2000, 0, -4000, -32010 };
@@ -198,14 +206,6 @@ test_array(GLenum type, GLuint size)
 enum piglit_result
 piglit_display(void)
 {
-	static const GLenum types[] = {
-		GL_BYTE,
-		GL_UNSIGNED_BYTE,
-		GL_SHORT,
-		GL_UNSIGNED_SHORT,
-		GL_INT,
-		GL_UNSIGNED_INT
-	};
 	bool pass = true;
 	int t, size;
 
@@ -236,4 +236,29 @@ piglit_init(int argc, char **argv)
 	Attr_u = glGetAttribLocation(Prog, "attr_u");
 	ExpectedUniform_i = glGetUniformLocation(Prog, "expected_i");
 	ExpectedUniform_u = glGetUniformLocation(Prog, "expected_u");
+
+	if (argc == 3) {
+		/* Look for type and size on command line to run one
+		 * individual test case.  For example:
+		 * vertexattribipointer GL_BYTE 3
+		 */
+		GLenum type = 0;
+		GLint size = 0;
+		int i;
+		bool p;
+		for (i = 0; i < ARRAY_SIZE(types); i++) {
+			if (strcmp(argv[1],
+				   piglit_get_gl_enum_name(types[i])) == 0) {
+				type = types[i];
+				break;
+			}
+		}
+		assert(type);
+		size = atoi(argv[2]);
+		assert(size >= 1);
+		assert(size <= 4);
+		printf("Testing %s %d\n", argv[1], size);
+		p = test_array(type, size);
+		piglit_report_result(p ? PIGLIT_PASS : PIGLIT_FAIL);
+	}
 }
-- 
1.7.10.4



More information about the Piglit mailing list