Changeset 21f7333 in rtems


Ignore:
Timestamp:
Jul 20, 2020, 11:07:46 AM (3 weeks ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
28313958
Parents:
857a65d
git-author:
Sebastian Huber <sebastian.huber@…> (07/20/20 11:07:46)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/23/20 07:27:47)
Message:

spintrcritical01/2/3/4/5: Use T_interrupt_test()

Location:
testsuites
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/psxintrcritical01/init.c

    r857a65d r21f7333  
    1818
    1919#include <rtems/test.h>
    20 #include <rtems/simple-test.h>
     20#include <rtems/test-info.h>
    2121
    2222const char rtems_test_name[] = "PSXINTRCRITICAL 1";
     
    5454  T_quiet_psx_success(rv);
    5555
    56   while (T_interrupt_test_get_state() == T_INTERRUPT_TEST_ACTION) {
    57     /* Wait */
    58   }
     56  T_interrupt_test_busy_wait_for_interrupt();
    5957}
    6058
     
    6260{
    6361  test_context *ctx;
    64   T_interrupt_test_state state;
    6562  int rv;
    6663
    67   state = T_interrupt_test_get_state();
    68 
    69   if (state != T_INTERRUPT_TEST_ACTION) {
     64  if (T_interrupt_test_get_state() != T_INTERRUPT_TEST_ACTION) {
    7065    return T_INTERRUPT_TEST_EARLY;
    7166  }
  • testsuites/sptests/Makefile.am

    r857a65d r21f7333  
    11911191sp_screens += spintrcritical01/spintrcritical01.scn
    11921192sp_docs += spintrcritical01/spintrcritical01.doc
    1193 spintrcritical01_SOURCES = spintrcritical01/init.c \
    1194         spintrcritical_support/intrcritical.c \
    1195         spintrcritical_support/intrcritical.h
     1193spintrcritical01_SOURCES = spintrcritical01/init.c
    11961194spintrcritical01_CPPFLAGS = $(AM_CPPFLAGS) \
    11971195        $(TEST_FLAGS_spintrcritical01) $(support_includes) \
     
    12031201sp_screens += spintrcritical02/spintrcritical02.scn
    12041202sp_docs += spintrcritical02/spintrcritical02.doc
    1205 spintrcritical02_SOURCES = spintrcritical02/init.c \
    1206         spintrcritical_support/intrcritical.c
     1203spintrcritical02_SOURCES = spintrcritical02/init.c
    12071204spintrcritical02_CPPFLAGS = $(AM_CPPFLAGS) \
    12081205        $(TEST_FLAGS_spintrcritical02) $(support_includes) \
     
    12141211sp_screens += spintrcritical03/spintrcritical03.scn
    12151212sp_docs += spintrcritical03/spintrcritical03.doc
    1216 spintrcritical03_SOURCES = spintrcritical03/init.c \
    1217         spintrcritical_support/intrcritical.c
     1213spintrcritical03_SOURCES = spintrcritical03/init.c
    12181214spintrcritical03_CPPFLAGS = $(AM_CPPFLAGS) \
    12191215        $(TEST_FLAGS_spintrcritical03) $(support_includes) \
     
    12251221sp_screens += spintrcritical04/spintrcritical04.scn
    12261222sp_docs += spintrcritical04/spintrcritical04.doc
    1227 spintrcritical04_SOURCES = spintrcritical04/init.c \
    1228         spintrcritical_support/intrcritical.c
     1223spintrcritical04_SOURCES = spintrcritical04/init.c
    12291224spintrcritical04_CPPFLAGS = $(AM_CPPFLAGS) \
    12301225        $(TEST_FLAGS_spintrcritical04) $(support_includes) \
     
    12361231sp_screens += spintrcritical05/spintrcritical05.scn
    12371232sp_docs += spintrcritical05/spintrcritical05.doc
    1238 spintrcritical05_SOURCES = spintrcritical05/init.c \
    1239         spintrcritical_support/intrcritical.c
     1233spintrcritical05_SOURCES = spintrcritical05/init.c
    12401234spintrcritical05_CPPFLAGS = $(AM_CPPFLAGS) \
    12411235        $(TEST_FLAGS_spintrcritical05) $(support_includes) \
  • testsuites/sptests/spintrcritical01/spintrcritical01.scn

    r857a65d r21f7333  
    1 *** TEST INTERRUPT CRITICAL SECTION 01 ***
    2 Init - Trying to generate semaphore release from ISR while blocking
    3 Init - Variation is: FIFO/Without Timeout
    4 Support - rtems_timer_create - creating timer 1
    5 Init - Case hit
    6 *** END OF TEST INTERRUPT CRITICAL SECTION 01 ***
     1*** BEGIN OF TEST SPINTRCRITICAL 1 ***
     2*** TEST VERSION: 6.0.0.929e49a54ab4d2d18c9fb8d03610614f63e25b8d
     3*** TEST STATE: EXPECTED_PASS
     4*** TEST BUILD: RTEMS_DEBUG RTEMS_POSIX_API RTEMS_SMP
     5*** TEST TOOLS: 10.0.1 20200406 (RTEMS 6, RSB bec88a6dd856892c3e66e4598252ea07d7a0d762, Newlib ece49e4)
     6A:SPINTRCRITICAL 1
     7S:Platform:RTEMS
     8S:Compiler:10.0.1 20200406 (RTEMS 6, RSB bec88a6dd856892c3e66e4598252ea07d7a0d762, Newlib ece49e4)
     9S:Version:6.0.0.929e49a54ab4d2d18c9fb8d03610614f63e25b8d
     10S:BSP:realview_pbx_a9_qemu
     11S:RTEMS_DEBUG:1
     12S:RTEMS_MULTIPROCESSING:0
     13S:RTEMS_POSIX_API:1
     14S:RTEMS_PROFILING:0
     15S:RTEMS_SMP:1
     16B:SemaphoreReleaseFIFOWithoutTimeout
     17P:0:0:UI1:spintrcritical01impl.h:133
     18P:1:0:UI1:spintrcritical01impl.h:136
     19P:2:0:UI1:spintrcritical01impl.h:139
     20E:SemaphoreReleaseFIFOWithoutTimeout:N:3:F:0:D:0.991790
     21Z:SPINTRCRITICAL 1:C:1:N:3:F:0:D:0.992984
     22Y:ReportHash:SHA256:5ae7281f5dd710e1c043bbff2fa3ddff47dc22aa5c35cff545601c8156ec1a87
     23
     24*** END OF TEST SPINTRCRITICAL 1 ***
  • testsuites/sptests/spintrcritical01/spintrcritical01impl.h

    r857a65d r21f7333  
    11/*
     2 *  Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
     3 *
    24 *  COPYRIGHT (c) 1989-2012.
    35 *  On-Line Applications Research Corporation (OAR).
     
    1214#endif
    1315
    14 #include <tmacros.h>
    15 #include <intrcritical.h>
     16#include <rtems/test.h>
     17#include <rtems/test-info.h>
    1618
    1719#include <rtems/score/threadimpl.h>
     
    1921#if defined(FIFO_NO_TIMEOUT)
    2022  #define TEST_NAME                "1"
    21   #define TEST_STRING              "FIFO/Without Timeout"
     23  #define TEST_STRING              FIFOWithoutTimeout
    2224  #define SEMAPHORE_OBTAIN_TIMEOUT 0
    2325  #define SEMAPHORE_ATTRIBUTES     RTEMS_DEFAULT_ATTRIBUTES
     
    2527#elif defined(FIFO_WITH_TIMEOUT)
    2628  #define TEST_NAME                "2"
    27   #define TEST_STRING              "FIFO/With Timeout"
     29  #define TEST_STRING              FIFOWithTimeout
    2830  #define SEMAPHORE_OBTAIN_TIMEOUT 10
    2931  #define SEMAPHORE_ATTRIBUTES     RTEMS_DEFAULT_ATTRIBUTES
     
    3133#elif defined(PRIORITY_NO_TIMEOUT)
    3234  #define TEST_NAME                "3"
    33   #define TEST_STRING              "Priority/Without Timeout"
     35  #define TEST_STRING              PriorityWithoutTimeout
    3436  #define SEMAPHORE_OBTAIN_TIMEOUT 0
    3537  #define SEMAPHORE_ATTRIBUTES     RTEMS_PRIORITY
     
    3739#elif defined(PRIORITY_WITH_TIMEOUT)
    3840  #define TEST_NAME                "4"
    39   #define TEST_STRING              "Priority/With Timeout"
     41  #define TEST_STRING              PriorityWithTimeout
    4042  #define SEMAPHORE_OBTAIN_TIMEOUT 10
    4143  #define SEMAPHORE_ATTRIBUTES     RTEMS_PRIORITY
     
    4345#elif defined(PRIORITY_NO_TIMEOUT_REVERSE)
    4446  #define TEST_NAME                "5"
    45   #define TEST_STRING              "Priority/Without Timeout (Reverse)"
     47  #define TEST_STRING              PriorityWithoutTimeoutReverse
    4648  #define SEMAPHORE_OBTAIN_TIMEOUT 0
    4749  #define SEMAPHORE_ATTRIBUTES     RTEMS_PRIORITY
     
    5456const char rtems_test_name[] = "SPINTRCRITICAL " TEST_NAME;
    5557
    56 static Thread_Control *thread;
     58typedef struct {
     59  Thread_Control *thread;
     60  rtems_id        semaphore;
     61} test_context;
    5762
    58 static rtems_id Semaphore;
    59 
    60 static bool case_hit;
    61 
    62 static bool interrupts_blocking_op(void)
     63static bool is_blocked( Thread_Wait_flags flags )
    6364{
    64   Thread_Wait_flags flags = _Thread_Wait_flags_get( thread );
    65 
    66   return
    67     flags == ( THREAD_WAIT_CLASS_OBJECT | THREAD_WAIT_STATE_INTEND_TO_BLOCK );
     65  return flags == ( THREAD_WAIT_CLASS_OBJECT | THREAD_WAIT_STATE_BLOCKED );
    6866}
    6967
    70 static rtems_timer_service_routine test_release_from_isr(
    71   rtems_id  timer,
    72   void     *arg
    73 )
     68static bool interrupts_blocking_op( Thread_Wait_flags flags )
    7469{
    75   rtems_status_code     status;
     70  return flags
     71    == ( THREAD_WAIT_CLASS_OBJECT | THREAD_WAIT_STATE_INTEND_TO_BLOCK );
     72}
    7673
    77   if ( interrupts_blocking_op() ) {
    78     case_hit = true;
     74static T_interrupt_test_state interrupt( void *arg )
     75{
     76  test_context           *ctx;
     77  T_interrupt_test_state  state;
     78  Thread_Wait_flags       flags;
     79  rtems_status_code       status;
     80
     81  ctx = arg;
     82  flags = _Thread_Wait_flags_get( ctx->thread );
     83
     84  if ( interrupts_blocking_op( flags ) ) {
     85    state = T_INTERRUPT_TEST_DONE;
     86  } else if ( is_blocked( flags ) ) {
     87    state = T_INTERRUPT_TEST_LATE;
     88  } else {
     89    state = T_INTERRUPT_TEST_EARLY;
    7990  }
    8091
    81   status = rtems_semaphore_release( Semaphore );
    82   directive_failed_with_level( status, "release", -1 );
     92  status = rtems_semaphore_release( ctx->semaphore );
     93  T_quiet_rsc_success( status );
     94
     95  return state;
    8396}
    8497
     98static void action( void *arg )
     99{
     100  test_context      *ctx;
     101  rtems_status_code  status;
    85102
    86 static bool test_body( void *arg )
    87 {
    88   rtems_status_code status;
    89 
    90   (void) arg;
    91 
     103  ctx = arg;
    92104  status = rtems_semaphore_obtain(
    93     Semaphore,
     105    ctx->semaphore,
    94106    RTEMS_DEFAULT_OPTIONS,
    95107    SEMAPHORE_OBTAIN_TIMEOUT
    96108  );
    97   directive_failed( status, "rtems_semaphore_obtain" );
    98 
    99   return case_hit;
     109  T_quiet_rsc_success( status );
    100110}
    101111
    102 static rtems_task Init(
    103   rtems_task_argument ignored
    104 )
     112static const T_interrupt_test_config config = {
     113  .action = action,
     114  .interrupt = interrupt,
     115  .max_iteration_count = 10000
     116};
     117
     118T_TEST_CASE( RTEMS_XCONCAT( SemaphoreRelease, TEST_STRING ) )
    105119{
    106   rtems_status_code     status;
     120  test_context           ctx;
     121  rtems_status_code      status;
     122  T_interrupt_test_state state;
    107123
    108   TEST_BEGIN();
     124  ctx.thread = _Thread_Get_executing();
    109125
    110   thread = _Thread_Get_executing();
    111 
    112   puts( "Init - Trying to generate semaphore release from ISR while blocking" );
    113   puts( "Init - Variation is: " TEST_STRING );
    114126  status = rtems_semaphore_create(
    115127    rtems_build_name( 'S', 'M', '1', ' ' ),
     
    117129    SEMAPHORE_ATTRIBUTES,
    118130    RTEMS_NO_PRIORITY,
    119     &Semaphore
     131    &ctx.semaphore
    120132  );
    121   directive_failed( status, "rtems_semaphore_create of SM1" );
     133  T_rsc_success( status );
    122134
    123   interrupt_critical_section_test( test_body, NULL, test_release_from_isr );
     135  state = T_interrupt_test( &config, &ctx );
     136  T_eq_int( state, T_INTERRUPT_TEST_DONE );
    124137
    125   if ( case_hit ) {
    126     puts( "Init - Case hit" );
    127     TEST_END();
    128   } else
    129     puts( "Init - Case not hit - ran too long" );
     138  rtems_semaphore_delete( ctx.semaphore );
     139  T_rsc_success( status );
     140}
    130141
    131   rtems_test_exit(0);
     142static rtems_task Init( rtems_task_argument argument )
     143{
     144  rtems_test_run( argument, TEST_STATE );
    132145}
    133146
     
    138151
    139152#define CONFIGURE_MAXIMUM_TASKS       1
    140 #define CONFIGURE_MAXIMUM_TIMERS      1
    141153#define CONFIGURE_MAXIMUM_SEMAPHORES  1
    142 #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
    143154#define CONFIGURE_MICROSECONDS_PER_TICK  1000
    144155#if defined(PRIORITY_NO_TIMEOUT_REVERSE)
  • testsuites/sptests/spintrcritical02/spintrcritical02.scn

    r857a65d r21f7333  
    1 *** TEST INTERRUPT CRITICAL SECTION 02 ***
    2 Init - Trying to generate semaphore release from ISR while blocking
    3 Init - Variation is: FIFO/With Timeout
    4 Support - rtems_timer_create - creating timer 1
    5 Init - Case hit
    6 *** END OF TEST INTERRUPT CRITICAL SECTION 02 ***
     1*** BEGIN OF TEST SPINTRCRITICAL 2 ***
     2*** TEST VERSION: 6.0.0.929e49a54ab4d2d18c9fb8d03610614f63e25b8d
     3*** TEST STATE: EXPECTED_PASS
     4*** TEST BUILD: RTEMS_DEBUG RTEMS_POSIX_API RTEMS_SMP
     5*** TEST TOOLS: 10.0.1 20200406 (RTEMS 6, RSB bec88a6dd856892c3e66e4598252ea07d7a0d762, Newlib ece49e4)
     6A:SPINTRCRITICAL 2
     7S:Platform:RTEMS
     8S:Compiler:10.0.1 20200406 (RTEMS 6, RSB bec88a6dd856892c3e66e4598252ea07d7a0d762, Newlib ece49e4)
     9S:Version:6.0.0.929e49a54ab4d2d18c9fb8d03610614f63e25b8d
     10S:BSP:realview_pbx_a9_qemu
     11S:RTEMS_DEBUG:1
     12S:RTEMS_MULTIPROCESSING:0
     13S:RTEMS_POSIX_API:1
     14S:RTEMS_PROFILING:0
     15S:RTEMS_SMP:1
     16B:SemaphoreReleaseFIFOWithTimeout
     17P:0:0:UI1:spintrcritical01impl.h:133
     18P:1:0:UI1:spintrcritical01impl.h:136
     19P:2:0:UI1:spintrcritical01impl.h:139
     20E:SemaphoreReleaseFIFOWithTimeout:N:3:F:0:D:0.993665
     21Z:SPINTRCRITICAL 2:C:1:N:3:F:0:D:0.994790
     22Y:ReportHash:SHA256:39afd278c3a718205440e47e93954d7a87f2bbd49fbae108199b2dbdaeadc79e
     23
     24*** END OF TEST SPINTRCRITICAL 2 ***
  • testsuites/sptests/spintrcritical03/spintrcritical03.scn

    r857a65d r21f7333  
    1 *** TEST INTERRUPT CRITICAL SECTION 03 ***
    2 Init - Trying to generate semaphore release from ISR while blocking
    3 Init - Variation is: Priority/Without Timeout
    4 Support - rtems_timer_create - creating timer 1
    5 Init - Case hit
    6 *** END OF TEST INTERRUPT CRITICAL SECTION 03 ***
     1*** BEGIN OF TEST SPINTRCRITICAL 3 ***
     2*** TEST VERSION: 6.0.0.929e49a54ab4d2d18c9fb8d03610614f63e25b8d
     3*** TEST STATE: EXPECTED_PASS
     4*** TEST BUILD: RTEMS_DEBUG RTEMS_POSIX_API RTEMS_SMP
     5*** TEST TOOLS: 10.0.1 20200406 (RTEMS 6, RSB bec88a6dd856892c3e66e4598252ea07d7a0d762, Newlib ece49e4)
     6A:SPINTRCRITICAL 3
     7S:Platform:RTEMS
     8S:Compiler:10.0.1 20200406 (RTEMS 6, RSB bec88a6dd856892c3e66e4598252ea07d7a0d762, Newlib ece49e4)
     9S:Version:6.0.0.929e49a54ab4d2d18c9fb8d03610614f63e25b8d
     10S:BSP:realview_pbx_a9_qemu
     11S:RTEMS_DEBUG:1
     12S:RTEMS_MULTIPROCESSING:0
     13S:RTEMS_POSIX_API:1
     14S:RTEMS_PROFILING:0
     15S:RTEMS_SMP:1
     16B:SemaphoreReleasePriorityWithoutTimeout
     17P:0:0:UI1:spintrcritical01impl.h:133
     18P:1:0:UI1:spintrcritical01impl.h:136
     19P:2:0:UI1:spintrcritical01impl.h:139
     20E:SemaphoreReleasePriorityWithoutTimeout:N:3:F:0:D:0.992575
     21Z:SPINTRCRITICAL 3:C:1:N:3:F:0:D:0.993746
     22Y:ReportHash:SHA256:99f47d1893183fe1353cf36b2de6f27e11bae6e1fe4ce30a88e2140d941f93aa
     23
     24*** END OF TEST SPINTRCRITICAL 3 ***
  • testsuites/sptests/spintrcritical04/spintrcritical04.scn

    r857a65d r21f7333  
    1 *** TEST INTERRUPT CRITICAL SECTION 04 ***
    2 Init - Trying to generate semaphore release from ISR while blocking
    3 Init - Variation is: Priority/With Timeout
    4 Support - rtems_timer_create - creating timer 1
    5 Init - Case hit
    6 *** END OF TEST INTERRUPT CRITICAL SECTION 04 ***
     1*** BEGIN OF TEST SPINTRCRITICAL 4 ***
     2*** TEST VERSION: 6.0.0.929e49a54ab4d2d18c9fb8d03610614f63e25b8d
     3*** TEST STATE: EXPECTED_PASS
     4*** TEST BUILD: RTEMS_DEBUG RTEMS_POSIX_API RTEMS_SMP
     5*** TEST TOOLS: 10.0.1 20200406 (RTEMS 6, RSB bec88a6dd856892c3e66e4598252ea07d7a0d762, Newlib ece49e4)
     6A:SPINTRCRITICAL 4
     7S:Platform:RTEMS
     8S:Compiler:10.0.1 20200406 (RTEMS 6, RSB bec88a6dd856892c3e66e4598252ea07d7a0d762, Newlib ece49e4)
     9S:Version:6.0.0.929e49a54ab4d2d18c9fb8d03610614f63e25b8d
     10S:BSP:realview_pbx_a9_qemu
     11S:RTEMS_DEBUG:1
     12S:RTEMS_MULTIPROCESSING:0
     13S:RTEMS_POSIX_API:1
     14S:RTEMS_PROFILING:0
     15S:RTEMS_SMP:1
     16B:SemaphoreReleasePriorityWithTimeout
     17P:0:0:UI1:spintrcritical01impl.h:133
     18P:1:0:UI1:spintrcritical01impl.h:136
     19P:2:0:UI1:spintrcritical01impl.h:139
     20E:SemaphoreReleasePriorityWithTimeout:N:3:F:0:D:0.992884
     21Z:SPINTRCRITICAL 4:C:1:N:3:F:0:D:0.994078
     22Y:ReportHash:SHA256:9881b621230969971c290ca60c366534be09a32a291699bcc786d1e654ce305c
     23
     24*** END OF TEST SPINTRCRITICAL 4 ***
  • testsuites/sptests/spintrcritical05/spintrcritical05.scn

    r857a65d r21f7333  
    1 *** TEST INTERRUPT CRITICAL SECTION 05 ***
    2 Init - Trying to generate semaphore release from ISR while blocking
    3 Init - Variation is: Priority/Without Timeout (Reverse)
    4 Support - rtems_timer_create - creating timer 1
    5 Init - Case hit
    6 *** END OF TEST INTERRUPT CRITICAL SECTION 05 ***
     1*** BEGIN OF TEST SPINTRCRITICAL 5 ***
     2*** TEST VERSION: 6.0.0.929e49a54ab4d2d18c9fb8d03610614f63e25b8d
     3*** TEST STATE: EXPECTED_PASS
     4*** TEST BUILD: RTEMS_DEBUG RTEMS_POSIX_API RTEMS_SMP
     5*** TEST TOOLS: 10.0.1 20200406 (RTEMS 6, RSB bec88a6dd856892c3e66e4598252ea07d7a0d762, Newlib ece49e4)
     6A:SPINTRCRITICAL 5
     7S:Platform:RTEMS
     8S:Compiler:10.0.1 20200406 (RTEMS 6, RSB bec88a6dd856892c3e66e4598252ea07d7a0d762, Newlib ece49e4)
     9S:Version:6.0.0.929e49a54ab4d2d18c9fb8d03610614f63e25b8d
     10S:BSP:realview_pbx_a9_qemu
     11S:RTEMS_DEBUG:1
     12S:RTEMS_MULTIPROCESSING:0
     13S:RTEMS_POSIX_API:1
     14S:RTEMS_PROFILING:0
     15S:RTEMS_SMP:1
     16B:SemaphoreReleasePriorityWithoutTimeoutReverse
     17P:0:0:UI1:spintrcritical01impl.h:133
     18P:1:0:UI1:spintrcritical01impl.h:136
     19P:2:0:UI1:spintrcritical01impl.h:139
     20E:SemaphoreReleasePriorityWithoutTimeoutReverse:N:3:F:0:D:0.992161
     21Z:SPINTRCRITICAL 5:C:1:N:3:F:0:D:0.993438
     22Y:ReportHash:SHA256:577ac55f827103c83e8a851796041d45d9545e7f02e49417fdb0b876108c6327
     23
     24*** END OF TEST SPINTRCRITICAL 5 ***
Note: See TracChangeset for help on using the changeset viewer.