From patchwork Mon Jun 18 12:04:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 10471155 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 99C4B6029B for ; Mon, 18 Jun 2018 12:05:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89F7027BA5 for ; Mon, 18 Jun 2018 12:05:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7EA12289B4; Mon, 18 Jun 2018 12:05:56 +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 2DFFD27BA5 for ; Mon, 18 Jun 2018 12:05:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933645AbeFRMFT (ORCPT ); Mon, 18 Jun 2018 08:05:19 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:44910 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934813AbeFRMFD (ORCPT ); Mon, 18 Jun 2018 08:05:03 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 027F3401DEAF; Mon, 18 Jun 2018 12:05:03 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-116-92.ams2.redhat.com [10.36.116.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 46CAE2026D69; Mon, 18 Jun 2018 12:05:02 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org Cc: kvm-ppc@vger.kernel.org, Laurent Vivier Subject: [kvm-unit-tests PATCH] powerpc: Report missing features as "skip", not as "expected failure" Date: Mon, 18 Jun 2018 14:04:58 +0200 Message-Id: <1529323498-29286-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 18 Jun 2018 12:05:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 18 Jun 2018 12:05:03 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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(); }