lib: add report_pass
The assertion macros in the vmx tests only call report() if the test
fails. This avoids a lot of logging (e.g. vmx_ept_access_test_reserved_bits
checks 3460 assertions). However the test runner interprets passing runs
as "skipped" because it looks like no testcases were run. Add a function
called report_pass(), which lets tests report that a test passed without
printing anything to the console.
Signed-off-by: David Matlack <dmatlack@google.com>
Message-Id: <20170421005004.137260-33-dmatlack@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/lib/libcflat.h b/lib/libcflat.h
index 7e4bce1..b1ea5e6 100644
--- a/lib/libcflat.h
+++ b/lib/libcflat.h
@@ -104,6 +104,7 @@
extern void report_abort(const char *msg_fmt, ...);
extern void report_skip(const char *msg_fmt, ...);
extern void report_info(const char *msg_fmt, ...);
+extern void report_pass(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 1033f1e..aa23b65 100644
--- a/lib/report.c
+++ b/lib/report.c
@@ -19,6 +19,13 @@
#define PREFIX_DELIMITER ": "
+void report_pass(void)
+{
+ spin_lock(&lock);
+ tests++;
+ spin_unlock(&lock);
+}
+
void report_prefix_pushf(const char *prefix_fmt, ...)
{
va_list va;
diff --git a/x86/vmx.h b/x86/vmx.h
index 2390c4a..4194429 100644
--- a/x86/vmx.h
+++ b/x86/vmx.h
@@ -726,6 +726,7 @@
dump_stack(); \
__abort_test(); \
} \
+ report_pass(); \
} while (0)
#define TEST_ASSERT_MSG(cond, fmt, args...) \
@@ -736,6 +737,7 @@
dump_stack(); \
__abort_test(); \
} \
+ report_pass(); \
} while (0)
#define __TEST_EQ(a, b, a_str, b_str, assertion, fmt, args...) \
@@ -759,6 +761,7 @@
if (assertion) \
__abort_test(); \
} \
+ report_pass(); \
} while (0)
#define TEST_ASSERT_EQ(a, b) __TEST_EQ(a, b, #a, #b, 1, "")