source: rtems/testsuites/sptests/spfatal03/testcase.h @ 13a4c71c

4.104.115
Last change on this file since 13a4c71c was 1c5d8f49, checked in by Joel Sherrill <joel.sherrill@…>, on 07/16/09 at 14:57:36

2009-07-16 Joel Sherrill <joel.sherrill@…>

  • spfatal03/spfatal03.scn, spfatal03/testcase.h: Fix spfatal03 to do what it was intended to do.
  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 *  Semaphore Obtain in Critical Section
3 *
4 *  COPYRIGHT (c) 1989-2009.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
15
16#define CONFIGURE_MAXIMUM_SEMAPHORES 10
17
18#define FATAL_ERROR_DESCRIPTION          "Core Mutex obtain in critical section"
19#define FATAL_ERROR_EXPECTED_SOURCE      INTERNAL_ERROR_CORE
20#define FATAL_ERROR_EXPECTED_IS_INTERNAL FALSE
21#define FATAL_ERROR_EXPECTED_ERROR       INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE
22
23void force_error(void)
24{
25
26  rtems_status_code status;
27   rtems_id    mutex;
28
29  status = rtems_semaphore_create(
30    rtems_build_name( 'S','0',' ',' '),
31    1,
32    RTEMS_LOCAL|
33    RTEMS_SIMPLE_BINARY_SEMAPHORE,
34    0,
35    &mutex
36  );
37  directive_failed( status, "rtems_semaphore_create of S0");
38  puts("Create semaphore S0");
39
40  puts("Obtain semaphore in dispatching critical section");
41  _Thread_Disable_dispatch();
42  status = rtems_semaphore_obtain( mutex, RTEMS_DEFAULT_OPTIONS, 0 );
43  /* !!! SHOULD NOT RETURN FROM THE ABOVE CALL */
44
45  _Thread_Enable_dispatch();
46  puts("ERROR -- Obtain semaphore should not have returned");
47 
48  /* we will not run this far */
49}
Note: See TracBrowser for help on using the repository browser.