From patchwork Tue Jun 26 10:01:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 10488555 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 C0E9F60386 for ; Tue, 26 Jun 2018 10:01:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9ACE28868 for ; Tue, 26 Jun 2018 10:01:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE2B42886F; Tue, 26 Jun 2018 10:01:35 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 1FD0528868 for ; Tue, 26 Jun 2018 10:01:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934019AbeFZKBd (ORCPT ); Tue, 26 Jun 2018 06:01:33 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:57768 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933870AbeFZKBb (ORCPT ); Tue, 26 Jun 2018 06:01:31 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A9B30F68A7; Tue, 26 Jun 2018 10:01:30 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-204-33.brq.redhat.com [10.40.204.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 067152166B5D; Tue, 26 Jun 2018 10:01:28 +0000 (UTC) From: Thomas Huth To: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Paolo Bonzini , kvm@vger.kernel.org Cc: David Hildenbrand , Laurent Vivier , kvm-ppc@vger.kernel.org Subject: [kvm-unit-tests PULL 4/4] powerpc: Report missing features as "skip", not as "expected failure" Date: Tue, 26 Jun 2018 12:01:19 +0200 Message-Id: <1530007279-26545-5-git-send-email-thuth@redhat.com> In-Reply-To: <1530007279-26545-1-git-send-email-thuth@redhat.com> References: <1530007279-26545-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 26 Jun 2018 10:01:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 26 Jun 2018 10:01:30 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Missing CPU or hypervisor features are not a real error, so we should rather report a "skip" here than an "expected failure". Signed-off-by: Thomas Huth --- powerpc/spapr_hcall.c | 6 ++++-- powerpc/tm.c | 26 ++++++++++++++++---------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/powerpc/spapr_hcall.c b/powerpc/spapr_hcall.c index ce495f4..524d896 100644 --- a/powerpc/spapr_hcall.c +++ b/powerpc/spapr_hcall.c @@ -118,9 +118,11 @@ static void test_h_random(int argc, char **argv) /* H_RANDOM is optional - so check for sane return values first */ rc = h_random(&rval); - report_xfail("h-call available", rc == H_FUNCTION, rc == H_SUCCESS); - if (rc != H_SUCCESS) + if (rc == H_FUNCTION) { + report_skip("h-call is not available"); return; + } + report("h-call can be used successfully", rc == H_SUCCESS); val0 = 0ULL; val1 = ~0ULL; diff --git a/powerpc/tm.c b/powerpc/tm.c index ff7b2f9..bd56baa 100644 --- a/powerpc/tm.c +++ b/powerpc/tm.c @@ -35,15 +35,17 @@ static void cpu_has_tm(int fdtnode, u64 regval __unused, void *ptr) *(int *)ptr += 1; } -/* Check whether all CPU nodes have the TM flag */ -static bool all_cpus_have_tm(void) +/* Check amount of CPUs nodes that have the TM flag */ +static int count_cpus_with_tm(void) { int ret; int available = 0; ret = dt_for_each_cpu_node(cpu_has_tm, &available); + if (ret < 0) + return ret; - return ret == 0 && available == nr_cpus; + return available; } static int h_cede(void) @@ -136,16 +138,18 @@ struct { int main(int argc, char **argv) { - bool all, has_tm; - int i; + bool all; + int i, cpus_with_tm; report_prefix_push("tm"); - has_tm = all_cpus_have_tm(); - report_xfail("TM available in 'ibm,pa-features' property", - !has_tm, has_tm); - if (!has_tm) - return report_summary(); + cpus_with_tm = count_cpus_with_tm(); + if (cpus_with_tm == 0) { + report_skip("TM is not available"); + goto done; + } + report("TM available in all 'ibm,pa-features' properties", + cpus_with_tm == nr_cpus); all = argc == 1 || !strcmp(argv[1], "all"); @@ -157,5 +161,7 @@ int main(int argc, char **argv) } } +done: + report_prefix_pop(); return report_summary(); }