summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-03-10 14:04:07 -0700
committerBrian Paul <brianp@vmware.com>2010-03-10 14:04:09 -0700
commit3174cbe4912e73b97f308f6d2771e6b46c570c03 (patch)
tree72182e56d949e1421d4dd0c9397b6b2f0e7205e0
parentbe6a60f0dae53c0e79c34ef5e5fd7088832a8c88 (diff)
piglit: be smarter about finding/removing -auto from argv
This lets us pass additional args into piglit tests without having to worry about their order.
-rw-r--r--tests/util/piglit-framework.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/tests/util/piglit-framework.c b/tests/util/piglit-framework.c
index ee8d6f181..8dddcf960 100644
--- a/tests/util/piglit-framework.c
+++ b/tests/util/piglit-framework.c
@@ -60,18 +60,24 @@ reshape(int w, int h)
int main(int argc, char *argv[])
{
+ int j;
+
glutInit(&argc, argv);
- if (argc >= 2 && !strcmp(argv[1], "-auto")) {
- int i;
- piglit_automatic = 1;
+ /* Find/remove "-auto" from the argument vector.
+ */
+ for (j = 1; j < argc; j++) {
+ if (!strcmp(argv[j], "-auto")) {
+ int i;
+
+ piglit_automatic = 1;
- /* Remove "-auto" from the argument vector.
- */
- for (i = 2; i < argc; i++) {
- argv[i - 1] = argv[i];
+ for (i = j + 1; i < argc; i++) {
+ argv[i - 1] = argv[i];
+ }
+ argc--;
+ j--;
}
- argc--;
}
glutInitWindowPosition(0, 0);
glutInitWindowSize(piglit_width, piglit_height);