diff mbox

[kvm-unit-tests,v4,06/13] x86/pmu: expect failure with nmi_watchdog

Message ID 1462983171-4208-7-git-send-email-rkrcmar@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Radim Krčmář May 11, 2016, 4:12 p.m. UTC
Host's nmi_watchdog takes one slot, making the "all counters" unit-test
fail.  We know exactly what happens, mark it as expected failure.

PMU test is now executed regardless of host_nmi_watchdog.

Signed-off-by: Radim Kr?má? <rkrcmar@redhat.com>
---
 v4: improved command line parsing [Drew]

 x86/Makefile.common | 1 +
 x86/pmu.c           | 6 +++++-
 x86/unittests.cfg   | 3 +--
 3 files changed, 7 insertions(+), 3 deletions(-)

Comments

Andrew Jones May 11, 2016, 5 p.m. UTC | #1
On Wed, May 11, 2016 at 06:12:48PM +0200, Radim Kr?má? wrote:
> Host's nmi_watchdog takes one slot, making the "all counters" unit-test
> fail.  We know exactly what happens, mark it as expected failure.
> 
> PMU test is now executed regardless of host_nmi_watchdog.
> 
> Signed-off-by: Radim Kr?má? <rkrcmar@redhat.com>
> ---
>  v4: improved command line parsing [Drew]
> 
>  x86/Makefile.common | 1 +
>  x86/pmu.c           | 6 +++++-
>  x86/unittests.cfg   | 3 +--
>  3 files changed, 7 insertions(+), 3 deletions(-)

Reviewed-by: Andrew Jones <drjones@redhat.com>

> 
> diff --git a/x86/Makefile.common b/x86/Makefile.common
> index 356d879a986b..4951210f3331 100644
> --- a/x86/Makefile.common
> +++ b/x86/Makefile.common
> @@ -3,6 +3,7 @@
>  all: test_cases
>  
>  cflatobjs += lib/pci.o
> +cflatobjs += lib/util.o
>  cflatobjs += lib/x86/io.o
>  cflatobjs += lib/x86/smp.o
>  cflatobjs += lib/x86/vm.o
> diff --git a/x86/pmu.c b/x86/pmu.c
> index c68980044dee..a4b88b410904 100644
> --- a/x86/pmu.c
> +++ b/x86/pmu.c
> @@ -8,6 +8,7 @@
>  #include "x86/vm.h"
>  
>  #include "libcflat.h"
> +#include <util.h>
>  #include <stdint.h>
>  
>  #define FIXED_CNT_INDEX 32
> @@ -92,6 +93,7 @@ struct pmu_event {
>  };
>  
>  static int num_counters;
> +static bool host_nmi_watchdog;
>  
>  char *buf;
>  
> @@ -291,7 +293,7 @@ static void check_counters_many(void)
>  		if (!verify_counter(&cnt[i]))
>  			break;
>  
> -	report("all counters", i == n);
> +	report_xfail("all counters", host_nmi_watchdog, i == n);
>  }
>  
>  static void check_counter_overflow(void)
> @@ -385,6 +387,8 @@ int main(int ac, char **av)
>  	ebx.full = id.b;
>  	edx.full = id.d;
>  
> +	host_nmi_watchdog = args_parse_keyval(ac, av, "host_nmi_watchdog");
> +
>  	if (!eax.split.version_id) {
>  		printf("No pmu is detected!\n");
>  		return report_summary();
> diff --git a/x86/unittests.cfg b/x86/unittests.cfg
> index 60747cfca94e..3852b40a2927 100644
> --- a/x86/unittests.cfg
> +++ b/x86/unittests.cfg
> @@ -121,8 +121,7 @@ file = msr.flat
>  
>  [pmu]
>  file = pmu.flat
> -extra_params = -cpu host
> -check = /proc/sys/kernel/nmi_watchdog=0
> +extra_params = -cpu host -append "host_nmi_watchdog=`cat /proc/sys/kernel/nmi_watchdog`"
>  
>  [port80]
>  file = port80.flat
> -- 
> 2.8.2
> 
> --
> 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
--
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/Makefile.common b/x86/Makefile.common
index 356d879a986b..4951210f3331 100644
--- a/x86/Makefile.common
+++ b/x86/Makefile.common
@@ -3,6 +3,7 @@ 
 all: test_cases
 
 cflatobjs += lib/pci.o
+cflatobjs += lib/util.o
 cflatobjs += lib/x86/io.o
 cflatobjs += lib/x86/smp.o
 cflatobjs += lib/x86/vm.o
diff --git a/x86/pmu.c b/x86/pmu.c
index c68980044dee..a4b88b410904 100644
--- a/x86/pmu.c
+++ b/x86/pmu.c
@@ -8,6 +8,7 @@ 
 #include "x86/vm.h"
 
 #include "libcflat.h"
+#include <util.h>
 #include <stdint.h>
 
 #define FIXED_CNT_INDEX 32
@@ -92,6 +93,7 @@  struct pmu_event {
 };
 
 static int num_counters;
+static bool host_nmi_watchdog;
 
 char *buf;
 
@@ -291,7 +293,7 @@  static void check_counters_many(void)
 		if (!verify_counter(&cnt[i]))
 			break;
 
-	report("all counters", i == n);
+	report_xfail("all counters", host_nmi_watchdog, i == n);
 }
 
 static void check_counter_overflow(void)
@@ -385,6 +387,8 @@  int main(int ac, char **av)
 	ebx.full = id.b;
 	edx.full = id.d;
 
+	host_nmi_watchdog = args_parse_keyval(ac, av, "host_nmi_watchdog");
+
 	if (!eax.split.version_id) {
 		printf("No pmu is detected!\n");
 		return report_summary();
diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index 60747cfca94e..3852b40a2927 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -121,8 +121,7 @@  file = msr.flat
 
 [pmu]
 file = pmu.flat
-extra_params = -cpu host
-check = /proc/sys/kernel/nmi_watchdog=0
+extra_params = -cpu host -append "host_nmi_watchdog=`cat /proc/sys/kernel/nmi_watchdog`"
 
 [port80]
 file = port80.flat