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.vet...@intel.com>
---
 lib/igt_debugfs.c          | 36 +++---------------------------------
 lib/igt_debugfs.h          |  2 --
 tests/kms_fbc_crc.c        |  6 ++----
 tests/kms_pipe_crc_basic.c | 12 ------------
 tests/kms_plane.c          |  2 +-
 tests/kms_pwrite_crc.c     |  4 ----
 6 files changed, 6 insertions(+), 56 deletions(-)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index dddd6c350b45..61313aad6ef5 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -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;
 
@@ -212,29 +205,6 @@ bool igt_crc_is_null(igt_crc_t *crc)
 }
 
 /**
- * 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
  * @b: second pipe CRC value
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index f158c3389fda..ece714863cfe 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -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);
 
diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c
index c42bab9a035f..3491d46bab79 100644
--- a/tests/kms_fbc_crc.c
+++ b/tests/kms_fbc_crc.c
@@ -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);
 }
 
diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
index 32c08671e5bf..5fc01b19d325 100644
--- a/tests/kms_pipe_crc_basic.c
+++ b/tests/kms_pipe_crc_basic.c
@@ -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]);
diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index 29f8be77626d..9acd9e662663 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -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);
 
diff --git a/tests/kms_pwrite_crc.c b/tests/kms_pwrite_crc.c
index f6adb04a39a9..758ae5abf095 100644
--- a/tests/kms_pwrite_crc.c
+++ b/tests/kms_pwrite_crc.c
@@ -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);
-- 
1.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to