From patchwork Thu Mar 10 12:47:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lionel Landwerlin X-Patchwork-Id: 8557011 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 41B859F7CA for ; Thu, 10 Mar 2016 12:47:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7A3F320211 for ; Thu, 10 Mar 2016 12:47:26 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9DED82024D for ; Thu, 10 Mar 2016 12:47:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6A48E6E238; Thu, 10 Mar 2016 12:47:18 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id 303F36E235 for ; Thu, 10 Mar 2016 12:47:13 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 10 Mar 2016 04:47:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,315,1455004800"; d="scan'208";a="761612122" Received: from tcohen10-mobl3.ger.corp.intel.com (HELO ivy.ger.corp.intel.com) ([10.252.47.123]) by orsmga003.jf.intel.com with ESMTP; 10 Mar 2016 04:47:11 -0800 From: Lionel Landwerlin To: intel-gfx@lists.freedesktop.org Date: Thu, 10 Mar 2016 12:47:03 +0000 Message-Id: <1457614025-22910-5-git-send-email-lionel.g.landwerlin@intel.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1457614025-22910-1-git-send-email-lionel.g.landwerlin@intel.com> References: <1457614025-22910-1-git-send-email-lionel.g.landwerlin@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 4/6] 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