summaryrefslogtreecommitdiff
path: root/testsuites/validation/tr-model-events-mgr.c
blob: b677fb3c82837132b0505289f6b8c59d530f4a1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
/* SPDX-License-Identifier: BSD-2-Clause */

/*
 * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * This file was automatically generated.  Do not edit it manually.
 * Please have a look at
 *
 * https://docs.rtems.org/branches/master/eng/req/howto.html
 *
 * for information how to maintain and re-generate this file.
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <rtems/score/threadimpl.h>

#include "tr-model-events-mgr.h"

#include <rtems/test.h>

typedef enum {
  PRIO_HIGH = 1,
  PRIO_NORMAL,
  PRIO_LOW,
  PRIO_OTHER
} Priorities;

typedef enum {
  SENDER_NONE,
  SENDER_SELF,
  SENDER_SELF_2,
  SENDER_WORKER,
  SENDER_INTERRUPT
} SenderTypes;

typedef enum {
  RECEIVE_SKIP,
  RECEIVE_NORMAL,
  RECEIVE_INTERRUPT
} ReceiveTypes;

typedef enum {
  RECEIVE_COND_UNKNOWN,
  RECEIVE_COND_SATSIFIED,
  RECEIVE_COND_UNSATISFIED
} ReceiveConditionStates;

typedef struct {
  SenderTypes sender_type;
  Priorities sender_prio; // sender task priority.
  rtems_id receiver_id; // receiver ID used for the event send action.
  rtems_event_set events_to_send; // events to send for the event send action
  rtems_status_code send_status; // status of the event send action.
  ReceiveTypes receive_type; // scheduler ID of the runner task.
  rtems_option receive_option_set; // option set used for the event receive action
  rtems_interval receive_timeout; // timeout used for the event receive action
  rtems_event_set received_events; // events received by the event receive action
  rtems_status_code receive_status; // status of the event receive action
  ReceiveConditionStates receive_condition_state; // event conditon state of the
                                    // receiver task after the event send action
  rtems_event_set unsatisfied_pending; // pending events after an event send action
                       // which did not satsify the event condition of the receiver
  Thread_Control *runner_thread; // TCB of the runner task
  rtems_id runner_id; // ID of the runner task
  rtems_id worker_id; // task ID of the worker task
  rtems_id worker_wakeup; // ID of the semaphore used to wake up the worker task
  rtems_id runner_wakeup; // ID of the semaphore used to wake up the runner task
  rtems_id runner_sched; // scheduler ID of scheduler used by the runner task
  rtems_id other_sched; // scheduler ID of another scheduler
                        // which is not used by the runner task
  T_thread_switch_log_4 thread_switch_log; // thread switch log
  rtems_status_code ( *send )( rtems_id, rtems_event_set ); // copy of the
                       // corresponding RtemsModelEventsMgr_Run() parameter
  rtems_status_code ( *receive )
                    ( rtems_event_set, rtems_option
                    , rtems_interval, rtems_event_set * ); // copy of the
                 // corresponding RtemsModelEventsMgr_Run() parameter
  rtems_event_set ( *get_pending_events )( Thread_Control * ); // copy of the
                    // corresponding RtemsModelEventsMgr_Run() parameter
  unsigned int wait_class; // copy of the corresponding
                           // RtemsModelEventsMgr_Run() parameter
  int waiting_for_event; // copy of the corresponding
                         // RtemsModelEventsMgr_Run() parameter
  size_t pcs[ 4 ]; // pre-condition states for the next action
  bool in_action_loop; // indicates if test action loop is currently executed.
} RtemsModelEventsMgr_Context;

static RtemsModelEventsMgr_Context
  RtemsModelEventsMgr_Instance;

static const char * const RtemsModelEventsMgr_PreDesc_Id[] = {
  "InvId",
  "Task",
  "NA"
};

static const char * const RtemsModelEventsMgr_PreDesc_Send[] = {
  "Zero",
  "Unrelated",
  "Any",
  "All",
  "MixedAny",
  "MixedAll",
  "NA"
};

static const char * const RtemsModelEventsMgr_PreDesc_ReceiverState[] = {
  "NotWaiting",
  "Poll",
  "Timeout",
  "Lower",
  "Equal",
  "Higher",
  "Other",
  "Intend",
  "NA"
};

static const char * const RtemsModelEventsMgr_PreDesc_Satisfy[] = {
  "All",
  "Any",
  "NA"
};

static const char * const * const RtemsModelEventsMgr_PreDesc[] = {
  RtemsModelEventsMgr_PreDesc_Id,
  RtemsModelEventsMgr_PreDesc_Send,
  RtemsModelEventsMgr_PreDesc_ReceiverState,
  RtemsModelEventsMgr_PreDesc_Satisfy,
  NULL
};

#define INPUT_EVENTS ( RTEMS_EVENT_5 | RTEMS_EVENT_23 )

#define WORKER_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES

#define MAX_TLS_SIZE RTEMS_ALIGN_UP( 64, RTEMS_TASK_STORAGE_ALIGNMENT )

typedef RtemsModelEventsMgr_Context Context;

RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) static char WorkerStorage[
  RTEMS_TASK_STORAGE_SIZE(
    MAX_TLS_SIZE + RTEMS_MINIMUM_STACK_SIZE,
    WORKER_ATTRIBUTES
  )
];

static const rtems_task_config WorkerConfig = {
  .name = rtems_build_name( 'W', 'O', 'R', 'K' ),
  .initial_priority = PRIO_LOW,
  .storage_area = WorkerStorage,
  .storage_size = sizeof( WorkerStorage ),
  .maximum_thread_local_storage_size = MAX_TLS_SIZE,
  .initial_modes = RTEMS_DEFAULT_MODES,
  .attributes = WORKER_ATTRIBUTES
};

static rtems_id CreateWakeupSema( void )
{
  rtems_status_code sc;
  rtems_id id;

  sc = rtems_semaphore_create(
    rtems_build_name( 'W', 'K', 'U', 'P' ),
    0,
    RTEMS_SIMPLE_BINARY_SEMAPHORE,
    0,
    &id
  );
  T_assert_rsc_success( sc );

  return id;
}

static void DeleteWakeupSema( rtems_id id )
{
  if ( id != 0 ) {
    rtems_status_code sc;

    sc = rtems_semaphore_delete( id );
    T_rsc_success( sc );
  }
}

static void Wait( rtems_id id )
{
  rtems_status_code sc;

  sc = rtems_semaphore_obtain( id, RTEMS_WAIT, RTEMS_NO_TIMEOUT );
  T_quiet_rsc_success( sc );
}

static void Wakeup( rtems_id id )
{
  rtems_status_code sc;

  sc = rtems_semaphore_release( id );
  T_quiet_rsc_success( sc );
}


static bool IsSatisfiedState( Context *ctx )
{
  return ctx->runner_thread->current_state != ctx->waiting_for_event;
}

static void SendAction( Context *ctx )
{
  T_thread_switch_log *log;

  log = T_thread_switch_record_4( &ctx->thread_switch_log );
  T_quiet_null( log );
  ctx->send_status = ( *ctx->send )( ctx->receiver_id, ctx->events_to_send );
  log = T_thread_switch_record( NULL );
  T_quiet_eq_ptr( log, &ctx->thread_switch_log.log );
}

static void Send(
  Context *ctx,
  bool  ( *is_satsified )( Context * )
)
{
  SendAction( ctx );

  if ( ( *is_satsified )( ctx ) ) {
    ctx->receive_condition_state = RECEIVE_COND_SATSIFIED;
  } else {
    rtems_status_code sc;
    rtems_event_set pending;
    rtems_event_set missing;

    ctx->receive_condition_state = RECEIVE_COND_UNSATISFIED;
    pending = ( *ctx->get_pending_events )( ctx->runner_thread );
    ctx->unsatisfied_pending = pending;

    missing = INPUT_EVENTS & ~ctx->events_to_send;
    T_ne_u32( missing, 0 );
    sc = ( *ctx->send )( ctx->runner_id, missing );
    T_rsc_success( sc );

    pending = ( *ctx->get_pending_events )( ctx->runner_thread );
    T_eq_u32( pending, ctx->events_to_send & ~INPUT_EVENTS );
  }
}

static rtems_event_set GetPendingEvents( Context *ctx )
{
  rtems_event_set pending;
  rtems_status_code sc;

  sc = ( *ctx->receive )(
    RTEMS_PENDING_EVENTS,
    RTEMS_DEFAULT_OPTIONS,
    0,
    &pending
  );
  T_quiet_rsc_success( sc );

  return pending;
}


static rtems_option mergeopts( bool wait, bool wantall )
{
  rtems_option opts;

  if ( wait ) { opts = RTEMS_WAIT; }
  else { opts = RTEMS_NO_WAIT; } ;
  if ( wantall ) { opts |= RTEMS_EVENT_ALL; }
  else { opts |= RTEMS_EVENT_ANY; } ;
  return opts;
}


/*
 * Here we need a mapping from model "task numbers/names" to thread Id's here
 *  Promela Process 3 corresponds to Task 0 (Worker), doing Send
 *  Promela Process 4 corresponds to Task 1 (Runner), doing Receive
 */
