[Piglit] [PATCH 2/2] copyteximage: Also allow filtering of format from an argument.

Eric Anholt eric at anholt.net
Tue Jun 4 11:27:50 PDT 2013


When you're debugging your driver, you certainly don't want every
format in your run.
---
 tests/texturing/copyteximage.c | 43 ++++++++++++++++++++++++++++++++++++++----
 1 file changed, 39 insertions(+), 4 deletions(-)

diff --git a/tests/texturing/copyteximage.c b/tests/texturing/copyteximage.c
index 3a15098..896a042 100644
--- a/tests/texturing/copyteximage.c
+++ b/tests/texturing/copyteximage.c
@@ -108,6 +108,7 @@ static const struct {
 };
 
 static int test_target = -1;
+static int test_vector = -1;
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
@@ -654,6 +655,12 @@ piglit_display(void)
 		for (i = 0; i < ARRAY_SIZE(test_vectors); i++) {
 			GLint x = IMAGE_SIZE * (i + 1);
 			GLint y = 0;
+
+			if (test_vector != -1 &&
+			    test_vector != i) {
+				continue;
+			}
+
 			expected = (const float*)test_vectors[i].expected;
 
 			if (!test_target_and_format(x, y, target[j].target,
@@ -673,11 +680,17 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
-	if (argc == 2) {
+	int c;
+
+	for (c = 1; c < argc; c++) {
+		const char *arg = argv[c];
+		bool found = false;
+
 		unsigned i;
 		for (i = 0; i < ARRAY_SIZE(target); i++) {
-			if (strcmp(target[i].name, argv[1]) == 0) {
+			if (strcmp(target[i].name, arg) == 0) {
 				test_target = i;
+				found = true;
 
 				if (!supported_target(i)) {
 					printf("Test requires OpenGL %1.1f", target[i].gl_version * 0.1);
@@ -690,13 +703,35 @@ piglit_init(int argc, char **argv)
 			}
 		}
 
-		if (test_target == -1) {
-			printf("usage: %s <target>\n", argv[0]);
+		for (i = 0; i < ARRAY_SIZE(test_vectors); i++) {
+			GLenum format = test_vectors[i].format;
+			const char *name = piglit_get_gl_enum_name(format);
+			if (strcmp(name, arg) != 0)
+				continue;
+
+			test_vector = i;
+			found = true;
+
+			if (!supported_format(format)) {
+				printf("Test requires a missing extension\n");
+				piglit_report_result(PIGLIT_SKIP);
+			}
+			break;
+		}
+
+		if (!found) {
+			printf("usage: %s [target] [format]\n", argv[0]);
 			printf("\n");
 			printf("target is one of:\n");
 			for (i = 0; i < ARRAY_SIZE(target); i++)
 				printf("    %s\n", target[i].name);
 
+			printf("format is one of:\n");
+			for (i = 0; i < ARRAY_SIZE(test_vectors); i++) {
+				GLenum format = test_vectors[i].format;
+				printf("    %s\n", piglit_get_gl_enum_name(format));
+			}
+
 			piglit_report_result(PIGLIT_FAIL);
 		}
 	}
-- 
1.8.3.rc0



More information about the Piglit mailing list