summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatt Roper <matthew.d.roper@intel.com>2019-02-20 16:34:21 -0800
committerVille Syrjälä <ville.syrjala@linux.intel.com>2019-07-03 15:49:55 +0300
commit6ccba39a4395a5bf92add495ab77d3973e05dd2b (patch)
tree3c228eec305aab0b023ccf7e3c9f957ad5efec55 /lib
parentd255249d3d2a16edf66d90b8e889270ceb8bb9b9 (diff)
lib: Add --skip-crc-compare option
When using --interactive-debug, it's sometimes desirable to ignore CRC mismatches and let the test proceed as if they passed so that the on-screen outcome can be inspected. Let's add a debug option to allow this. Cc: igt-dev@lists.freedesktop.org Signed-off-by: Matt Roper <matthew.d.roper@intel.com> [vsyrjala: pimp the debug message to indicate the skip] Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_core.c7
-rw-r--r--lib/igt_core.h1
-rw-r--r--lib/igt_debugfs.c13
3 files changed, 18 insertions, 3 deletions
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 6b9f0425..4c5f4dd5 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -256,6 +256,7 @@
static unsigned int exit_handler_count;
const char *igt_interactive_debug;
+bool igt_skip_crc_compare;
/* subtests helpers */
static bool list_subtests = false;
@@ -289,6 +290,7 @@ enum {
OPT_DESCRIPTION,
OPT_DEBUG,
OPT_INTERACTIVE_DEBUG,
+ OPT_SKIP_CRC,
OPT_HELP = 'h'
};
@@ -557,6 +559,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
" --run-subtest <pattern>\n"
" --debug[=log-domain]\n"
" --interactive-debug[=domain]\n"
+ " --skip-crc-compare\n"
" --help-description\n"
" --help|-h\n");
if (help_str)
@@ -675,6 +678,7 @@ static int common_init(int *argc, char **argv,
{"help-description", no_argument, NULL, OPT_DESCRIPTION},
{"debug", optional_argument, NULL, OPT_DEBUG},
{"interactive-debug", optional_argument, NULL, OPT_INTERACTIVE_DEBUG},
+ {"skip-crc-compare", no_argument, NULL, OPT_SKIP_CRC},
{"help", no_argument, NULL, OPT_HELP},
{0, 0, 0, 0}
};
@@ -786,6 +790,9 @@ static int common_init(int *argc, char **argv,
print_test_description();
ret = -1;
goto out;
+ case OPT_SKIP_CRC:
+ igt_skip_crc_compare = true;
+ goto out;
case OPT_HELP:
print_usage(help_str, false);
ret = -1;
diff --git a/lib/igt_core.h b/lib/igt_core.h
index 88a95ec2..101518f2 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -877,6 +877,7 @@ bool igt_run_in_simulation(void);
void igt_skip_on_simulation(void);
extern const char *igt_interactive_debug;
+extern bool igt_skip_crc_compare;
/**
* igt_log_level:
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 82ce1834..676884c8 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -405,6 +405,12 @@ static bool igt_find_crc_mismatch(const igt_crc_t *a, const igt_crc_t *b,
* 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.
+ *
+ * Passing --skip-crc-compare on the command line will force this function
+ * to always pass, which can be useful in interactive debugging where you
+ * might know the test will fail, but still want the test to keep going as if
+ * it had succeeded so that you can see the on-screen behavior.
+ *
*/
void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b)
{
@@ -413,10 +419,11 @@ void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b)
mismatch = igt_find_crc_mismatch(a, b, &index);
if (mismatch)
- igt_debug("CRC mismatch at index %d: 0x%x != 0x%x\n", index,
- a->crc[index], b->crc[index]);
+ igt_debug("CRC mismatch%s at index %d: 0x%x != 0x%x\n",
+ igt_skip_crc_compare ? " (ignored)" : "",
+ index, a->crc[index], b->crc[index]);
- igt_assert(!mismatch);
+ igt_assert(!mismatch || igt_skip_crc_compare);
}
/**