[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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux