From: David Matlack Subject: [kvm-unit-tests PATCH 32/32] lib: add report_pass Date: Thu, 20 Apr 2017 17:50:04 -0700 Message-ID: <20170421005004.137260-33-dmatlack@google.com> References: <20170421005004.137260-1-dmatlack@google.com> Cc: David Matlack To: kvm@vger.kernel.org Return-path: Received: from mail-oi0-f53.google.com ([209.85.218.53]:34137 "EHLO mail-oi0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1034201AbdDUAum (ORCPT ); Thu, 20 Apr 2017 20:50:42 -0400 Received: by mail-oi0-f53.google.com with SMTP id x184so74081018oia.1 for ; Thu, 20 Apr 2017 17:50:42 -0700 (PDT) In-Reply-To: <20170421005004.137260-1-dmatlack@google.com> Sender: kvm-owner@vger.kernel.org List-ID: 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 --- lib/libcflat.h | 1 + lib/report.c | 7 +++++++ x86/vmx.h | 3 +++ 3 files changed, 11 insertions(+) diff --git a/lib/libcflat.h b/lib/libcflat.h index 7e4bce1dd335..b1ea5e607033 100644 --- a/lib/libcflat.h +++ b/lib/libcflat.h @@ -104,6 +104,7 @@ extern void report_xfail(const char *msg_fmt, bool xfail, bool pass, ...); 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 1033f1e44e99..aa23b6582512 100644 --- a/lib/report.c +++ b/lib/report.c @@ -19,6 +19,13 @@ static struct spinlock lock; #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 2390c4a99901..4194429e07b8 100644 --- a/x86/vmx.h +++ b/x86/vmx.h @@ -726,6 +726,7 @@ do { \ dump_stack(); \ __abort_test(); \ } \ + report_pass(); \ } while (0) #define TEST_ASSERT_MSG(cond, fmt, args...) \ @@ -736,6 +737,7 @@ do { \ dump_stack(); \ __abort_test(); \ } \ + report_pass(); \ } while (0) #define __TEST_EQ(a, b, a_str, b_str, assertion, fmt, args...) \ @@ -759,6 +761,7 @@ do { \ if (assertion) \ __abort_test(); \ } \ + report_pass(); \ } while (0) #define TEST_ASSERT_EQ(a, b) __TEST_EQ(a, b, #a, #b, 1, "") -- 2.12.2.816.g2cccc81164-goog