static rtems_id mapid( Context *ctx, int pid )
{
  rtems_id mapped_id;

  switch ( pid ) {
    case 0 : mapped_id = ctx->worker_id ; break;
    case 1 : mapped_id = ctx->runner_id; break;
    default : mapped_id = 0xffffffff; break;
  }
  return mapped_id;
}

static void checkTaskIs( rtems_id expected_id )
{
  rtems_id own_id;

  own_id = _Thread_Get_executing()->Object.id;
  T_eq_u32( own_id, expected_id );
}

static void initialise_pending( rtems_event_set pending[], int max )
{
  int i;

  for( i=0; i < max; i++ ) {
    pending[i] = 0;
  }
}

static void initialise_semaphore( Context *ctx, rtems_id semaphore[] )
{
  semaphore[0] = ctx->worker_wakeup;
  semaphore[1] = ctx->runner_wakeup;
}

/* =============================================== */

#define NO_OF_EVENTS 4
#define EVTS_NONE 0
#define EVTS_PENDING 0
#define EVT_0 1
#define EVT_1 2
#define EVT_2 4
#define EVT_3 8
#define NO_TIMEOUT 0
#define TASK_MAX 2
#define BAD_ID 2
#define SEMA_MAX 2
#define RC_OK RTEMS_SUCCESSFUL
#define RC_InvId RTEMS_INVALID_ID
#define RC_InvAddr RTEMS_INVALID_ADDRESS
#define RC_Unsat RTEMS_UNSATISFIED
#define RC_Timeout RTEMS_TIMEOUT
rtems_event_set pending[TASK_MAX];
static unsigned int sendrc = 0;
static unsigned int recrc = 0;
static unsigned int recout = 0;
rtems_id semaphore[SEMA_MAX];

