[rtems commit] sptests/sp37: Add ISR set/get level tests

Joel Sherrill Joel.Sherrill at OARcorp.com
Mon Aug 5 13:21:56 UTC 2013


At one point I had a set of porting tests which did not require an entire RTEMS build environment. Something like this was part of it. I also had some bit field tests and a few others.

Should tests that exercise CPU specific code be in a single collection?

Sebastian Huber <sebh at rtems.org> wrote:


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Aug  5 10:07:00 2013 +0200

sptests/sp37: Add ISR set/get level tests

---

 testsuites/sptests/sp37/init.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/testsuites/sptests/sp37/init.c b/testsuites/sptests/sp37/init.c
index 4ffebbb..a12aa77 100644
--- a/testsuites/sptests/sp37/init.c
+++ b/testsuites/sptests/sp37/init.c
@@ -44,6 +44,36 @@ rtems_timer_service_routine test_isr_in_progress(

 /* test bodies */

+static void test_isr_level( void )
+{
+  ISR_Level mask = CPU_MODES_INTERRUPT_MASK;
+  ISR_Level normal = _ISR_Get_level();
+  ISR_Level current = 0;
+
+  _ISR_Set_level( current );
+  rtems_test_assert( _ISR_Get_level() == current );
+
+  for ( current = current + 1 ; current <= mask ; ++current ) {
+    ISR_Level actual;
+
+    _ISR_Set_level( current );
+
+    actual = _ISR_Get_level();
+    rtems_test_assert( actual == current || actual == ( current - 1 ) );
+
+    if ( _ISR_Get_level() != current ) {
+      break;
+    }
+  }
+
+  for ( current = current + 1 ; current <= mask ; ++current ) {
+    _ISR_Set_level( current );
+    rtems_test_assert( _ISR_Get_level() == current );
+  }
+
+  _ISR_Set_level( normal );
+}
+
 static void test_isr_locks( void )
 {
   ISR_Level normal_interrupt_level = _ISR_Get_level();
@@ -253,6 +283,7 @@ rtems_task Init(

   puts( "\n\n*** TEST 37 ***" );

+  test_isr_level();
   test_isr_locks();
   test_interrupt_locks();


_______________________________________________
rtems-vc mailing list
rtems-vc at rtems.org
http://www.rtems.org/mailman/listinfo/rtems-vc




More information about the devel mailing list