public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Janis Schoetterl-Glausch <scgl@linux.ibm.com>, kvm@vger.kernel.org
Subject: [kvm-unit-tests PATCH v2 3/5] lib: Introduce report_pass and report_fail
Date: Tue,  5 Oct 2021 11:09:19 +0200	[thread overview]
Message-ID: <20211005090921.1816373-4-scgl@linux.ibm.com> (raw)
In-Reply-To: <20211005090921.1816373-1-scgl@linux.ibm.com>

These functions can be used instead of report(1/true/0/false, ...)
and read a bit nicer.

Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
---
There is probably a better name than report_passed() for the function
without a message...

 lib/libcflat.h |  6 +++++-
 lib/report.c   | 20 +++++++++++++++++++-
 x86/vmx.h      |  6 +++---
 3 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/lib/libcflat.h b/lib/libcflat.h
index 39f4552..9bb7e08 100644
--- a/lib/libcflat.h
+++ b/lib/libcflat.h
@@ -106,7 +106,11 @@ extern void report_skip(const char *msg_fmt, ...)
 					__attribute__((format(printf, 1, 2)));
 extern void report_info(const char *msg_fmt, ...)
 					__attribute__((format(printf, 1, 2)));
-extern void report_pass(void);
+extern void report_pass(const char *msg_fmt, ...)
+					__attribute__((format(printf, 1, 2)));
+extern void report_fail(const char *msg_fmt, ...)
+					__attribute__((format(printf, 1, 2)));
+extern void report_passed(void);
 extern int report_summary(void);
 
 bool simple_glob(const char *text, const char *pattern);
diff --git a/lib/report.c b/lib/report.c
index 2255dc3..8e9bff5 100644
--- a/lib/report.c
+++ b/lib/report.c
@@ -19,7 +19,7 @@ static struct spinlock lock;
 
 #define PREFIX_DELIMITER ": "
 
-void report_pass(void)
+void report_passed(void)
 {
 	spin_lock(&lock);
 	tests++;
@@ -112,6 +112,24 @@ void report(bool pass, const char *msg_fmt, ...)
 	va_end(va);
 }
 
+void report_pass(const char *msg_fmt, ...)
+{
+	va_list va;
+
+	va_start(va, msg_fmt);
+	va_report(msg_fmt, true, false, false, va);
+	va_end(va);
+}
+
+void report_fail(const char *msg_fmt, ...)
+{
+	va_list va;
+
+	va_start(va, msg_fmt);
+	va_report(msg_fmt, false, false, false, va);
+	va_end(va);
+}
+
 void report_xfail(bool xfail, bool pass, const char *msg_fmt, ...)
 {
 	va_list va;
diff --git a/x86/vmx.h b/x86/vmx.h
index ebd014c..fd0174a 100644
--- a/x86/vmx.h
+++ b/x86/vmx.h
@@ -928,7 +928,7 @@ do { \
 		dump_stack(); \
 		__abort_test(); \
 	} \
-	report_pass(); \
+	report_passed(); \
 } while (0)
 
 #define TEST_ASSERT_MSG(cond, fmt, args...) \
@@ -939,7 +939,7 @@ do { \
 		dump_stack(); \
 		__abort_test(); \
 	} \
-	report_pass(); \
+	report_passed(); \
 } while (0)
 
 #define __TEST_EQ(a, b, a_str, b_str, assertion, fmt, args...) \
@@ -964,7 +964,7 @@ do { \
 		if (assertion) \
 			__abort_test(); \
 	} \
-	report_pass(); \
+	report_passed(); \
 } while (0)
 
 #define TEST_ASSERT_EQ(a, b) __TEST_EQ(a, b, #a, #b, 1, "")
-- 
2.31.1


  parent reply	other threads:[~2021-10-05  9:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20211005090921.1816373-1-scgl@linux.ibm.com>
2021-10-05  9:09 ` [kvm-unit-tests PATCH v2 1/5] s390x: Add specification exception test Janis Schoetterl-Glausch
2021-10-05 11:14   ` [kvm-unit-tests PATCH v2 1/5] [kvm-unit-tests PATCH v2 0/5] Add specification exception tests Janis Schoetterl-Glausch
     [not found]   ` <ef75d789-b613-e828-7d6d-2ab2b5e7618c@linux.ibm.com>
2021-10-05 13:32     ` [kvm-unit-tests PATCH v2 1/5] s390x: Add specification exception test Janis Schoetterl-Glausch
2021-10-05 14:51   ` Thomas Huth
2021-10-05 16:14     ` Janis Schoetterl-Glausch
2021-10-05  9:09 ` [kvm-unit-tests PATCH v2 2/5] s390x: Test specification exceptions during transaction Janis Schoetterl-Glausch
2021-10-05  9:09 ` Janis Schoetterl-Glausch [this message]
2021-10-05  9:09 ` [kvm-unit-tests PATCH v2 4/5] Use report_fail(...) instead of report(0/false, ...) Janis Schoetterl-Glausch
2021-10-05 11:53   ` Andrew Jones
2021-10-05 15:37   ` Thomas Huth
2021-10-05  9:09 ` [kvm-unit-tests PATCH v2 5/5] Use report_pass(...) instead of report(1/true, ...) Janis Schoetterl-Glausch
2021-10-05 15:42   ` Thomas Huth
2021-10-07  6:50   ` Thomas Huth
     [not found] ` <2f5f7152-1f11-f462-de27-3d49f4588dfe@redhat.com>
     [not found]   ` <20211005103025.1998376-1-scgl@linux.ibm.com>
2021-10-05 16:09     ` [kvm-unit-tests PATCH v2 0/5] Add specification exception tests Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211005090921.1816373-4-scgl@linux.ibm.com \
    --to=scgl@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox