All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v4] igt/tests: Fix error checking in kms_atomic_transition
@ 2019-02-19  9:38 Stanislav Lisovskiy
  2019-02-19 10:12 ` [igt-dev] ✓ Fi.CI.BAT: success for igt/tests: Fix error checking in kms_atomic_transition (rev4) Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Stanislav Lisovskiy @ 2019-02-19  9:38 UTC (permalink / raw)
  To: igt-dev
  Cc: norkernel, ville.syrjala, martin.peres, stanislav.lisovskiy,
	juha-pekka.heikkila

From: Stanislav Lisovskiy <stanislav.lisovskiy@gmail.com>

There is no guarantee that error return value will be
always EINVAL, made a check more general as it can be
ERANGE, ENOSPC, EINVAL and probably others, which all
mean the same in context of this test case: i.e this sprite
size is not valid.

v2: Added macro to make check look a bit nicer.
v3: Removed redundant debug line.
v4: Added assertion if error is not EINVAL as expected,
    other errors except EINVAL are considered now a failures.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109225
Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
---
 tests/kms_atomic_transition.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 12bafe87..e1a2d4a0 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -187,6 +187,12 @@ static void set_sprite_wh(igt_display_t *display, enum pipe pipe,
 		      LOCAL_DRM_FORMAT_MOD_NONE, sprite_fb);
 }
 
+#define is_atomic_check_failure_errno(errno) \
+		(errno != -EINVAL && errno != 0)
+
+#define is_atomic_check_plane_size_errno(errno) \
+		(errno == -EINVAL)
+
 static void setup_parms(igt_display_t *display, enum pipe pipe,
 			const drmModeModeInfo *mode,
 			struct igt_fb *primary_fb,
@@ -251,8 +257,9 @@ retry:
 
 		wm_setup_plane(display, pipe, (1 << n_planes) - 1, parms, false);
 		ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+		igt_assert(!is_atomic_check_failure_errno(ret));
 
-		if (ret == -EINVAL) {
+		if (is_atomic_check_plane_size_errno(ret)) {
 			if (cursor_width == sprite_width &&
 			    cursor_height == sprite_height) {
 				igt_assert_f(alpha,
@@ -442,7 +449,9 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 			igt_pipe_request_out_fence(pipe_obj);
 
 		ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
-		if (ret != -EINVAL || pipe_obj->n_planes < 3)
+		igt_assert(!is_atomic_check_failure_errno(ret));
+
+		if (!is_atomic_check_plane_size_errno(ret) || pipe_obj->n_planes < 3)
 			break;
 
 		ret = 0;
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-04-04  8:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-19  9:38 [igt-dev] [PATCH i-g-t v4] igt/tests: Fix error checking in kms_atomic_transition Stanislav Lisovskiy
2019-02-19 10:12 ` [igt-dev] ✓ Fi.CI.BAT: success for igt/tests: Fix error checking in kms_atomic_transition (rev4) Patchwork
2019-02-19 12:18 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-02-19 21:05 ` [igt-dev] [PATCH i-g-t v4] igt/tests: Fix error checking in kms_atomic_transition Summers, Stuart
2019-03-06 12:56   ` Petri Latvala
2019-03-06 14:52     ` Lisovskiy, Stanislav
2019-04-03 14:23   ` Daniel Vetter
2019-04-04  7:33     ` Lisovskiy, Stanislav
2019-04-04  8:10       ` Daniel Vetter
2019-04-04  8:35         ` Lisovskiy, Stanislav

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.