summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>2016-03-18 17:33:03 +0000
committerMatt Roper <matthew.d.roper@intel.com>2016-03-21 11:47:22 -0700
commitc7e9be2302ab3dea289edc86b8c63e22d668fe2b (patch)
tree728220717b65a1a01146b411d5487021d5bfc5b6
parenta511310244ed82391a45a438b0d7126a8f9c974b (diff)
lib: add crc comparison function without an assert
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
-rw-r--r--lib/igt_debugfs.c17
-rw-r--r--lib/igt_debugfs.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index c291ef3b..a32ed784 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 dac84130..d08fc237 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