diff mbox

[kvm-unit-tests,v4,02/13] x86/*: report skipped tests

Message ID 20160525171927.GA8077@potion (mailing list archive)
State New, archived
Headers show

Commit Message

Radim Krčmář May 25, 2016, 5:19 p.m. UTC
2016-05-17 14:19+0200, Paolo Bonzini:
> On 11/05/2016 18:12, Radim Krčmář wrote:
>>      if (!(cpuid_indexed(7, 0).c & (1 << X86_FEATURE_PKU))) {
>>          printf("PKU not enabled, aborting\n");
>> -        abort();
>> +        return report_summary();
> 
> Needs report_skip?
> 
>> diff --git a/x86/pmu.c b/x86/pmu.c
>> @@ -387,7 +387,7 @@ int main(int ac, char **av)
>>  	if (!eax.split.version_id) {
>>  		printf("No pmu is detected!\n");
>> -		return 1;
>> +		return report_summary();
> 
> Needs report_skip?
> 
>> diff --git a/x86/smap.c b/x86/smap.c
>> @@ -93,7 +93,7 @@ int main(int ac, char **av)
>>  	if (!(cpuid_indexed(7, 0).b & (1 << X86_FEATURE_SMAP))) {
>>  		printf("SMAP not enabled, aborting\n");
>> -		abort();
>> +		return report_summary();
> 
> Needs report_skip?
> 
>> diff --git a/x86/svm.c b/x86/svm.c
>>      if (!(cpuid(0x80000001).c & 4)) {
>>          printf("SVM not availble\n");
>> -        return 0;
>> +        return report_summary();
> 
> Needs report_skip?
> 
>> diff --git a/x86/tsc.c b/x86/tsc.c
>>  		printf("rdtscp not supported\n");
> 
> Needs report_skip?
> 
>> -	return 0;
>> +	return report_summary();
> 
> Just sending a fixup patch is enough.

report_skip is not needed, because the a test that ended in
report_summary without any report is considered as skipped.

The fixup below turns printfs to report_skip is below.  The difference
is that summary will now print

  SKIP pku (1 tests, 1 skipped)

instead of previous

  SKIP pku (0 tests)

I like "0 tests" summary better and only x86/hyperv_synic does the
opposite, so a fix could go both ways.

---8<---
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/x86/pku.c b/x86/pku.c
index 6214f0bc151f..4b418fdc8a20 100644
--- a/x86/pku.c
+++ b/x86/pku.c
@@ -67,7 +67,7 @@  int main(int ac, char **av)
     unsigned int pkru_wd = 0x20;
 
     if (!(cpuid_indexed(7, 0).c & (1 << X86_FEATURE_PKU))) {
-        printf("PKU not enabled, aborting\n");
+        report_skip("PKU not enabled\n");
         return report_summary();
     }
 
diff --git a/x86/pmu.c b/x86/pmu.c
index b0f9f81af68e..308274761336 100644
--- a/x86/pmu.c
+++ b/x86/pmu.c
@@ -390,7 +390,7 @@  int main(int ac, char **av)
 	host_nmi_watchdog = atol_keyval(ac, av, "host_nmi_watchdog");
 
 	if (!eax.split.version_id) {
-		printf("No pmu is detected!\n");
+		report_skip("No pmu is detected!\n");
 		return report_summary();
 	}
 	printf("PMU version:         %d\n", eax.split.version_id);
diff --git a/x86/smap.c b/x86/smap.c
index c9de081a474b..23722beb00f5 100644
--- a/x86/smap.c
+++ b/x86/smap.c
@@ -92,7 +92,7 @@  int main(int ac, char **av)
 	unsigned long i;
 
 	if (!(cpuid_indexed(7, 0).b & (1 << X86_FEATURE_SMAP))) {
-		printf("SMAP not enabled, aborting\n");
+		report_skip("SMAP not enabled\n");
 		return report_summary();
 	}
 
diff --git a/x86/svm.c b/x86/svm.c
index 301cf8cb2d6b..005cbf7c3352 100644
--- a/x86/svm.c
+++ b/x86/svm.c
@@ -1063,7 +1063,7 @@  int main(int ac, char **av)
     smp_init();
 
     if (!(cpuid(0x80000001).c & 4)) {
-        printf("SVM not availble\n");
+        report_skip("SVM not availble\n");
         return report_summary();
     }
 
diff --git a/x86/tsc.c b/x86/tsc.c
index 62450e71725c..33fdc114c04c 100644
--- a/x86/tsc.c
+++ b/x86/tsc.c
@@ -42,6 +42,6 @@  int main()
 		test_rdtscp(10);
 		test_rdtscp(0x100);
 	} else
-		printf("rdtscp not supported\n");
+		report_skip("rdtscp not supported\n");
 	return report_summary();
 }