kms/tests : IGT cleanup
cover kms/tests : IGT cleanup
kms/tests : IGT cleanup & added dynamic subtests
Nidhi Gupta (2):
tests/kms: IGT cleanup
tests/kms : Added dynamic test cases
tests/kms_concurrent.c | 45 ++++++++------------ tests/kms_sequence.c | 93 ++++++++++++++++++++++-------------------- 2 files changed, 66 insertions(+), 72 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/2 tests/kms: IGT cleanup
Before running the subtest we need to sanitize the system state to default, since we can't trust the state of previous subtest, used igt_display_reset() to sanitize the state.
Replace newly defined function in particular test with existing library function.
Below tests are modified:
tests/kms_concurrent.c
tests/kms_sequence.c
--- tests/kms_concurrent.c | 39 ++++++++++++++------------------------- tests/kms_sequence.c | 6 ++++-- 2 files changed, 18 insertions(+), 27 deletions(-)
tests/kms_concurrent.c +14 -25
@@ -82,7 +82,8 @@ static void test_fini(data_t *data, enum pipe pipe, int n_planes, }/* reset the constraint on the pipe */ -igt_output_set_pipe (output,PIPE_ANY ); +igt_output_set_pipe (output,PIPE_NONE ); +igt_display_commit2 (&data->display, data->display.is_atomic ?COMMIT_ATOMIC :COMMIT_LEGACY );free (data->plane); data->plane =NULL ;
@@ -289,35 +290,28 @@ test_resolution_with_output(data_t *data, enum pipe pipe, int max_planes, igt_oustatic void run_test (data_t *data,enum pipe pipe,igt_output_t *output) { -int connected_outs;int n_planes = data->display.pipes[pipe].n_planes; +igt_display_reset (&data->display);if (!opt.user_seed) opt.seed =time (NULL ); - connected_outs =0 ; -for_each_valid_output_on_pipe (&data->display, pipe, output) { -igt_info ("Testing resolution with connector %s using pipe %s with seed %d\n" , -igt_output_name (output),kmstest_pipe_name (pipe), opt.seed); +igt_info ("Testing resolution with connector %s using pipe %s with seed %d\n" , +igt_output_name (output),kmstest_pipe_name (pipe), opt.seed); -srand (opt.seed); +srand (opt.seed); -test_init (data, pipe, n_planes, output); +test_init (data, pipe, n_planes, output); - igt_fork(child, 1) { -test_plane_position_with_output (data, pipe, n_planes, output); - } - -test_resolution_with_output (data, pipe, n_planes, output); - -igt_waitchildren (); + igt_fork(child, 1) { +test_plane_position_with_output (data, pipe, n_planes, output); + } -test_fini (data, pipe, n_planes, output); +test_resolution_with_output (data, pipe, n_planes, output); - connected_outs++; - } +igt_waitchildren (); -igt_skip_on (connected_outs ==0 ); +test_fini (data, pipe, n_planes, output); } static void
@@ -326,15 +320,10 @@ run_tests_for_pipe(data_t *data, enum pipe pipe)igt_output_t *output; igt_fixture { -int valid_tests =0 ; -igt_require_pipe (&data->display, pipe);igt_require (data->display.pipes[pipe].n_planes >0 ); -for_each_valid_output_on_pipe (&data->display, pipe, output) - valid_tests++; - -igt_require_f (valid_tests,"no valid crtc/connector combinations found\n" ); +igt_display_require_output (&data->display); } igt_describe("Test atomic mode setting concurrently with multiple planes and screen "
tests/kms_sequence.c +4 -2
@@ -77,6 +77,8 @@ static void prepare_crtc(data_t *data, int fd, igt_output_t *output)igt_display_t *display = &data->display;igt_plane_t *primary; +igt_display_reset (&data->display); +/* select the pipe we want to use */ igt_output_set_pipe (output, data->pipe);
@@ -109,8 +111,8 @@ static void cleanup_crtc(data_t *data, int fd, igt_output_t *output) primary =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY );igt_plane_set_fb (primary,NULL ); -igt_output_set_pipe (output,PIPE_ANY ); -igt_display_commit (display); +igt_output_set_pipe (output,PIPE_NONE ); +igt_display_commit2 (display, display->is_atomic ?COMMIT_ATOMIC :COMMIT_LEGACY ); }static int crtc_get_sequence (int fd,struct drm_crtc_get_sequence *cgs)
Signature · 1 line
2.26.2
PATCH 2/2 tests/kms : Added dynamic test cases
In reply to Nidhi GuptaModified kms_sequence and kms_concurrent to include dynamic test cases.
--- tests/kms_concurrent.c | 6 ++- tests/kms_sequence.c | 87 +++++++++++++++++++++--------------------- 2 files changed, 48 insertions(+), 45 deletions(-)
tests/kms_concurrent.c +4 -2
@@ -328,9 +328,11 @@ run_tests_for_pipe(data_t *data, enum pipe pipe)igt_describe ("Test atomic mode setting concurrently with multiple planes and screen " "resolution." ); - igt_subtest_f("pipe-%s", kmstest_pipe_name(pipe)) + igt_subtest_with_dynamic_f("pipe-%s", kmstest_pipe_name(pipe)) {for_each_valid_output_on_pipe (&data->display, pipe, output) -run_test (data, pipe, output); + igt_dynamic_f("%s", igt_output_name(output)) +run_test (data, pipe, output); + } }static int opt_handler (int option,int option_index,void *input)
tests/kms_sequence.c +44 -43
119 lines not on this page · raw message
Signature · 1 line
2.26.2
Re: [igt-dev] [PATCH i-g-t 2/2] tests/kms : Added dynamic test cases
Quoted 50 lines · Nidhi Gupta
Modified
kms_sequenceandkms_concurrentto include dynamic test cases.Signed-off-by Nidhi Gupta <[email protected]>--- tests/kms_concurrent.c | 6 ++- tests/kms_sequence.c | 87 +++++++++++++++++++++--------------------- 2 files changed, 48 insertions(+), 45 deletions(-)tests/kms_concurrent.c +4
-2@@ -328,9 +328,11 @@ run_tests_for_pipe(data_t *data, enum pipe pipe)igt_describe ("Test atomic mode setting concurrently with multiple planes and screen " "resolution." ); - igt_subtest_f("pipe-%s", kmstest_pipe_name(pipe)) + igt_subtest_with_dynamic_f("pipe-%s", kmstest_pipe_name(pipe)) {for_each_valid_output_on_pipe (&data->display, pipe, output) -run_test (data, pipe, output); + igt_dynamic_f("%s", igt_output_name(output)) +run_test (data, pipe, output); + } }static int opt_handler (int option,int option_index,void *input)tests/kms_sequence.c +0
-14@@ -140,54 +140,46 @@ static void run_test(data_t *data, int fd, void (*testfunc)(data_t *, int, int)) {int nchildren = data->flags &FORKED ?sysconf (_SC_NPROCESSORS_ONLN) :1 ; -igt_display_t *display = &data->display;igt_output_t *output; -enum pipe p; -unsigned int valid_tests =0 ; - -for_each_pipe_with_valid_output (display, p, output) { - data->pipe = p; -prepare_crtc (data, fd, output); - -igt_info ("Beginning %s on pipe %s, connector %s (%d threads)\n" , -igt_subtest_name (), -kmstest_pipe_name (data->pipe), -igt_output_name (output), - nchildren); -
tests/kms_sequence.c static void run_test(data_t *data, int fd, void (*testfunc)(data_t *, int, int)) · line 144
Quoted 10 lines
tests/kms_sequence.c +1
-9-if (data->flags &BUSY ) { -struct drm_crtc_queue_sequence cqs; - -memset (&cqs,0 ,sizeof (cqs)); - cqs.crtc_id = data->crtc_id; - cqs.flags =DRM_CRTC_SEQUENCE_RELATIVE ; - cqs.sequence =120 +12 ; -igt_assert_eq (crtc_queue_sequence (fd, &cqs),0 ); - } + output = data->output;
Assignment can be done in definition directly.igt_output_t *output = data->output;
With above change, this patch is
- Bhanu
Quoted 94 lines
tests/kms_sequence.c +43
-20- igt_fork(child, nchildren) -testfunc (data, fd, nchildren); -igt_waitchildren (); +prepare_crtc (data, fd, output); -if (data->flags &BUSY ) { -struct drm_event_vblank buf; -igt_assert_eq (read (fd, &buf,sizeof (buf)),sizeof (buf)); - } +igt_info ("Beginning %s on pipe %s, connector %s (%d threads)\n" , +igt_subtest_name (), +kmstest_pipe_name (data->pipe), +igt_output_name (output), + nchildren); + +if (data->flags &BUSY ) { +struct drm_crtc_queue_sequence cqs; + +memset (&cqs,0 ,sizeof (cqs)); + cqs.crtc_id = data->crtc_id; + cqs.flags =DRM_CRTC_SEQUENCE_RELATIVE ; + cqs.sequence =120 +12 ; +igt_assert_eq (crtc_queue_sequence (fd, &cqs),0 ); + } -igt_assert (poll (&(struct pollfd ){fd,POLLIN },1 ,0 ) ==0 ); + igt_fork(child, nchildren) +testfunc (data, fd, nchildren); +igt_waitchildren (); -igt_info ("\n%s on pipe %s, connector %s: PASSED\n\n" , -igt_subtest_name (), -kmstest_pipe_name (data->pipe), -igt_output_name (output)); +if (data->flags &BUSY ) { +struct drm_event_vblank buf; -/* cleanup what prepare_crtc() has done */ -cleanup_crtc (data, fd, output); - valid_tests++; +igt_assert_eq (read (fd, &buf,sizeof (buf)),sizeof (buf)); } -igt_require_f (valid_tests, -"no valid crtc/connector combinations found\n" ); +igt_assert (poll (&(struct pollfd ){fd,POLLIN },1 ,0 ) ==0 ); + +igt_info ("\n%s on pipe %s, connector %s: PASSED\n\n" , +igt_subtest_name (), +kmstest_pipe_name (data->pipe), +igt_output_name (output)); + +/* cleanup what prepare_crtc() has done */ +cleanup_crtc (data, fd, output); }static void sequence_get (data_t *data,int fd,int nchildren)@@ -255,6 +247,8 @@ static void sequence_queue(data_t *data, int fd, int nchildren) igt_main {int fd; +igt_output_t *output; +enum pipe p;data_t data; const struct { const char *name;@@ -280,6 +274,7 @@ igt_main fd =drm_open_driver_master (DRIVER_ANY );kmstest_set_vt_graphics_mode ();igt_display_require (&data.display, fd); +igt_display_require_output (&data.display); }for (f = funcs; f->name; f++) {@@ -289,9 +284,15 @@ igt_mainigt_describe ("This is a test of drmCrtcGetSequence and " "drmCrtcQueueSequence" ); - igt_subtest_f("%s-%s", f->name, m->name) { - data.flags = m->flags; -run_test (&data, fd, f->func); + igt_subtest_with_dynamic_f("%s-%s", f->name, m->name) { +for_each_pipe_with_valid_output (&data.display, p, output) { + igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(p)) { + data.pipe = p; + data.output = output; + data.flags = m->flags; +run_test (&data, fd, f->func); + } + } } } }