1 | SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause |
---|
2 | copyrights: |
---|
3 | - Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) |
---|
4 | enabled-by: true |
---|
5 | links: [] |
---|
6 | test-brief: | |
---|
7 | This test suite contains test cases which call in combination all functions |
---|
8 | included in the space profile. |
---|
9 | test-code: | |
---|
10 | #define NAME rtems_build_name('N', 'A', 'M', 'E') |
---|
11 | |
---|
12 | static void fatal_extension( |
---|
13 | rtems_fatal_source source, |
---|
14 | bool always_set_to_false, |
---|
15 | rtems_fatal_code error |
---|
16 | ) |
---|
17 | { |
---|
18 | T_make_runner(); |
---|
19 | T_step_eq_int(0, source, RTEMS_FATAL_SOURCE_APPLICATION); |
---|
20 | T_step_false(1, always_set_to_false, "always_set_to_false"); |
---|
21 | T_step_eq_ulong(2, error, 123); |
---|
22 | T_case_end(); |
---|
23 | T_run_finalize(); |
---|
24 | } |
---|
25 | |
---|
26 | static void Init(rtems_task_argument arg) |
---|
27 | { |
---|
28 | (void) arg; |
---|
29 | |
---|
30 | T_make_runner(); |
---|
31 | T_register(); |
---|
32 | T_run_all(); |
---|
33 | T_case_begin("SpaceProfileFatalError", NULL); |
---|
34 | T_plan(3); |
---|
35 | rtems_fatal(RTEMS_FATAL_SOURCE_APPLICATION, 123); |
---|
36 | } |
---|
37 | |
---|
38 | static char init_task_storage[RTEMS_MINIMUM_STACK_SIZE]; |
---|
39 | |
---|
40 | static char buffer[512]; |
---|
41 | |
---|
42 | static void check_task_context(T_event event, const char *name) |
---|
43 | { |
---|
44 | if (_System_state_Is_up(_System_state_Get())) { |
---|
45 | T_check_task_context(event, name); |
---|
46 | } |
---|
47 | } |
---|
48 | |
---|
49 | static const T_action actions[] = { |
---|
50 | T_report_hash_sha256, |
---|
51 | check_task_context, |
---|
52 | T_check_rtems_barriers, |
---|
53 | T_check_rtems_extensions, |
---|
54 | T_check_rtems_message_queues, |
---|
55 | T_check_rtems_partitions, |
---|
56 | T_check_rtems_periods, |
---|
57 | T_check_rtems_semaphores, |
---|
58 | T_check_rtems_tasks, |
---|
59 | T_check_rtems_timers |
---|
60 | }; |
---|
61 | |
---|
62 | static const T_config test_config = { |
---|
63 | .name = "SpaceProfile", |
---|
64 | .buf = buffer, |
---|
65 | .buf_size = sizeof(buffer), |
---|
66 | .putchar = rtems_put_char, |
---|
67 | .verbosity = T_VERBOSE, |
---|
68 | .now = T_now_clock, |
---|
69 | .action_count = T_ARRAY_SIZE(actions), |
---|
70 | .actions = actions |
---|
71 | }; |
---|
72 | |
---|
73 | static void init_task(void) |
---|
74 | { |
---|
75 | static const rtems_task_config task_config = { |
---|
76 | .name = NAME, |
---|
77 | .initial_priority = 1, |
---|
78 | .storage_area = init_task_storage, |
---|
79 | .storage_size = sizeof(init_task_storage), |
---|
80 | .initial_modes = RTEMS_DEFAULT_MODES, |
---|
81 | .attributes = RTEMS_DEFAULT_ATTRIBUTES |
---|
82 | }; |
---|
83 | rtems_id id; |
---|
84 | rtems_status_code sc; |
---|
85 | |
---|
86 | T_run_initialize(&test_config); |
---|
87 | T_case_begin("SpaceProfileTaskBuild", NULL); |
---|
88 | T_plan(2); |
---|
89 | |
---|
90 | sc = rtems_task_build(&task_config, &id); |
---|
91 | T_step_rsc_success(0, sc); |
---|
92 | |
---|
93 | sc = rtems_task_start(id, Init, 0); |
---|
94 | T_step_rsc_success(1, sc); |
---|
95 | |
---|
96 | T_check_rtems_tasks(T_EVENT_RUN_INITIALIZE_EARLY, T_case_name()); |
---|
97 | T_case_end(); |
---|
98 | } |
---|
99 | |
---|
100 | RTEMS_SYSINIT_ITEM( |
---|
101 | init_task, |
---|
102 | RTEMS_SYSINIT_CLASSIC_USER_TASKS, |
---|
103 | RTEMS_SYSINIT_ORDER_MIDDLE |
---|
104 | ); |
---|
105 | |
---|
106 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
107 | |
---|
108 | #define CONFIGURE_MAXIMUM_PROCESSORS 4 |
---|
109 | |
---|
110 | #define CONFIGURE_MAXIMUM_BARRIERS 1 |
---|
111 | |
---|
112 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 |
---|
113 | |
---|
114 | #define CONFIGURE_MAXIMUM_PARTITIONS 1 |
---|
115 | |
---|
116 | #define CONFIGURE_MAXIMUM_PERIODS 1 |
---|
117 | |
---|
118 | #define CONFIGURE_MAXIMUM_SEMAPHORES 1 |
---|
119 | |
---|
120 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
121 | |
---|
122 | #define CONFIGURE_MAXIMUM_TIMERS 1 |
---|
123 | |
---|
124 | #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 |
---|
125 | |
---|
126 | #define CONFIGURE_MESSAGE_BUFFER_MEMORY 1 |
---|
127 | |
---|
128 | #define CONFIGURE_MICROSECONDS_PER_TICK 10000 |
---|
129 | |
---|
130 | #define CONFIGURE_SCHEDULER_NAME NAME |
---|
131 | |
---|
132 | #define CONFIGURE_INITIAL_EXTENSIONS { .fatal = fatal_extension } |
---|
133 | |
---|
134 | /* Mandatory for space profile */ |
---|
135 | |
---|
136 | #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 0 |
---|
137 | |
---|
138 | #define CONFIGURE_DISABLE_NEWLIB_REENTRANCY |
---|
139 | |
---|
140 | #define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM |
---|
141 | |
---|
142 | #define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION |
---|
143 | |
---|
144 | #define CONFIGURE_IDLE_TASK_BODY _CPU_Thread_Idle_body |
---|
145 | |
---|
146 | #define CONFIGURE_INIT |
---|
147 | |
---|
148 | #include <rtems/confdefs.h> |
---|
149 | test-description: null |
---|
150 | test-includes: |
---|
151 | - rtems.h |
---|
152 | - rtems/bspIo.h |
---|
153 | - rtems/sysinit.h |
---|
154 | - rtems/score/sysstate.h |
---|
155 | test-local-includes: [] |
---|
156 | test-target: testsuites/validation/ts-space-profile.c |
---|
157 | type: test-suite |
---|