diff options
author | Brian Paul <brianp@vmware.com> | 2010-03-10 14:04:07 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2010-03-10 14:04:09 -0700 |
commit | 3174cbe4912e73b97f308f6d2771e6b46c570c03 (patch) | |
tree | 72182e56d949e1421d4dd0c9397b6b2f0e7205e0 | |
parent | be6a60f0dae53c0e79c34ef5e5fd7088832a8c88 (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.c | 22 |
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); |