1 | /* |
---|
2 | * Copyright (c) 2017 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.org/license/LICENSE. |
---|
13 | */ |
---|
14 | |
---|
15 | #ifdef HAVE_CONFIG_H |
---|
16 | #include "config.h" |
---|
17 | #endif |
---|
18 | |
---|
19 | #define TEST_INIT |
---|
20 | |
---|
21 | #define TESTS_USE_PRINTK |
---|
22 | #include "tmacros.h" |
---|
23 | |
---|
24 | #include <rtems.h> |
---|
25 | |
---|
26 | const char rtems_test_name[] = "SPFATAL 30"; |
---|
27 | |
---|
28 | #if (CPU_HARDWARE_FP == TRUE && CPU_ALL_TASKS_ARE_FP == FALSE) \ |
---|
29 | || SPARC_HAS_FPU == 1 |
---|
30 | #define EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT |
---|
31 | #endif |
---|
32 | |
---|
33 | static volatile double f = 1.0; |
---|
34 | |
---|
35 | static void Init(rtems_task_argument arg) |
---|
36 | { |
---|
37 | TEST_BEGIN(); |
---|
38 | |
---|
39 | f *= 123.456; |
---|
40 | |
---|
41 | #ifdef EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT |
---|
42 | rtems_test_assert(0); |
---|
43 | #else |
---|
44 | TEST_END(); |
---|
45 | rtems_test_exit(0); |
---|
46 | #endif |
---|
47 | } |
---|
48 | |
---|
49 | #ifdef EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT |
---|
50 | static void fatal_extension( |
---|
51 | rtems_fatal_source source, |
---|
52 | bool always_set_to_false, |
---|
53 | rtems_fatal_code code |
---|
54 | ) |
---|
55 | { |
---|
56 | if ( |
---|
57 | source == INTERNAL_ERROR_CORE |
---|
58 | && !always_set_to_false |
---|
59 | && code == INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT |
---|
60 | ) { |
---|
61 | TEST_END(); |
---|
62 | } |
---|
63 | } |
---|
64 | |
---|
65 | #define CONFIGURE_INITIAL_EXTENSIONS \ |
---|
66 | { .fatal = fatal_extension }, \ |
---|
67 | RTEMS_TEST_INITIAL_EXTENSION |
---|
68 | |
---|
69 | #else /* EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT */ |
---|
70 | |
---|
71 | #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION |
---|
72 | |
---|
73 | #endif /* EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT */ |
---|
74 | |
---|
75 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER |
---|
76 | |
---|
77 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
78 | |
---|
79 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
80 | |
---|
81 | #define CONFIGURE_INIT |
---|
82 | |
---|
83 | #include <rtems/confdefs.h> |
---|