All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: 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 10:01:19 +0000	[thread overview]
Message-ID: <1530007279-26545-5-git-send-email-thuth@redhat.com> (raw)

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 <thuth@redhat.com>
---
 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();
 }
-- 
1.8.3.1


                 reply	other threads:[~2018-06-26 10:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1530007279-26545-5-git-send-email-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=kvm-ppc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.