[rtems commit] sptests/sp37: Fix type and simplify

Sebastian Huber sebh at rtems.org
Fri Jun 19 19:21:53 UTC 2015


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Jun 19 21:17:55 2015 +0200

sptests/sp37: Fix type and simplify

---

 testsuites/sptests/sp37/init.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/testsuites/sptests/sp37/init.c b/testsuites/sptests/sp37/init.c
index 647485e..0846491 100644
--- a/testsuites/sptests/sp37/init.c
+++ b/testsuites/sptests/sp37/init.c
@@ -333,10 +333,7 @@ volatile int isr_in_progress_inline;
 
 void check_isr_in_progress_inline(void)
 {
-  bool in_isr;
-
-  in_isr = rtems_interrupt_is_in_progress();
-  isr_in_progress_inline = ( in_isr ) ? 1 : 2;
+  isr_in_progress_inline = rtems_interrupt_is_in_progress() ? 1 : 2;
 }
 
 #undef rtems_interrupt_disable
@@ -353,12 +350,9 @@ rtems_timer_service_routine test_isr_in_progress(
   void     *arg
 )
 {
-  bool in_isr;
-
   check_isr_in_progress_inline();
 
-  in_isr = rtems_interrupt_is_in_progress();
-  isr_in_progress_body = ( in_isr ) ? 1 : 2;
+  isr_in_progress_body = rtems_interrupt_is_in_progress() ? 1 : 2;
 }
 
 void check_isr_worked(
@@ -367,13 +361,14 @@ void check_isr_worked(
 )
 {
   switch (result) {
-    case -1:
+    case 0:
       printf( "isr_in_progress(%s) timer did not fire\n", s );
+      rtems_test_exit(0);
       break;
     case 1:
       printf( "isr_in_progress(%s) from ISR -- OK\n", s );
       break;
-    case 2:
+    default:
       printf( "isr_in_progress(%s) from ISR -- returned bad value\n", s);
       rtems_test_exit(0);
       break;
@@ -573,16 +568,13 @@ rtems_task Init(
   /*
    * Test ISR in progress from actual ISR
    */
-  isr_in_progress_body   = -1;
-  isr_in_progress_inline = -1;
-
   status = rtems_timer_fire_after( timer, 10, test_isr_in_progress, NULL );
   directive_failed( status, "timer_fire_after failed" );
 
-  status = rtems_task_wake_after( 100 );
+  status = rtems_task_wake_after( 11 );
   directive_failed( status, "wake_after failed" );
 
-  check_isr_worked( "inline", isr_in_progress_body );
+  check_isr_worked( "inline", isr_in_progress_inline );
 
   check_isr_worked( "body", isr_in_progress_body );
 



More information about the vc mailing list