[rtems-central commit] spec: Improve spurious interrupt test case

Sebastian Huber sebh at rtems.org
Wed Nov 23 07:01:03 UTC 2022


Module:    rtems-central
Branch:    master
Commit:    e6d8d0d567b9636dadd084761c4c17f19e18541b
Changeset: http://git.rtems.org/rtems-central/commit/?id=e6d8d0d567b9636dadd084761c4c17f19e18541b

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Nov 23 08:12:33 2022 +0100

spec: Improve spurious interrupt test case

Use the tm27 support to test a spurious interrupt.  This helps to run the
validation test case on targets which have no software interrupt available for
tests (for example riscv/PLIC/CLINT in the SMP configuration).

---

 spec/bsp/req/interrupt-spurious.yml | 42 +++++++++++++------------------------
 1 file changed, 15 insertions(+), 27 deletions(-)

diff --git a/spec/bsp/req/interrupt-spurious.yml b/spec/bsp/req/interrupt-spurious.yml
index f1191331..08fe6ab5 100644
--- a/spec/bsp/req/interrupt-spurious.yml
+++ b/spec/bsp/req/interrupt-spurious.yml
@@ -98,12 +98,9 @@ test-action: |
   } else
   #endif
   {
-    rtems_status_code sc;
-
     (void) rtems_interrupt_vector_enable( ctx->test_vector );
 
-    sc = rtems_interrupt_raise( ctx->test_vector );
-    T_rsc_success( sc );
+    CallWithinISRRaise();
 
     while ( !ctx->interrupt_occurred ) {
       /* Wait */
@@ -114,6 +111,12 @@ test-action: |
 test-brief: null
 test-cleanup: null
 test-context:
+- brief: |
+    This member references the interrupt entry to restore during test case
+    teardown.
+  description: null
+  member: |
+    rtems_interrupt_entry *entry_to_restore
 - brief: |
     This member provides a jump buffer to return from the fatal error.
   description: null
@@ -124,11 +127,6 @@ test-context:
   description: null
   member: |
     rtems_interrupt_entry entry
-- brief: |
-    If this member is true, then the interrupt shall be cleared.
-  description: null
-  member: |
-    bool do_clear
 - brief: |
     This member is true, then an interrupt occurred.
   description: null
@@ -183,20 +181,13 @@ test-prepare: null
 test-setup:
   brief: null
   code: |
-    rtems_interrupt_attributes attr = {
-      .can_raise = true
-    };
-    rtems_status_code sc;
-
-    ctx->test_vector = GetTestableInterruptVector( &attr );
+    ctx->first = NULL;
+    ctx->test_vector = CallWithinISRGetVector();
     T_assert_lt_u32( ctx->test_vector, BSP_INTERRUPT_VECTOR_COUNT );
     ctx->first = &bsp_interrupt_handler_table[
       bsp_interrupt_handler_index( ctx->test_vector )
     ];
-
-    sc = rtems_interrupt_get_attributes( ctx->test_vector, &attr );
-    T_rsc_success( sc );
-    ctx->do_clear = attr.can_clear && !attr.cleared_by_acknowledge;
+    ctx->entry_to_restore = *ctx->first;
 
     rtems_interrupt_entry_initialize( &ctx->entry, EntryRoutine, ctx, "Info" );
     test_case_active = true;
@@ -216,14 +207,7 @@ test-support: |
   static void ProcessInterrupt( Context *ctx )
   {
     ctx->interrupt_occurred = true;
-
-    if ( ctx->do_clear ) {
-      rtems_status_code sc;
-
-      sc = rtems_interrupt_clear( ctx->test_vector );
-      T_rsc_success( sc );
-    }
-
+    CallWithinISRClear();
     Disable( ctx );
   }
 
@@ -276,6 +260,10 @@ test-teardown:
   code: |
     SetFatalHandler( NULL, NULL );
     test_case_active = false;
+
+    if ( ctx->first != NULL ) {
+      *ctx->first = ctx->entry_to_restore;
+    }
   description: null
 text: ${.:text-template}
 transition-map:



More information about the vc mailing list