/* ===== TEST CODE SEGMENT 0 =====*/

static void TestSegment0( Context* ctx ) {
  initialise_pending( pending, TASK_MAX );
  initialise_semaphore( ctx, semaphore );
  
}

/* ===== TEST CODE SEGMENT 3 =====*/

static void TestSegment3( Context* ctx ) {
  checkTaskIs( ctx->worker_id );
  Wait( semaphore[0] );
  
  pending[1] = GetPendingEvents( ctx );
  T_eq_int( pending[1], 0 );
  
  T_log( T_NORMAL, "Calling Send(%d,%d)", mapid( ctx, 1), 14 );
  sendrc = rtems_event_send( mapid( ctx, 1 ), 14 );
  T_log( T_NORMAL, "Returned 0x%x from Send", sendrc );
  
  T_eq_int( sendrc, 0 );
  pending[1] = GetPendingEvents( ctx );
  T_eq_int( pending[1], 14 );
  
  Wakeup( semaphore[1] );
  
  /* Code to check that Task 0 has terminated */
}

/* ===== TEST CODE SEGMENT 4 =====*/

static void TestSegment4( Context* ctx ) {
  checkTaskIs( ctx->runner_id );
  Wakeup( semaphore[0] );
  
  Wait( semaphore[1] );
  
  pending[1] = GetPendingEvents( ctx );
  T_eq_int( pending[1], 14 );
  
  T_log( T_NORMAL, "Calling Receive(%d,%d,%d,%d)", 10, mergeopts( 1, 1 ) ,0 ,&recout );
  recrc = rtems_event_receive( 10, mergeopts( 1, 1 ), 0, &recout );
  T_log( T_NORMAL, "Returned 0x%x from Receive", recrc );
  
  T_eq_int( recrc, 0 );
  T_eq_int( recout, 10 );
  pending[1] = GetPendingEvents( ctx );
  T_eq_int( pending[1], 4 );
  
  Wakeup( semaphore[0] );
  
  /* Code to check that Task 1 has terminated */
}

