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

5
Last change on this file since acc9d064 was acc9d064, checked in by Sebastian Huber <sebastian.huber@…>, on 10/26/17 at 11:59:10

tests: Remove obsolete TESTS_USE_PRINTK

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#define TEST_INIT
20
21#include "tmacros.h"
22
23const char rtems_test_name[] = "SMPFATAL 3";
24
25static void bad( rtems_id timer_id, void *arg )
26{
27  rtems_id *sem_id;
28
29  sem_id = arg;
30
31  rtems_semaphore_obtain( *sem_id, RTEMS_WAIT, RTEMS_NO_TIMEOUT );
32  rtems_test_assert( 0 );
33}
34
35static void Init( rtems_task_argument arg )
36{
37  rtems_status_code sc;
38  rtems_id          timer_id;
39  rtems_id          sem_id;
40
41  TEST_BEGIN();
42
43  sc = rtems_semaphore_create(
44    rtems_build_name('M', 'R', 'S', 'P'),
45    1,
46    RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
47      | RTEMS_BINARY_SEMAPHORE,
48    1,
49    &sem_id
50  );
51  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
52
53  sc = rtems_timer_create(
54    rtems_build_name( 'E', 'V', 'I', 'L' ),
55    &timer_id
56  );
57  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
58
59  sc = rtems_semaphore_obtain( sem_id, RTEMS_WAIT, RTEMS_NO_TIMEOUT );
60  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
61
62  sc = rtems_timer_fire_after( timer_id, 1, bad, &sem_id );
63  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
64
65  rtems_task_wake_after( 2 );
66  rtems_test_assert( 0 );
67}
68
69static void fatal_extension(
70  rtems_fatal_source source,
71  bool always_set_to_false,
72  rtems_fatal_code code
73)
74{
75  if (
76    source == INTERNAL_ERROR_CORE
77      && !always_set_to_false
78      && code == INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_STICKY_FROM_BAD_STATE
79  ) {
80    TEST_END();
81  }
82}
83
84#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
85#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
86
87#define CONFIGURE_INITIAL_EXTENSIONS \
88  { .fatal = fatal_extension }, \
89  RTEMS_TEST_INITIAL_EXTENSION
90
91#define CONFIGURE_MAXIMUM_TASKS 1
92#define CONFIGURE_MAXIMUM_TIMERS 1
93#define CONFIGURE_MAXIMUM_MRSP_SEMAPHORES 1
94
95#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
96
97#define CONFIGURE_INIT
98
99#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.