diff mbox

[IGT,v2,1/6] tests/kms_psr_sink_crc: Change assert_or_manual() to a macro

Message ID 1498849944-26404-2-git-send-email-jim.bride@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

jim.bride@linux.intel.com June 30, 2017, 7:12 p.m. UTC
Make assert_or_manual() a macro so that we get accurate line number
information when this assertion fails.

v2: Rebase

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Jim Bride <jim.bride@linux.intel.com>
---
 tests/kms_psr_sink_crc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Rodrigo Vivi June 30, 2017, 7:55 p.m. UTC | #1
oh! at least one good reason why igt is full of macros! :(

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>


On Fri, Jun 30, 2017 at 12:12 PM, Jim Bride <jim.bride@linux.intel.com> wrote:
> Make assert_or_manual() a macro so that we get accurate line number
> information when this assertion fails.
>
> v2: Rebase
>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
> Signed-off-by: Jim Bride <jim.bride@linux.intel.com>
> ---
>  tests/kms_psr_sink_crc.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
> index bd3fa5e..1a03719 100644
> --- a/tests/kms_psr_sink_crc.c
> +++ b/tests/kms_psr_sink_crc.c
> @@ -278,11 +278,11 @@ static bool is_green(char *crc)
>                 (bh & mask) == 0);
>  }
>
> -static void assert_or_manual(bool condition, const char *expected)
> -{
> -       igt_debug_manual_check("no-crc", expected);
> -       igt_assert(igt_interactive_debug || condition);
> -}
> +#define assert_or_manual(condition, expected)             \
> +do {                                                      \
> +       igt_debug_manual_check("no-crc", expected);       \
> +       igt_assert(igt_interactive_debug || condition);   \
> +} while (0)
>
>  static void run_test(data_t *data)
>  {
> --
> 2.7.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index bd3fa5e..1a03719 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -278,11 +278,11 @@  static bool is_green(char *crc)
 		(bh & mask) == 0);
 }
 
-static void assert_or_manual(bool condition, const char *expected)
-{
-	igt_debug_manual_check("no-crc", expected);
-	igt_assert(igt_interactive_debug || condition);
-}
+#define assert_or_manual(condition, expected)             \
+do {                                                      \
+	igt_debug_manual_check("no-crc", expected);       \
+	igt_assert(igt_interactive_debug || condition);   \
+} while (0)
 
 static void run_test(data_t *data)
 {