/* =============================================== */


static void Worker( rtems_task_argument arg )
{
  Context *ctx;

  ctx = (Context *) arg;

  T_log( T_NORMAL, "Worker Running" );
  TestSegment3( ctx );
  T_log( T_NORMAL, "Worker finished" );

  rtems_task_exit();

  // while(true) {
  // Wait( ctx->worker_wakeup );
  //
  // switch ( ctx->sender_prio ) {
  //   case PRIO_NORMAL:
  //   case PRIO_HIGH:
  //     prio = 0;
  //     sc = rtems_task_set_priority( RTEMS_SELF, ctx->sender_prio, &prio );
  //     T_rsc_success( sc );
  //     T_eq_u32( prio, PRIO_LOW );
  //     break;
  //   case PRIO_OTHER:
  //     sc = rtems_task_set_scheduler(
  //       RTEMS_SELF,
  //       ctx->other_sched,
  //       PRIO_LOW
  //     );
  //     T_rsc_success( sc );
  //     break;
  //   case PRIO_LOW:
  //     break;
  // }
  //
  // Send( ctx, IsSatisfiedState );
  //
  // sc = rtems_task_set_scheduler(
  //   RTEMS_SELF,
  //   ctx->runner_sched,
  //   PRIO_HIGH
  // );
  // T_rsc_success( sc );
  //
  // Wakeup( ctx->runner_wakeup );
  // }
}


static void Runner( RtemsModelEventsMgr_Context *ctx )
{
  T_log( T_NORMAL, "Runner running" );
  TestSegment4( ctx );
  T_log( T_NORMAL, "Runner finished" );
}


static void RtemsModelEventsMgr_Setup(
  RtemsModelEventsMgr_Context *ctx
)
{
  rtems_status_code   sc;
  rtems_task_priority prio;

  T_log( T_NORMAL, "Runner Setup" );

  memset( ctx, 0, sizeof( *ctx ) );
  ctx->runner_thread = _Thread_Get_executing();
  ctx->runner_id = ctx->runner_thread->Object.id;
  ctx->worker_wakeup = CreateWakeupSema();
  ctx->runner_wakeup = CreateWakeupSema();

  sc = rtems_task_get_scheduler( RTEMS_SELF, &ctx->runner_sched );
  T_rsc_success( sc );

  #if defined(RTEMS_SMP)
  sc = rtems_scheduler_ident_by_processor( 1, &ctx->other_sched );
  T_rsc_success( sc );
  T_ne_u32( ctx->runner_sched, ctx->other_sched );
  #endif

  prio = 0;
  sc = rtems_task_set_priority( RTEMS_SELF, PRIO_NORMAL, &prio );
  T_rsc_success( sc );
  T_eq_u32( prio, PRIO_HIGH );

  sc = rtems_task_construct( &WorkerConfig, &ctx->worker_id );
  T_log( T_NORMAL, "Construct Worker, sc = %x", sc );
  T_assert_rsc_success( sc );

  sc = rtems_task_start( ctx->worker_id, Worker, (rtems_task_argument) ctx );
  T_log( T_NORMAL, "Start Worker, sc = %x", sc );
  T_assert_rsc_success( sc );
}

static void RtemsModelEventsMgr_Setup_Wrap( void *arg )
{
  RtemsModelEventsMgr_Context *ctx;

  ctx = arg;
  ctx->in_action_loop = false;
  RtemsModelEventsMgr_Setup( ctx );
}

