[kvm-unit-tests PATCH v1 1/2] lib: s390x: introduce check_pgm_int_code_xfail()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Right now, it is not very convenient to have expected failures when checking for
program interrupts. Let's introduce check_pgm_int_code_xfail() with an API
similar to report_xfail() to make the programmer's life easier.

With this, we can express check_pgm_int_code() as a special case of
check_pgm_int_code_xfail() with xfail = false.

Signed-off-by: Nico Boehr <nrb@xxxxxxxxxxxxx>
---
 lib/s390x/asm/interrupt.h | 1 +
 lib/s390x/interrupt.c     | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/s390x/asm/interrupt.h b/lib/s390x/asm/interrupt.h
index d9ab0bd781c9..88731da9e341 100644
--- a/lib/s390x/asm/interrupt.h
+++ b/lib/s390x/asm/interrupt.h
@@ -46,6 +46,7 @@ void handle_svc_int(void);
 void expect_pgm_int(void);
 void expect_ext_int(void);
 uint16_t clear_pgm_int(void);
+void check_pgm_int_code_xfail(bool xfail, uint16_t code);
 void check_pgm_int_code(uint16_t code);
 
 /* Activate low-address protection */
diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c
index 27d3b767210f..b61f7d588550 100644
--- a/lib/s390x/interrupt.c
+++ b/lib/s390x/interrupt.c
@@ -47,14 +47,19 @@ uint16_t clear_pgm_int(void)
 	return code;
 }
 
-void check_pgm_int_code(uint16_t code)
+void check_pgm_int_code_xfail(bool xfail, uint16_t code)
 {
 	mb();
-	report(code == lc->pgm_int_code,
+	report_xfail(xfail, code == lc->pgm_int_code,
 	       "Program interrupt: expected(%d) == received(%d)", code,
 	       lc->pgm_int_code);
 }
 
+void check_pgm_int_code(uint16_t code)
+{
+	check_pgm_int_code_xfail(false, code);
+}
+
 void register_pgm_cleanup_func(void (*f)(void))
 {
 	pgm_cleanup_func = f;
-- 
2.31.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux