From patchwork Fri Feb 19 15:46:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lionel Landwerlin X-Patchwork-Id: 8362311 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 C23F59F372 for ; Fri, 19 Feb 2016 15:46:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F0CA3203ED for ; Fri, 19 Feb 2016 15:46:37 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 1C87D203C0 for ; Fri, 19 Feb 2016 15:46:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E944E6EFBA; Fri, 19 Feb 2016 15:46:33 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id 488C26EFB9 for ; Fri, 19 Feb 2016 15:46:28 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP; 19 Feb 2016 07:46:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,471,1449561600"; d="scan'208";a="50945820" Received: from pnogax-mobl.ger.corp.intel.com (HELO ivy.ger.corp.intel.com) ([10.252.60.226]) by fmsmga004.fm.intel.com with ESMTP; 19 Feb 2016 07:46:21 -0800 From: Lionel Landwerlin To: intel-gfx@lists.freedesktop.org Date: Fri, 19 Feb 2016 15:46:13 +0000 Message-Id: <1455896774-18259-5-git-send-email-lionel.g.landwerlin@intel.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1455896774-18259-1-git-send-email-lionel.g.landwerlin@intel.com> References: <1455896774-18259-1-git-send-email-lionel.g.landwerlin@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 4/5] lib: add crc comparison function without an assert 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, 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 Signed-off-by: Lionel Landwerlin --- lib/igt_debugfs.c | 17 +++++++++++++++++ lib/igt_debugfs.h | 1 + 2 files changed, 18 insertions(+) diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c index c291ef3..a32ed78 100644 --- a/lib/igt_debugfs.c +++ b/lib/igt_debugfs.c @@ -252,6 +252,23 @@ bool igt_debugfs_search(const char *filename, const char *substring) * @a: first pipe CRC value * @b: second pipe CRC value * + * Compares two CRC values. + */ +bool igt_crc_equal(igt_crc_t *a, igt_crc_t *b) +{ + int i; + + for (i = 0; i < a->n_words; i++) + if (a->crc[i] != b->crc[i]) + return false; + return true; +} + +/** + * igt_assert_crc_equal: + * @a: first pipe CRC value + * @b: second pipe CRC value + * * Compares two CRC values and fails the testcase if they don't match with * igt_fail(). Note that due to CRC collisions CRC based testcase can only * assert that CRCs match, never that they are different. Otherwise there might diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h index dac8413..d08fc23 100644 --- a/lib/igt_debugfs.h +++ b/lib/igt_debugfs.h @@ -124,6 +124,7 @@ __attribute__((warn_unused_result)) int igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs, igt_crc_t **out_crcs); void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc); +bool igt_crc_equal(igt_crc_t *a, igt_crc_t *b); /* * Drop caches