All of lore.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PULL 4/4] powerpc: Report missing features as "skip", not as "expected failure"
@ 2018-06-26 10:01 Thomas Huth
  0 siblings, 0 replies; only message in thread
From: Thomas Huth @ 2018-06-26 10:01 UTC (permalink / raw)
  To: kvm-ppc

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-06-26 10:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-26 10:01 [kvm-unit-tests PULL 4/4] powerpc: Report missing features as "skip", not as "expected failure" Thomas Huth

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.