From patchwork Mon Nov 2 17:25:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 7537691 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BDACF9F71A for ; Mon, 2 Nov 2015 17:36:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F1E9820416 for ; Mon, 2 Nov 2015 17:36:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2311A203AB for ; Mon, 2 Nov 2015 17:36:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 13E6F6E338; Mon, 2 Nov 2015 09:36:07 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id 325C26E502 for ; Mon, 2 Nov 2015 09:35:56 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 02 Nov 2015 09:35:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,234,1444719600"; d="scan'208";a="592647839" Received: from otc-vmt1.isw.intel.com ([10.237.224.80]) by FMSMGA003.fm.intel.com with ESMTP; 02 Nov 2015 09:35:56 -0800 From: Thomas Wood To: intel-gfx@lists.freedesktop.org Date: Mon, 2 Nov 2015 17:25:33 +0000 Message-Id: <1446485133-13529-5-git-send-email-thomas.wood@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446485133-13529-1-git-send-email-thomas.wood@intel.com> References: <1446485133-13529-1-git-send-email-thomas.wood@intel.com> Organization: Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ Subject: [Intel-gfx] [PATCH i-g-t 5/5] tests/kms_force_connector: use comparison macros X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use the comparison macros to make debug output clearer. v2: fix incorrect comparison Signed-off-by: Thomas Wood --- 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 2cb149a..f34f21a 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); static void __attribute__((noreturn)) reset_connectors() { @@ -107,8 +108,8 @@ int main(int argc, char **argv) /* 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 */ @@ -122,15 +123,15 @@ int main(int argc, char **argv) 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_eq(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); } @@ -160,7 +161,7 @@ int main(int argc, char **argv) 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,