static void RtemsModelEventsMgr_Teardown(
  RtemsModelEventsMgr_Context *ctx
)
{
  rtems_status_code   sc;
  rtems_task_priority prio;

  T_log( T_NORMAL, "Runner Teardown" );

  prio = 0;
  sc = rtems_task_set_priority( RTEMS_SELF, PRIO_HIGH, &prio );
  T_rsc_success( sc );
  T_eq_u32( prio, PRIO_NORMAL );

  if ( ctx->worker_id != 0 ) {
    sc = rtems_task_delete( ctx->worker_id );
    T_rsc_success( sc );
  }

  DeleteWakeupSema( ctx->worker_wakeup );
  DeleteWakeupSema( ctx->runner_wakeup );
}

static void RtemsModelEventsMgr_Teardown_Wrap( void *arg )
{
  RtemsModelEventsMgr_Context *ctx;

  ctx = arg;
  ctx->in_action_loop = false;
  RtemsModelEventsMgr_Teardown( ctx );
}

static size_t RtemsModelEventsMgr_Scope( void *arg, char *buf, size_t n )
{
  RtemsModelEventsMgr_Context *ctx;

  ctx = arg;

  if ( ctx->in_action_loop ) {
    return T_get_scope( RtemsModelEventsMgr_PreDesc, buf, n, ctx->pcs );
  }

  return 0;
}

static T_fixture RtemsModelEventsMgr_Fixture = {
  .setup = RtemsModelEventsMgr_Setup_Wrap,
  .stop = NULL,
  .teardown = RtemsModelEventsMgr_Teardown_Wrap,
  .scope = RtemsModelEventsMgr_Scope,
  .initial_context = &RtemsModelEventsMgr_Instance
};



static void RtemsModelEventsMgr_Cleanup(
  RtemsModelEventsMgr_Context *ctx
)
{
  rtems_status_code sc;
  rtems_event_set events;

  events = 0;
  sc = ( *ctx->receive )(
    RTEMS_ALL_EVENTS,
    RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
    0,
    &events
  );
  if ( sc == RTEMS_SUCCESSFUL ) {
    T_quiet_ne_u32( events, 0 );
  } else {
    T_quiet_rsc( sc, RTEMS_UNSATISFIED );
    T_quiet_eq_u32( events, 0 );
  }
}


static T_fixture_node RtemsModelEventsMgr_Node;

void RtemsModelEventsMgr_Run(
  rtems_status_code ( *send )( rtems_id, rtems_event_set ),
  rtems_status_code ( *receive )( rtems_event_set, rtems_option, rtems_interval, rtems_event_set * ),
  rtems_event_set (   *get_pending_events )( Thread_Control * ),
  unsigned int         wait_class,
  int                  waiting_for_event
)
{
  RtemsModelEventsMgr_Context *ctx;

  // T_set_verbosity( T_VERBOSE );

  T_log( T_NORMAL, "Pushing Test Fixture..." );

  ctx = T_push_fixture(
    &RtemsModelEventsMgr_Node,
    &RtemsModelEventsMgr_Fixture
  );

  T_log( T_NORMAL, "Test Fixture Pushed" );

  ctx->send = send;
  ctx->receive = receive;
  ctx->get_pending_events = get_pending_events;
  ctx->wait_class = wait_class;
  ctx->waiting_for_event = waiting_for_event;
  ctx->in_action_loop = true;

  // RtemsModelEventsMgr_Prepare( ctx );
  ctx->events_to_send = 0;
  ctx->send_status = RTEMS_INCORRECT_STATE;
  ctx->received_events = 0xffffffff;
  ctx->receive_option_set = 0;
  ctx->receive_timeout = RTEMS_NO_TIMEOUT;
  ctx->sender_type = SENDER_NONE;
  ctx->sender_prio = PRIO_NORMAL;
  ctx->receive_type = RECEIVE_SKIP;
  ctx->receive_condition_state = RECEIVE_COND_UNKNOWN;
  ctx->unsatisfied_pending = 0xffffffff;
  memset( &ctx->thread_switch_log, 0, sizeof( ctx->thread_switch_log ) );
  T_eq_u32( GetPendingEvents( ctx ), 0 );
  _Thread_Wait_flags_set( ctx->runner_thread, THREAD_WAIT_FLAGS_INITIAL );

  TestSegment0( ctx );

  Runner( ctx );

  RtemsModelEventsMgr_Cleanup( ctx );

  T_log( T_NORMAL, "Run Pop Fixture" );
  T_pop_fixture();
}

/** @} */