1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
2 | |
---|
3 | /* |
---|
4 | * Copyright (c) 2012, 2020 embedded brains GmbH. All rights reserved. |
---|
5 | * |
---|
6 | * Redistribution and use in source and binary forms, with or without |
---|
7 | * modification, are permitted provided that the following conditions |
---|
8 | * are met: |
---|
9 | * 1. Redistributions of source code must retain the above copyright |
---|
10 | * notice, this list of conditions and the following disclaimer. |
---|
11 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
12 | * notice, this list of conditions and the following disclaimer in the |
---|
13 | * documentation and/or other materials provided with the distribution. |
---|
14 | * |
---|
15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
25 | * POSSIBILITY OF SUCH DAMAGE. |
---|
26 | */ |
---|
27 | |
---|
28 | #ifdef HAVE_CONFIG_H |
---|
29 | #include "config.h" |
---|
30 | #endif |
---|
31 | |
---|
32 | #include "tmacros.h" |
---|
33 | |
---|
34 | #include <rtems.h> |
---|
35 | |
---|
36 | const char rtems_test_name[] = "SPINTERNALERROR 2"; |
---|
37 | |
---|
38 | static void test_internal_error_text(void) |
---|
39 | { |
---|
40 | rtems_fatal_code error = 0; |
---|
41 | const char *text = NULL; |
---|
42 | const char *text_last; |
---|
43 | |
---|
44 | do { |
---|
45 | text_last = text; |
---|
46 | text = rtems_internal_error_text( error ); |
---|
47 | ++error; |
---|
48 | puts( text ); |
---|
49 | } while ( text != text_last ); |
---|
50 | |
---|
51 | rtems_test_assert( |
---|
52 | error - 3 == INTERNAL_ERROR_NO_MEMORY_FOR_IDLE_TASK_STORAGE |
---|
53 | ); |
---|
54 | } |
---|
55 | |
---|
56 | static void test_fatal_source_text(void) |
---|
57 | { |
---|
58 | rtems_fatal_source source = 0; |
---|
59 | const char *text = NULL; |
---|
60 | const char *text_last; |
---|
61 | |
---|
62 | do { |
---|
63 | text_last = text; |
---|
64 | text = rtems_fatal_source_text( source ); |
---|
65 | ++source; |
---|
66 | puts( text ); |
---|
67 | } while ( text != text_last ); |
---|
68 | |
---|
69 | rtems_test_assert( source - 3 == RTEMS_FATAL_SOURCE_SPURIOUS_INTERRUPT ); |
---|
70 | } |
---|
71 | |
---|
72 | static void test_status_text(void) |
---|
73 | { |
---|
74 | rtems_status_code code = 0; |
---|
75 | const char *text = NULL; |
---|
76 | const char *text_last; |
---|
77 | |
---|
78 | do { |
---|
79 | text_last = text; |
---|
80 | text = rtems_status_text( code ); |
---|
81 | ++code; |
---|
82 | puts( text ); |
---|
83 | } while ( text != text_last ); |
---|
84 | |
---|
85 | rtems_test_assert( code - 3 == RTEMS_PROXY_BLOCKING ); |
---|
86 | } |
---|
87 | |
---|
88 | static void Init(rtems_task_argument arg) |
---|
89 | { |
---|
90 | TEST_BEGIN(); |
---|
91 | |
---|
92 | test_internal_error_text(); |
---|
93 | test_fatal_source_text(); |
---|
94 | test_status_text(); |
---|
95 | |
---|
96 | TEST_END(); |
---|
97 | |
---|
98 | rtems_test_exit(0); |
---|
99 | } |
---|
100 | |
---|
101 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER |
---|
102 | #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER |
---|
103 | |
---|
104 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
105 | |
---|
106 | #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION |
---|
107 | |
---|
108 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
109 | |
---|
110 | #define CONFIGURE_INIT |
---|
111 | |
---|
112 | #include <rtems/confdefs.h> |
---|