diff mbox

[i-g-t,2/2] lib/igt_core.h: add debug messages for test requirements

Message ID 1414596047-19397-2-git-send-email-thomas.wood@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Wood Oct. 29, 2014, 3:20 p.m. UTC
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 lib/igt_core.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Daniel Vetter Nov. 3, 2014, 2:22 p.m. UTC | #1
On Wed, Oct 29, 2014 at 03:20:47PM +0000, Thomas Wood wrote:
> @@ -380,6 +382,7 @@ void igt_exit(void) __attribute__((noreturn));
>   */
>  #define igt_require_f(expr, f...) do { \
>  	if (!(expr)) igt_skip_check(#expr , f); \
> +	else igt_debug("Test requirement passed: "#expr"\n"); \
>  } while (0)
>  
>  /**
> @@ -398,6 +401,7 @@ void igt_exit(void) __attribute__((noreturn));
>   */
>  #define igt_skip_on_f(expr, f...) do { \
>  	if ((expr)) igt_skip_check("!("#expr")", f); \
> +	else igt_debug("Test requirement passed: !("#expr")\n"); \

Hm, for the the _f variants, should we also print the format string? Often
I use that one when it's not clear what precise requirement failed from
the test alone. Or is the resulting output too confusing?
-Daniel
diff mbox

Patch

diff --git a/lib/igt_core.h b/lib/igt_core.h
index 5318c5e..f7a92ce 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -199,7 +199,7 @@  void __igt_skip_check(const char *file, const int line,
 		      const char *func, const char *check,
 		      const char *format, ...) __attribute__((noreturn));
 #define igt_skip_check(E, F...) \
-	__igt_skip_check(__FILE__, __LINE__, __func__, E, F);
+	__igt_skip_check(__FILE__, __LINE__, __func__, E, F)
 void igt_success(void);
 
 void igt_fail(int exitcode) __attribute__((noreturn));
@@ -348,6 +348,7 @@  void igt_exit(void) __attribute__((noreturn));
  */
 #define igt_require(expr) do { \
 	if (!(expr)) igt_skip_check(#expr , NULL); \
+	else igt_debug("Test requirement passed: "#expr"\n"); \
 } while (0)
 
 /**
@@ -362,6 +363,7 @@  void igt_exit(void) __attribute__((noreturn));
  */
 #define igt_skip_on(expr) do { \
 	if ((expr)) igt_skip_check("!(" #expr ")" , NULL); \
+	else igt_debug("Test requirement passed: !("#expr")\n"); \
 } while (0)
 
 /**
@@ -380,6 +382,7 @@  void igt_exit(void) __attribute__((noreturn));
  */
 #define igt_require_f(expr, f...) do { \
 	if (!(expr)) igt_skip_check(#expr , f); \
+	else igt_debug("Test requirement passed: "#expr"\n"); \
 } while (0)
 
 /**
@@ -398,6 +401,7 @@  void igt_exit(void) __attribute__((noreturn));
  */
 #define igt_skip_on_f(expr, f...) do { \
 	if ((expr)) igt_skip_check("!("#expr")", f); \
+	else igt_debug("Test requirement passed: !("#expr")\n"); \
 } while (0)
 
 /* fork support code */