2 * Copyright © 2011 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
27 * Standalone tests for the GLSL compiler.
29 * This file provides a standalone executable which can be used to
30 * test components of the GLSL.
32 * Each test is a function with the same signature as main(). The
33 * main function interprets its first argument as the name of the test
34 * to run, strips out that argument, and then calls the test function.
41 #include "test_optpass.h"
44 * Print proper usage and exit with failure.
47 usage_fail(const char *name
)
49 printf("*** usage: %s <command> <options>\n", name
);
51 printf("Possible commands are:\n");
52 printf(" optpass: test an optimization pass in isolation\n");
56 static const char *extract_command_from_argv(int *argc
, char **argv
)
61 const char *command
= argv
[1];
63 memmove(&argv
[1], &argv
[2], (*argc
) * sizeof(argv
[1]));
67 int main(int argc
, char **argv
)
69 const char *command
= extract_command_from_argv(&argc
, argv
);
70 if (strcmp(command
, "optpass") == 0) {
71 return test_optpass(argc
, argv
);
76 /* Execution should never reach here. */