lib: Add argc/argv to igt_simple_init

There's a pile of ideas around to add generally useful options like
--debug to all igt tests. Or unify the runtime behaviour between
simple and subtest tests a bit more.

The first step to get there is to add argc/argv to igt_simple_init so
that we can get at the argument list.

Cc: Tim Gore <tim.gore@intel.com>
Cc: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Daniel Vetter 2014-07-14 14:42:23 +02:00
parent c7be53c7cb
commit 5a98fe9d4a
18 changed files with 21 additions and 24 deletions

View File

@ -451,6 +451,8 @@ void igt_subtest_init(int argc, char **argv)
/** /**
* igt_simple_init: * igt_simple_init:
* @argc: argc from the test's main()
* @argv: argv from the test's main()
* *
* This initializes a simple test without any support for subtests. * This initializes a simple test without any support for subtests.
* *
@ -458,7 +460,7 @@ void igt_subtest_init(int argc, char **argv)
* #igt_simple_main block instead of stitching the tests's main() function together * #igt_simple_main block instead of stitching the tests's main() function together
* manually. * manually.
*/ */
void igt_simple_init(void) void igt_simple_init(int argc, char **argv)
{ {
print_version(); print_version();

View File

@ -161,12 +161,7 @@ bool igt_only_list_subtests(void);
} \ } \
static void igt_tokencat(__real_main, __LINE__)(void) \ static void igt_tokencat(__real_main, __LINE__)(void) \
/** void igt_simple_init(int argc, char **argv);
* igt_simple_init:
*
* Init for simple tests without subtests
*/
void igt_simple_init(void);
/** /**
* igt_simple_main: * igt_simple_main:
@ -178,7 +173,7 @@ void igt_simple_init(void);
#define igt_simple_main \ #define igt_simple_main \
static void igt_tokencat(__real_main, __LINE__)(void); \ static void igt_tokencat(__real_main, __LINE__)(void); \
int main(int argc, char **argv) { \ int main(int argc, char **argv) { \
igt_simple_init(); \ igt_simple_init(argc, argv); \
igt_tokencat(__real_main, __LINE__)(); \ igt_tokencat(__real_main, __LINE__)(); \
exit(0); \ exit(0); \
} \ } \

View File

@ -149,7 +149,7 @@ int main(int argc, char *argv[])
{ {
int i; int i;
igt_simple_init(); igt_simple_init(argc, argv);
fd = drm_open_any_render(); fd = drm_open_any_render();
devid = intel_get_drm_devid(fd); devid = intel_get_drm_devid(fd);

View File

@ -257,7 +257,7 @@ int main(int argc, char **argv)
{ {
int i; int i;
igt_simple_init(); igt_simple_init(argc, argv);
igt_skip_on_simulation(); igt_skip_on_simulation();

View File

@ -59,7 +59,7 @@ int main(int argc, char **argv)
int loop, i, tiling; int loop, i, tiling;
int fd; int fd;
igt_simple_init(); igt_simple_init(argc, argv);
igt_skip_on_simulation(); igt_skip_on_simulation();

View File

@ -72,7 +72,7 @@ int main(int argc, char **argv)
{ {
int fd; int fd;
igt_simple_init(); igt_simple_init(argc, argv);
igt_assert_f(argc == 2, igt_assert_f(argc == 2,
"usage: %s <disabled pipe number>\n", "usage: %s <disabled pipe number>\n",

View File

@ -127,7 +127,7 @@ int main(int argc, char **argv)
int opt_dump_png = false; int opt_dump_png = false;
int opt_dump_aub = igt_aub_dump_enabled(); int opt_dump_aub = igt_aub_dump_enabled();
igt_simple_init(); igt_simple_init(argc, argv);
while ((opt = getopt(argc, argv, "d")) != -1) { while ((opt = getopt(argc, argv, "d")) != -1) {
switch (opt) { switch (opt) {

View File

@ -90,7 +90,7 @@ int main(int argc, char **argv)
uint32_t start = 0; uint32_t start = 0;
int i, j, fd, count; int i, j, fd, count;
igt_simple_init(); igt_simple_init(argc, argv);
fd = drm_open_any(); fd = drm_open_any();

View File

@ -105,7 +105,7 @@ int main(int argc, char **argv)
int i, j, fd, count; int i, j, fd, count;
uint32_t devid; uint32_t devid;
igt_simple_init(); igt_simple_init(argc, argv);
igt_skip_on_simulation(); igt_skip_on_simulation();

View File

@ -538,7 +538,7 @@ int main(int argc, char **argv)
int wcount = 0; int wcount = 0;
int r = -1; int r = -1;
igt_simple_init(); igt_simple_init(argc, argv);
parse_options(argc, argv); parse_options(argc, argv);

View File

@ -865,7 +865,7 @@ int main(int argc, char **argv)
int i, j; int i, j;
unsigned *current_permutation, *tmp_permutation; unsigned *current_permutation, *tmp_permutation;
igt_simple_init(); igt_simple_init(argc, argv);
drm_fd = drm_open_any(); drm_fd = drm_open_any();
devid = intel_get_drm_devid(drm_fd); devid = intel_get_drm_devid(drm_fd);

View File

@ -463,7 +463,7 @@ int main(int argc, char **argv)
uint32_t start = 0; uint32_t start = 0;
int i, fd, count; int i, fd, count;
igt_simple_init(); igt_simple_init(argc, argv);
fd = drm_open_any(); fd = drm_open_any();

View File

@ -331,7 +331,7 @@ int main(int argc, char **argv)
uint32_t start = 0; uint32_t start = 0;
int i, fd, count; int i, fd, count;
igt_simple_init(); igt_simple_init(argc, argv);
fd = drm_open_any(); fd = drm_open_any();

View File

@ -351,7 +351,7 @@ int main(int argc, char **argv)
uint32_t start = 0; uint32_t start = 0;
int i, fd, count; int i, fd, count;
igt_simple_init(); igt_simple_init(argc, argv);
fd = drm_open_any(); fd = drm_open_any();

View File

@ -338,7 +338,7 @@ int main(int argc, char **argv)
uint32_t start = 0; uint32_t start = 0;
int i, fd, count; int i, fd, count;
igt_simple_init(); igt_simple_init(argc, argv);
fd = drm_open_any(); fd = drm_open_any();

View File

@ -338,7 +338,7 @@ int main(int argc, char **argv)
uint32_t start = 0; uint32_t start = 0;
int i, fd, count; int i, fd, count;
igt_simple_init(); igt_simple_init(argc, argv);
fd = drm_open_any(); fd = drm_open_any();

View File

@ -53,7 +53,7 @@ static int do_fork(void)
assert(0); assert(0);
case 0: case 0:
if (simple) { if (simple) {
igt_simple_init(); igt_simple_init(1, argv_run);
igt_skip_on_simulation(); igt_skip_on_simulation();

View File

@ -36,7 +36,7 @@ main (int argc, char **argv)
drmModeConnector *connector, *temp; drmModeConnector *connector, *temp;
igt_display_t display; igt_display_t display;
igt_simple_init(); igt_simple_init(argc, argv);
drm_fd = drm_open_any(); drm_fd = drm_open_any();
res = drmModeGetResources(drm_fd); res = drmModeGetResources(drm_fd);