diff mbox

[kvm-unit-tests,1/5] lib: print failing assert cond

Message ID 1456867658-10937-2-git-send-email-pfeiner@google.com (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Feiner March 1, 2016, 9:27 p.m. UTC
Signed-off-by: Peter Feiner <pfeiner@google.com>
---
 lib/libcflat.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Andrew Jones March 2, 2016, 3:04 p.m. UTC | #1
On Tue, Mar 01, 2016 at 01:27:34PM -0800, Peter Feiner wrote:
> Signed-off-by: Peter Feiner <pfeiner@google.com>

Reviewed-by: Andrew Jones <drjones@redhat.com>

> ---
>  lib/libcflat.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/libcflat.h b/lib/libcflat.h
> index 39100f2..1f0049c 100644
> --- a/lib/libcflat.h
> +++ b/lib/libcflat.h
> @@ -74,7 +74,8 @@ extern int report_summary(void);
>  #define assert(cond)							\
>  do {									\
>  	if (!(cond))							\
> -		printf("%s:%d: assert failed\n", __FILE__, __LINE__),	\
> +		printf("%s:%d: assert failed: %s\n",			\
> +		       __FILE__, __LINE__, #cond),			\
>  		abort();						\
>  } while (0)
>  
> -- 
> 2.7.0.rc3.207.g0ac5344
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/lib/libcflat.h b/lib/libcflat.h
index 39100f2..1f0049c 100644
--- a/lib/libcflat.h
+++ b/lib/libcflat.h
@@ -74,7 +74,8 @@  extern int report_summary(void);
 #define assert(cond)							\
 do {									\
 	if (!(cond))							\
-		printf("%s:%d: assert failed\n", __FILE__, __LINE__),	\
+		printf("%s:%d: assert failed: %s\n",			\
+		       __FILE__, __LINE__, #cond),			\
 		abort();						\
 } while (0)