lib/drmtest: add igt_subtest_name and use it in kms_flip

Useful when the testname is constructed with igt_subtest_f.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Daniel Vetter 2013-08-14 18:03:09 +02:00
parent b3880d3a96
commit 15c19229f4
3 changed files with 13 additions and 15 deletions

View File

@ -739,6 +739,11 @@ bool __igt_run_subtest(const char *subtest_name)
} }
} }
const char *igt_subtest_name(void)
{
return in_subtest;
}
bool igt_only_list_subtests(void) bool igt_only_list_subtests(void)
{ {
return list_subtests; return list_subtests;

View File

@ -121,6 +121,7 @@ bool __igt_run_subtest(const char *subtest_name);
#define igt_subtest(name) for (; __igt_run_subtest((name)) && \ #define igt_subtest(name) for (; __igt_run_subtest((name)) && \
(setjmp(igt_subtest_jmpbuf) == 0); \ (setjmp(igt_subtest_jmpbuf) == 0); \
igt_success()) igt_success())
const char *igt_subtest_name(void);
bool igt_only_list_subtests(void); bool igt_only_list_subtests(void);
/** /**
* igt_skip - subtest aware test skipping * igt_skip - subtest aware test skipping

View File

@ -114,7 +114,6 @@ struct event_state {
}; };
struct test_output { struct test_output {
const char *test_name;
uint32_t id; uint32_t id;
int mode_valid; int mode_valid;
drmModeModeInfo mode; drmModeModeInfo mode;
@ -988,7 +987,7 @@ static void run_test_on_crtc(struct test_output *o, int crtc_idx, int duration)
last_connector = o->connector; last_connector = o->connector;
fprintf(stdout, "Beginning %s on crtc %d, connector %d\n", fprintf(stdout, "Beginning %s on crtc %d, connector %d\n",
o->test_name, o->crtc, o->id); igt_subtest_name(), o->crtc, o->id);
o->fb_width = o->mode.hdisplay; o->fb_width = o->mode.hdisplay;
o->fb_height = o->mode.vdisplay; o->fb_height = o->mode.vdisplay;
@ -1054,7 +1053,7 @@ static void run_test_on_crtc(struct test_output *o, int crtc_idx, int duration)
check_final_state(o, &o->vblank_state, ellapsed); check_final_state(o, &o->vblank_state, ellapsed);
fprintf(stdout, "\n%s on crtc %d, connector %d: PASSED\n\n", fprintf(stdout, "\n%s on crtc %d, connector %d: PASSED\n\n",
o->test_name, o->crtc, o->id); igt_subtest_name(), o->crtc, o->id);
out: out:
kmstest_remove_fb(drm_fd, &o->fb_info[2]); kmstest_remove_fb(drm_fd, &o->fb_info[2]);
@ -1067,7 +1066,7 @@ out:
drmModeFreeConnector(o->connector); drmModeFreeConnector(o->connector);
} }
static int run_test(int duration, int flags, const char *test_name) static int run_test(int duration, int flags)
{ {
struct test_output o; struct test_output o;
int c; int c;
@ -1084,7 +1083,6 @@ static int run_test(int duration, int flags, const char *test_name)
for (c = 0; c < resources->count_connectors; c++) { for (c = 0; c < resources->count_connectors; c++) {
for (crtc_idx = 0; crtc_idx < resources->count_crtcs; crtc_idx++) { for (crtc_idx = 0; crtc_idx < resources->count_crtcs; crtc_idx++) {
memset(&o, 0, sizeof(o)); memset(&o, 0, sizeof(o));
o.test_name = test_name;
o.id = resources->connectors[c]; o.id = resources->connectors[c];
o.flags = flags; o.flags = flags;
o.flip_state.name = "flip"; o.flip_state.name = "flip";
@ -1185,26 +1183,20 @@ int main(int argc, char **argv)
} }
for (i = 0; i < sizeof(tests) / sizeof (tests[0]); i++) { for (i = 0; i < sizeof(tests) / sizeof (tests[0]); i++) {
igt_subtest(tests[i].name) { igt_subtest(tests[i].name)
run_test(tests[i].duration, tests[i].flags, tests[i].name); run_test(tests[i].duration, tests[i].flags);
}
} }
igt_fork_signal_helper(); igt_fork_signal_helper();
for (i = 0; i < sizeof(tests) / sizeof (tests[0]); i++) { for (i = 0; i < sizeof(tests) / sizeof (tests[0]); i++) {
char name[160];
snprintf(name, sizeof(name), "%s-interruptible", tests[i].name);
/* relative blocking vblank waits that get constantly interrupt /* relative blocking vblank waits that get constantly interrupt
* take forver. So don't do them. */ * take forver. So don't do them. */
if ((tests[i].flags & TEST_VBLANK_BLOCK) && if ((tests[i].flags & TEST_VBLANK_BLOCK) &&
!(tests[i].flags & TEST_VBLANK_ABSOLUTE)) !(tests[i].flags & TEST_VBLANK_ABSOLUTE))
continue; continue;
igt_subtest(name) { igt_subtest_f( "%s-interruptible", tests[i].name)
printf("running testcase: %s\n", name); run_test(tests[i].duration, tests[i].flags);
run_test(tests[i].duration, tests[i].flags, name);
}
} }
igt_stop_signal_helper(); igt_stop_signal_helper();