tests: Remove usage of igt_crc_equal and _non_null

Tests should positively check for crc matches, not for mismatches.
Enforce this by only exposing and igt_assert function for comparing
crcs.

For the few tests which didn't just do this as consistency checks but
to do functional tests add FIXME comments that some reference crc
values are missing.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
This commit is contained in:
Daniel Vetter 2015-02-27 22:04:18 +01:00
parent e588f6dfa6
commit 562bbe12f6
6 changed files with 6 additions and 56 deletions

View File

@ -62,8 +62,8 @@
* The only way to use #igt_crc_t CRCs therefore is to compare CRCs among each
* 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_assert_crc_equal() to inspect CRC values captured by the same
* points on the same platform can be compared. Hence only use
* igt_assert_crc_equal() to inspect CRC values captured by the same
* #igt_pipe_crc_t object.
*
* # Other debugfs interface wrappers
@ -188,14 +188,7 @@ FILE *igt_debugfs_fopen(const char *filename,
* Pipe CRC
*/
/**
* igt_crc_is_null:
* @crc: pipe CRC value to check
*
* Returns: True if the CRC is null/invalid, false if it represents a captured
* valid CRC.
*/
bool igt_crc_is_null(igt_crc_t *crc)
static bool igt_crc_is_null(igt_crc_t *crc)
{
int i;
@ -211,29 +204,6 @@ bool igt_crc_is_null(igt_crc_t *crc)
return true;
}
/**
* igt_crc_equal:
* @a: first pipe CRC value
* @b: second pipe CRC value
*
* Compares two CRC values.
*
* Returns: true if the two CRCs match, false otherwise.
*/
bool igt_crc_equal(igt_crc_t *a, igt_crc_t *b)
{
int i;
if (a->n_words != b->n_words)
return false;
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

View File

@ -85,8 +85,6 @@ enum intel_pipe_crc_source {
INTEL_PIPE_CRC_SOURCE_MAX,
};
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);

View File

@ -267,11 +267,10 @@ static void test_crc(data_t *data, enum test_mode mode)
igt_pipe_crc_start(pipe_crc);
igt_pipe_crc_get_crcs(pipe_crc, 1, &crcs);
igt_pipe_crc_stop(pipe_crc);
igt_assert(!igt_crc_equal(&crcs[0], &data->ref_crc[0]));
if (mode == TEST_PAGE_FLIP)
igt_assert_crc_equal(&crcs[0], &data->ref_crc[1]);
else
igt_assert(!igt_crc_equal(&crcs[0], &data->ref_crc[1]));
;/* FIXME: missing reference CRCs */
free(crcs);
/*
@ -285,11 +284,10 @@ static void test_crc(data_t *data, enum test_mode mode)
igt_pipe_crc_start(pipe_crc);
igt_pipe_crc_get_crcs(pipe_crc, 1, &crcs);
igt_pipe_crc_stop(pipe_crc);
igt_assert(!igt_crc_equal(&crcs[0], &data->ref_crc[0]));
if (mode == TEST_PAGE_FLIP)
igt_assert_crc_equal(&crcs[0], &data->ref_crc[1]);
else
igt_assert(!igt_crc_equal(&crcs[0], &data->ref_crc[1]));
;/* FIXME: missing reference CRCs */
free(crcs);
}

View File

@ -168,18 +168,6 @@ test_read_crc_for_output(data_t *data, int pipe, igt_output_t *output,
igt_debug("CRC for this fb: %s\n", crc_str);
free(crc_str);
/*
* make sure the CRC of this fb is different from the ones of
* previous fbs
*/
for (j = 0; j < c; j++)
igt_assert(!igt_crc_equal(&colors[j].crc,
&colors[c].crc));
/* ensure the CRCs are not all 0s */
for (j = 0; j < N_CRCS; j++)
igt_assert(!igt_crc_is_null(&crcs[j]));
/* and ensure that they'are all equal, we haven't changed the fb */
for (j = 0; j < (N_CRCS - 1); j++)
igt_assert_crc_equal(&crcs[j], &crcs[j + 1]);

View File

@ -209,7 +209,7 @@ test_plane_position_with_output(data_t *data,
if (flags & TEST_POSITION_FULLY_COVERED)
igt_assert_crc_equal(&test.reference_crc, &crc);
else
igt_assert(!igt_crc_equal(&test.reference_crc, &crc));
;/* FIXME: missing reference CRCs */
igt_assert_crc_equal(&crc, &crc2);

View File

@ -75,10 +75,6 @@ static void test(data_t *data)
igt_plane_set_fb(data->primary, fb);
igt_display_commit(display);
/* sanity check to make sure crc changed */
igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
igt_assert(!igt_crc_equal(&crc, &data->ref_crc));
/* flip back the original white buffer */
igt_plane_set_fb(data->primary, &data->fb[0]);
igt_display_commit(display);