@@ -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);
@@ -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;
@@ -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, "")
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(-)