diff mbox

[i-g-t,1/8] kms_force_connector: use comparison macros to make debug output clearer

Message ID 1446464924-20878-1-git-send-email-thomas.wood@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Wood Nov. 2, 2015, 11:48 a.m. UTC
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 tests/kms_force_connector.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

Comments

Thomas Wood Nov. 2, 2015, 5:13 p.m. UTC | #1
On 2 November 2015 at 11:48, Thomas Wood <thomas.wood@intel.com> wrote:
> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
> ---
>  tests/kms_force_connector.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/tests/kms_force_connector.c b/tests/kms_force_connector.c
> index 7485ca8..4ba1e0b 100644
> --- a/tests/kms_force_connector.c
> +++ b/tests/kms_force_connector.c
> @@ -27,8 +27,9 @@
>  IGT_TEST_DESCRIPTION("Check the debugfs force connector/edid features work"
>                      " correctly.");
>
> -#define CHECK_MODE(m, h, w, r) igt_assert(m.hdisplay == h && m.vdisplay == w \
> -                                         && m.vrefresh == r)
> +#define CHECK_MODE(m, h, w, r) \
> +       igt_assert_eq(m.hdisplay, h); igt_assert_eq(m.vdisplay, w); \
> +       igt_assert_eq(m.vrefresh, r);
>
>  igt_main
>  {
> @@ -63,8 +64,8 @@ igt_main
>                 /* force the connector on and check the reported values */
>                 kmstest_force_connector(drm_fd, vga_connector, FORCE_CONNECTOR_ON);
>                 temp = drmModeGetConnector(drm_fd, vga_connector->connector_id);
> -               igt_assert(temp->connection == DRM_MODE_CONNECTED);
> -               igt_assert(temp->count_modes > 0);
> +               igt_assert_eq(temp->connection, DRM_MODE_CONNECTED);
> +               igt_assert_lt(0, temp->count_modes);
>                 drmModeFreeConnector(temp);
>
>                 /* attempt to use the display */
> @@ -77,15 +78,15 @@ igt_main
>                 kmstest_force_connector(drm_fd, vga_connector,
>                                         FORCE_CONNECTOR_OFF);
>                 temp = drmModeGetConnector(drm_fd, vga_connector->connector_id);
> -               igt_assert(temp->connection == DRM_MODE_DISCONNECTED);
> -               igt_assert(temp->count_modes == 0);
> +               igt_assert_eq(temp->connection, DRM_MODE_DISCONNECTED);
> +               igt_assert_lt(0, temp->count_modes);

This should have been igt_assert_eq.


>                 drmModeFreeConnector(temp);
>
>                 /* check that the previous state is restored */
>                 kmstest_force_connector(drm_fd, vga_connector,
>                                         FORCE_CONNECTOR_UNSPECIFIED);
>                 temp = drmModeGetConnector(drm_fd, vga_connector->connector_id);
> -               igt_assert(temp->connection == vga_connector->connection);
> +               igt_assert_eq(temp->connection, vga_connector->connection);
>                 drmModeFreeConnector(temp);
>         }
>
> @@ -115,7 +116,7 @@ igt_main
>                 temp = drmModeGetConnector(drm_fd, vga_connector->connector_id);
>                 /* the connector should now have the same number of modes that
>                  * it started with */
> -               igt_assert(temp->count_modes == start_n_modes);
> +               igt_assert_eq(temp->count_modes, start_n_modes);
>                 drmModeFreeConnector(temp);
>
>                 kmstest_force_connector(drm_fd, vga_connector,
> --
> 1.9.1
>
diff mbox

Patch

diff --git a/tests/kms_force_connector.c b/tests/kms_force_connector.c
index 7485ca8..4ba1e0b 100644
--- a/tests/kms_force_connector.c
+++ b/tests/kms_force_connector.c
@@ -27,8 +27,9 @@ 
 IGT_TEST_DESCRIPTION("Check the debugfs force connector/edid features work"
 		     " correctly.");
 
-#define CHECK_MODE(m, h, w, r) igt_assert(m.hdisplay == h && m.vdisplay == w \
-					  && m.vrefresh == r)
+#define CHECK_MODE(m, h, w, r) \
+	igt_assert_eq(m.hdisplay, h); igt_assert_eq(m.vdisplay, w); \
+	igt_assert_eq(m.vrefresh, r);
 
 igt_main
 {
@@ -63,8 +64,8 @@  igt_main
 		/* force the connector on and check the reported values */
 		kmstest_force_connector(drm_fd, vga_connector, FORCE_CONNECTOR_ON);
 		temp = drmModeGetConnector(drm_fd, vga_connector->connector_id);
-		igt_assert(temp->connection == DRM_MODE_CONNECTED);
-		igt_assert(temp->count_modes > 0);
+		igt_assert_eq(temp->connection, DRM_MODE_CONNECTED);
+		igt_assert_lt(0, temp->count_modes);
 		drmModeFreeConnector(temp);
 
 		/* attempt to use the display */
@@ -77,15 +78,15 @@  igt_main
 		kmstest_force_connector(drm_fd, vga_connector,
 					FORCE_CONNECTOR_OFF);
 		temp = drmModeGetConnector(drm_fd, vga_connector->connector_id);
-		igt_assert(temp->connection == DRM_MODE_DISCONNECTED);
-		igt_assert(temp->count_modes == 0);
+		igt_assert_eq(temp->connection, DRM_MODE_DISCONNECTED);
+		igt_assert_lt(0, temp->count_modes);
 		drmModeFreeConnector(temp);
 
 		/* check that the previous state is restored */
 		kmstest_force_connector(drm_fd, vga_connector,
 					FORCE_CONNECTOR_UNSPECIFIED);
 		temp = drmModeGetConnector(drm_fd, vga_connector->connector_id);
-		igt_assert(temp->connection == vga_connector->connection);
+		igt_assert_eq(temp->connection, vga_connector->connection);
 		drmModeFreeConnector(temp);
 	}
 
@@ -115,7 +116,7 @@  igt_main
 		temp = drmModeGetConnector(drm_fd, vga_connector->connector_id);
 		/* the connector should now have the same number of modes that
 		 * it started with */
-		igt_assert(temp->count_modes == start_n_modes);
+		igt_assert_eq(temp->count_modes, start_n_modes);
 		drmModeFreeConnector(temp);
 
 		kmstest_force_connector(drm_fd, vga_connector,