From patchwork Thu Feb 25 17:16:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lionel Landwerlin X-Patchwork-Id: 8425351 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 D98A99F372 for ; Thu, 25 Feb 2016 17:17:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C049D2011D for ; Thu, 25 Feb 2016 17:17:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D865120253 for ; Thu, 25 Feb 2016 17:17:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 80AA16E92C; Thu, 25 Feb 2016 17:17:06 +0000 (UTC) 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 1ADF66E92C for ; Thu, 25 Feb 2016 17:17:05 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP; 25 Feb 2016 09:16:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,498,1449561600"; d="scan'208";a="54733969" Received: from sthoene-mobl.ger.corp.intel.com (HELO ivy.ger.corp.intel.com) ([10.252.33.122]) by fmsmga004.fm.intel.com with ESMTP; 25 Feb 2016 09:16:53 -0800 From: Lionel Landwerlin To: intel-gfx@lists.freedesktop.org Date: Thu, 25 Feb 2016 17:16:12 +0000 Message-Id: <1456420573-4693-5-git-send-email-lionel.g.landwerlin@intel.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1456420573-4693-1-git-send-email-lionel.g.landwerlin@intel.com> References: <1456420573-4693-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=-1.9 required=5.0 tests=BAYES_00, 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