Changeset 8cbba449 in rtems


Ignore:
Timestamp:
Jul 20, 2020, 1:24:21 PM (3 weeks ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
5020a28
Parents:
be2f9d7
git-author:
Sebastian Huber <sebastian.huber@…> (07/20/20 13:24:21)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/23/20 07:27:47)
Message:

spintrcritical11/12: Use T_interrupt_test()

Location:
testsuites/sptests
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • testsuites/sptests/Makefile.am

    rbe2f9d7 r8cbba449  
    12711271sp_screens += spintrcritical11/spintrcritical11.scn
    12721272sp_docs += spintrcritical11/spintrcritical11.doc
    1273 spintrcritical11_SOURCES = spintrcritical11/init.c \
    1274         spintrcritical_support/intrcritical.c \
    1275         spintrcritical_support/intrcritical.h
     1273spintrcritical11_SOURCES = spintrcritical11/init.c
    12761274spintrcritical11_CPPFLAGS = $(AM_CPPFLAGS) \
    12771275        $(TEST_FLAGS_spintrcritical11) $(support_includes) \
     
    12831281sp_screens += spintrcritical12/spintrcritical12.scn
    12841282sp_docs += spintrcritical12/spintrcritical12.doc
    1285 spintrcritical12_SOURCES = spintrcritical12/init.c \
    1286         spintrcritical_support/intrcritical.c
     1283spintrcritical12_SOURCES = spintrcritical12/init.c
    12871284spintrcritical12_CPPFLAGS = $(AM_CPPFLAGS) \
    12881285        $(TEST_FLAGS_spintrcritical12) $(support_includes) \
  • testsuites/sptests/spintrcritical11/spintrcritical11.scn

    rbe2f9d7 r8cbba449  
    1 *** TEST INTERRUPT CRITICAL SECTION 11 ***
    2 Init - Test may not be able to detect case is hit reliably
    3 Init - Trying to generate event send from ISR while blocking
    4 Init - Variation is: Event Any condition
    5 Support - rtems_timer_create - creating timer 1
    6 *** END OF TEST INTERRUPT CRITICAL SECTION 11 ***
     1*** BEGIN OF TEST SPINTRCRITICAL 11 ***
     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 11
     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:EventReceiveInterruptAny
     17P:0:0:UI1:spintrcritical11impl.h:113
     18L:potential hits = 999
     19P:1:0:UI1:spintrcritical11impl.h:116
     20E:EventReceiveInterruptAny:N:2:F:0:D:1.058417
     21Z:SPINTRCRITICAL 11:C:1:N:2:F:0:D:1.059457
     22Y:ReportHash:SHA256:e666eb8c6287c596e6d1851fea90f50fdcc8a52c7799ede485964d09de3fc9ed
     23
     24*** END OF TEST SPINTRCRITICAL 11 ***
  • testsuites/sptests/spintrcritical11/spintrcritical11impl.h

    rbe2f9d7 r8cbba449  
    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 <string.h>
    1617
    17 /* forward declarations to avoid warnings */
    18 rtems_task Init(rtems_task_argument argument);
    19 rtems_timer_service_routine test_release_from_isr(rtems_id  timer, void *arg);
    20 
    21 rtems_id Main_task;
     18#include <rtems/test.h>
     19#include <rtems/test-info.h>
    2220
    2321#if defined(EVENT_ANY)
    2422  #define TEST_NAME          "11"
    25   #define TEST_STRING        "Event Any condition"
     23  #define TEST_STRING        Any
    2624  #define EVENTS_TO_SEND     0x1
    2725  #define EVENTS_TO_RECEIVE  0x3
     
    2927#elif defined(EVENT_ALL)
    3028  #define TEST_NAME          "12"
    31   #define TEST_STRING        "Event All condition"
     29  #define TEST_STRING        All
    3230  #define EVENTS_TO_SEND     0x3
    3331  #define EVENTS_TO_RECEIVE  0x3
     
    4038const char rtems_test_name[] = "SPINTRCRITICAL " TEST_NAME;
    4139
    42 rtems_timer_service_routine test_release_from_isr(
    43   rtems_id  timer,
    44   void     *arg
    45 )
     40typedef struct {
     41  rtems_id      main_task;
     42  long          potential_hits;
     43  volatile bool early;
     44  volatile bool late;
     45} test_context;
     46
     47static T_interrupt_test_state interrupt( void *arg )
    4648{
    47   (void) rtems_event_send( Main_task, EVENTS_TO_SEND );
     49  test_context           *ctx;
     50  T_interrupt_test_state  state;
     51  rtems_status_code       sc;
     52
     53  state = T_interrupt_test_get_state();
     54
     55  if ( state != T_INTERRUPT_TEST_ACTION ) {
     56    return T_INTERRUPT_TEST_CONTINUE;
     57  }
     58
     59  ctx = arg;
     60  sc = rtems_event_send( ctx->main_task, EVENTS_TO_SEND );
     61  T_quiet_rsc_success( sc );
     62
     63  if ( ctx->early ) {
     64    state = T_INTERRUPT_TEST_EARLY;
     65  } else if ( ctx->late ) {
     66    state = T_INTERRUPT_TEST_LATE;
     67  } else {
     68    ++ctx->potential_hits;
     69    state = T_INTERRUPT_TEST_CONTINUE;
     70  }
     71
     72  return state;
    4873}
    4974
    50 static bool test_body( void *arg )
     75static void prepare( void *arg )
    5176{
    52   rtems_event_set out;
     77  test_context    *ctx;
     78  rtems_event_set  out;
    5379
    54   (void) arg;
    55 
    56   rtems_event_receive( EVENTS_TO_RECEIVE, RTEMS_EVENT_ANY, 1, &out );
    57 
    58   return false;
     80  ctx = arg;
     81  ctx->early = true;
     82  ctx->late = false;
     83  (void ) rtems_event_receive( RTEMS_PENDING_EVENTS, RTEMS_NO_WAIT, 0, &out );
    5984}
    6085
    61 rtems_task Init(
    62   rtems_task_argument ignored
    63 )
     86static void action( void *arg )
    6487{
    65   TEST_BEGIN();
     88  test_context    *ctx;
     89  rtems_event_set  out;
    6690
    67   puts( "Init - Test may not be able to detect case is hit reliably" );
    68   puts( "Init - Trying to generate event send from ISR while blocking" );
    69   puts( "Init - Variation is: " TEST_STRING );
     91  ctx = arg;
     92  ctx->early = false;
     93  (void ) rtems_event_receive( EVENTS_TO_RECEIVE, RTEMS_EVENT_ANY, 1, &out );
     94  ctx->late = true;
     95}
    7096
    71   Main_task = rtems_task_self();
     97static const T_interrupt_test_config config = {
     98  .prepare = prepare,
     99  .action = action,
     100  .interrupt = interrupt,
     101  .max_iteration_count = 1000
     102};
    72103
    73   interrupt_critical_section_test( test_body, NULL, test_release_from_isr );
     104T_TEST_CASE( RTEMS_XCONCAT( EventReceiveInterrupt, TEST_STRING ) )
     105{
     106  test_context           ctx;
     107  T_interrupt_test_state state;
    74108
    75   TEST_END();
    76   rtems_test_exit(0);
     109  memset( &ctx, 0, sizeof( ctx ) );
     110  ctx.main_task = rtems_task_self();
     111
     112  state = T_interrupt_test( &config, &ctx );
     113  T_eq_int( state, T_INTERRUPT_TEST_TIMEOUT );
     114
     115  T_log( T_NORMAL, "potential hits = %ld", ctx.potential_hits );
     116  T_gt_long( ctx.potential_hits, 0 );
     117}
     118
     119static rtems_task Init( rtems_task_argument argument )
     120{
     121  rtems_test_run( argument, TEST_STATE );
    77122}
    78123
     
    82127#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
    83128
    84 #define CONFIGURE_MAXIMUM_TASKS       2
    85 #define CONFIGURE_MAXIMUM_TIMERS      1
    86 #define CONFIGURE_MAXIMUM_SEMAPHORES  1
    87 #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
     129#define CONFIGURE_MAXIMUM_TASKS       1
    88130#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
    89131
  • testsuites/sptests/spintrcritical12/spintrcritical12.scn

    rbe2f9d7 r8cbba449  
    1 *** TEST INTERRUPT CRITICAL SECTION 12 ***
    2 Init - Test may not be able to detect case is hit reliably
    3 Init - Trying to generate event send from ISR while blocking
    4 Init - Variation is: Event All condition
    5 Support - rtems_timer_create - creating timer 1
    6 *** END OF TEST INTERRUPT CRITICAL SECTION 12 ***
     1*** BEGIN OF TEST SPINTRCRITICAL 12 ***
     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 12
     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:EventReceiveInterruptAll
     17P:0:0:UI1:spintrcritical11impl.h:113
     18L:potential hits = 999
     19P:1:0:UI1:spintrcritical11impl.h:116
     20E:EventReceiveInterruptAll:N:2:F:0:D:1.057546
     21Z:SPINTRCRITICAL 12:C:1:N:2:F:0:D:1.058728
     22Y:ReportHash:SHA256:3b2267f65c7604b1fbf3da33492b23a658b32021755868bcf69b04fe69c7f85d
     23
     24*** END OF TEST SPINTRCRITICAL 12 ***
Note: See TracChangeset for help on using the changeset viewer.