source: rtems/testsuites/smptests/smpunsupported01/init.c @ e9e0f1d4

5
Last change on this file since e9e0f1d4 was e9e0f1d4, checked in by Joel Sherrill <joel@…>, on 12/05/17 at 15:56:47

smpunsupported01: Add missing error check for rtems_task_mode

Update test documentation to include more cases.

Updates #3000.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 * Copyright (c) 2014 On-Line Applications Research Corporation (OAR).
3 * Copyright (c) 2013, 2016 embedded brains GmbH.  All rights reserved.
4 *
5 *  embedded brains GmbH
6 *  Dornierstr. 4
7 *  82178 Puchheim
8 *  Germany
9 *  <rtems@embedded-brains.de>
10 *
11 * The license and distribution terms for this file may be
12 * found in the file LICENSE in this distribution or at
13 * http://www.rtems.org/license/LICENSE.
14 */
15
16#ifdef HAVE_CONFIG_H
17  #include "config.h"
18#endif
19
20#include "tmacros.h"
21
22const char rtems_test_name[] = "SMPUNSUPPORTED 1";
23
24static void test(void)
25{
26  rtems_status_code sc;
27  rtems_mode mode;
28  rtems_id id;
29
30  rtems_test_assert(rtems_configuration_is_smp_enabled());
31
32  sc = rtems_task_mode(RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &mode);
33  rtems_test_assert(sc == RTEMS_NOT_IMPLEMENTED);
34
35  sc = rtems_task_create(
36    rtems_build_name('T', 'A', 'S', 'K'),
37    RTEMS_MINIMUM_PRIORITY,
38    RTEMS_MINIMUM_STACK_SIZE,
39    RTEMS_NO_PREEMPT,
40    RTEMS_DEFAULT_ATTRIBUTES,
41    &id
42  );
43  rtems_test_assert(sc == RTEMS_UNSATISFIED);
44
45  mode = RTEMS_INTERRUPT_LEVEL(0);
46  if (mode == 0) {
47    sc = rtems_task_mode(mode, RTEMS_INTERRUPT_MASK, &mode);
48    rtems_test_assert(sc == RTEMS_NOT_IMPLEMENTED);
49  }
50
51  mode = RTEMS_INTERRUPT_LEVEL(1);
52  if (mode != 0) {
53    sc = rtems_task_mode(mode, RTEMS_INTERRUPT_MASK, &mode);
54    rtems_test_assert(sc == RTEMS_NOT_IMPLEMENTED);
55
56    sc = rtems_task_create(
57      rtems_build_name('T', 'A', 'S', 'K'),
58      RTEMS_MINIMUM_PRIORITY,
59      RTEMS_MINIMUM_STACK_SIZE,
60      mode,
61      RTEMS_DEFAULT_ATTRIBUTES,
62      &id
63    );
64    rtems_test_assert(sc == RTEMS_UNSATISFIED);
65  } else {
66    puts("RTEMS_INTERRUPT_LEVEL(1) not supported on this platform");
67  }
68}
69
70static void Init(rtems_task_argument arg)
71{
72  TEST_BEGIN();
73
74  test();
75
76  TEST_END();
77  rtems_test_exit(0);
78}
79
80#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
81#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
82
83#define CONFIGURE_MAXIMUM_PROCESSORS 2
84
85#define CONFIGURE_MAXIMUM_TASKS 2
86
87#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
88
89#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
90
91#define CONFIGURE_INIT
92
93#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.