[Piglit] [PATCH 1/2] copyteximage: Add a usage message when we fail to parse an argument.

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


I was trying some likely values as the arg that didn't work, so I
fixed it to error out nicely.
---
 tests/texturing/copyteximage.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tests/texturing/copyteximage.c b/tests/texturing/copyteximage.c
index 432ebbc..3a15098 100644
--- a/tests/texturing/copyteximage.c
+++ b/tests/texturing/copyteximage.c
@@ -689,6 +689,16 @@ piglit_init(int argc, char **argv)
 				break;
 			}
 		}
+
+		if (test_target == -1) {
+			printf("usage: %s <target>\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);
+
+			piglit_report_result(PIGLIT_FAIL);
+		}
 	}
 
 	glClearColor(0.0, 0.0, 0.0, 1.0);
-- 
1.8.3.rc0



More information about the Piglit mailing list