source: rtems/testsuites/smptests/smpfatal03/init.c @ c4b8b147

5
Last change on this file since c4b8b147 was c4b8b147, checked in by Sebastian Huber <sebastian.huber@…>, on 11/03/17 at 07:35:38

tests: Use simple console driver

Update #3170.
Update #3199.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 * Copyright (c) 2016 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.com/license/LICENSE.
13 */
14
15#ifdef HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include "tmacros.h"
20
21const char rtems_test_name[] = "SMPFATAL 3";
22
23static void bad( rtems_id timer_id, void *arg )
24{
25  rtems_id *sem_id;
26
27  sem_id = arg;
28
29  rtems_semaphore_obtain( *sem_id, RTEMS_WAIT, RTEMS_NO_TIMEOUT );
30  rtems_test_assert( 0 );
31}
32
33static void Init( rtems_task_argument arg )
34{
35  rtems_status_code sc;
36  rtems_id          timer_id;
37  rtems_id          sem_id;
38
39  TEST_BEGIN();
40
41  sc = rtems_semaphore_create(
42    rtems_build_name('M', 'R', 'S', 'P'),
43    1,
44    RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
45      | RTEMS_BINARY_SEMAPHORE,
46    1,
47    &sem_id
48  );
49  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
50
51  sc = rtems_timer_create(
52    rtems_build_name( 'E', 'V', 'I', 'L' ),
53    &timer_id
54  );
55  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
56
57  sc = rtems_semaphore_obtain( sem_id, RTEMS_WAIT, RTEMS_NO_TIMEOUT );
58  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
59
60  sc = rtems_timer_fire_after( timer_id, 1, bad, &sem_id );
61  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
62
63  rtems_task_wake_after( 2 );
64  rtems_test_assert( 0 );
65}
66
67static void fatal_extension(
68  rtems_fatal_source source,
69  bool always_set_to_false,
70  rtems_fatal_code code
71)
72{
73  if (
74    source == INTERNAL_ERROR_CORE
75      && !always_set_to_false
76      && code == INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_STICKY_FROM_BAD_STATE
77  ) {
78    TEST_END();
79  }
80}
81
82#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
83#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
84
85#define CONFIGURE_INITIAL_EXTENSIONS \
86  { .fatal = fatal_extension }, \
87  RTEMS_TEST_INITIAL_EXTENSION
88
89#define CONFIGURE_MAXIMUM_TASKS 1
90#define CONFIGURE_MAXIMUM_TIMERS 1
91#define CONFIGURE_MAXIMUM_MRSP_SEMAPHORES 1
92
93#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
94
95#define CONFIGURE_INIT
96
97#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.