lib/debugfs: Add igt_assert_crc_equal

Because of hash collisions tests should only ever compare crc
checksums for equality. Checking for inequality can result in random
failures.

To ensure this only expose and igt_assert function and use that.
Follow-up patches will rework the code for tests which don't follow
this requirement and try to compare for CRC inequality.

v2: Rebase on top of Matt's kms_plane changes.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
This commit is contained in:
Daniel Vetter
2015-02-27 20:37:29 +01:00
parent 4fec18e5e0
commit e588f6dfa6
11 changed files with 43 additions and 23 deletions
+20 -1
View File
@@ -63,7 +63,7 @@
* another either for equality or difference. Otherwise CRCs must be treated as
* completely opaque values. Note that not even CRCs from different pipes or tap
* points on the same platform can be compared. Hence only use igt_crc_is_null()
* and igt_crc_equal() to inspect CRC values captured by the same
* and igt_assert_crc_equal() to inspect CRC values captured by the same
* #igt_pipe_crc_t object.
*
* # Other debugfs interface wrappers
@@ -234,6 +234,25 @@ bool igt_crc_equal(igt_crc_t *a, igt_crc_t *b)
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
* be random testcase failures when different screen contents end up with the
* same CRC by chance.
*/
void igt_assert_crc_equal(igt_crc_t *a, igt_crc_t *b)
{
int i;
for (i = 0; i < a->n_words; i++)
igt_assert_eq_u32(a->crc[i], b->crc[i]);
}
/**
* igt_crc_to_string:
* @crc: pipe CRC value to print
+1
View File
@@ -87,6 +87,7 @@ enum intel_pipe_crc_source {
bool igt_crc_is_null(igt_crc_t *crc);
bool igt_crc_equal(igt_crc_t *a, igt_crc_t *b);
void igt_assert_crc_equal(igt_crc_t *a, igt_crc_t *b);
char *igt_crc_to_string(igt_crc_t *crc);
void igt_require_pipe_crc(void);