From 6903ab04e5f9048e3932eb3225e94b6a228681ba Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Fri, 13 Jun 2014 11:06:18 +0200 Subject: [PATCH] tests: Run igt.cocci over tests Cocci is awesome Signed-off-by: Daniel Vetter --- tests/drv_hangman.c | 14 ++++---------- tests/kms_psr_sink_crc.c | 4 ++-- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/tests/drv_hangman.c b/tests/drv_hangman.c index d74ed483..667491ba 100644 --- a/tests/drv_hangman.c +++ b/tests/drv_hangman.c @@ -118,17 +118,11 @@ static void _assert_dfs_entry(const char *fname, const char *s, bool inverse) read_dfs(fname, tmp, l + 1); if (!inverse) { - if (strncmp(tmp, s, l) != 0) { - fprintf(stderr, "contents of %s: '%s' (expected '%s')\n", - fname, tmp, s); - igt_fail(1); - } + igt_assert_f(strncmp(tmp, s, l) != 0, + "contents of %s: '%s' (expected '%s')\n", fname, tmp, s); } else { - if (strncmp(tmp, s, l) == 0) { - fprintf(stderr, "contents of %s: '%s' (expected not '%s'\n", - fname, tmp, s); - igt_fail(1); - } + igt_assert_f(strncmp(tmp, s, l) == 0, + "contents of %s: '%s' (expected not '%s'\n", fname, tmp, s); } } diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c index 999a0bfd..a36ae6c1 100644 --- a/tests/kms_psr_sink_crc.c +++ b/tests/kms_psr_sink_crc.c @@ -269,8 +269,8 @@ static bool psr_sink_support(data_t *data) igt_require(file); ret = fscanf(file, "Sink_Support: %s\n", str); - if (ret == 0) - igt_skip("i915_edp_psr_status format not supported by this test case\n"); + igt_skip_on_f(ret == 0, + "i915_edp_psr_status format not supported by this test case\n"); fclose(file); return strcmp(str, "yes") == 0;