From patchwork Fri Apr 21 00:50:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Matlack X-Patchwork-Id: 9691541 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 90F396038D for ; Fri, 21 Apr 2017 00:51:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 834E32847B for ; Fri, 21 Apr 2017 00:51:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 76FE528480; Fri, 21 Apr 2017 00:51:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22F492847B for ; Fri, 21 Apr 2017 00:51:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034294AbdDUAu7 (ORCPT ); Thu, 20 Apr 2017 20:50:59 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ro0swk+4FVUHTfOlM8NBmdaP+gCSTZptkvg5iHyW+CM=; b=mVReP7CI1TzZLaplaUZkNPwmARw25zL16XjsRwWj2fprr6JVaFOEdT5DSZaI85mUBP s7LhdbGcuo6TAiDDuQgkcu2Yfz235iEqsLbDbAsfGqsfI0IKPXw/XJ4Qkj4bj5Iuyw7o 3l468DYHnSHJf5XuhJvF5s7Fdc7DLmY311zITtOOnVeg04d62JSZWZqXQ0EGhUSmhrVR IQ+UkriR6a40dZd/ctMHUveMKQuyLzRNdDUzgOSnATODepWMHrw24UB5m7c1+ec4kLiM vDWKl2DM4OaB8IhtmuIeZaBeOVGn6sktMz/zdeU13nhLrJPYhLTo2iT3mrRp4tcDmcCc laVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ro0swk+4FVUHTfOlM8NBmdaP+gCSTZptkvg5iHyW+CM=; b=CvQgGZevw/Fsd3mfcjUsVsJG4tuh6+nDg5OtA3hBrk7TqV1cWDuPbQlr7tprFwzgBX WTmdfVF3rupezSHKE54h/zA5ypKaq+3BpaiSJwyNmdufJMKSRLmoSXEBO/2K+JKHtJW8 eS3PHSN5mMbeR8YNpfRsscdZJg5Ca0TGg+/76E/Mf+T1fmLeCN4/AYNC7NyJzDrUt8S0 q2hkF4fh8U/1eC6XzY73WuOP+vmSSv1saCn5MJf22C5yTuG8Q6Ln1KysQoWoGNlIaPsH p4hAHvqLDzjjrMBV+P2FTVxnzE/ZARdAEz0DeiUBTagqQQcDdpjuc5CGje5cmfO8+HT3 n2Hg== X-Gm-Message-State: AN3rC/4vAojlh6ZWOhkqf046ytBZDxFOWzJUJoQXHw2pqRsw9cfgQ6S+ CFC5OqZl2H4dxodk X-Received: by 10.84.222.135 with SMTP id x7mr13028897pls.50.1492735841450; Thu, 20 Apr 2017 17:50:41 -0700 (PDT) Received: from dmatlack.sea.corp.google.com ([100.100.206.82]) by smtp.gmail.com with ESMTPSA id e13sm12466486pfb.30.2017.04.20.17.50.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Apr 2017 17:50:39 -0700 (PDT) From: David Matlack To: kvm@vger.kernel.org Cc: 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> X-Mailer: git-send-email 2.12.2.816.g2cccc81164-goog In-Reply-To: <20170421005004.137260-1-dmatlack@google.com> References: <20170421005004.137260-1-dmatlack@google.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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, "")