1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
2 | |
---|
3 | /* |
---|
4 | * COPYRIGHT (c) 2013. |
---|
5 | * On-Line Applications Research Corporation (OAR). |
---|
6 | * |
---|
7 | * Redistribution and use in source and binary forms, with or without |
---|
8 | * modification, are permitted provided that the following conditions |
---|
9 | * are met: |
---|
10 | * 1. Redistributions of source code must retain the above copyright |
---|
11 | * notice, this list of conditions and the following disclaimer. |
---|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
13 | * notice, this list of conditions and the following disclaimer in the |
---|
14 | * documentation and/or other materials provided with the distribution. |
---|
15 | * |
---|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
26 | * POSSIBILITY OF SUCH DAMAGE. |
---|
27 | */ |
---|
28 | |
---|
29 | #ifdef HAVE_CONFIG_H |
---|
30 | #include "config.h" |
---|
31 | #endif |
---|
32 | |
---|
33 | #include <tmacros.h> |
---|
34 | #include "test_support.h" |
---|
35 | |
---|
36 | const char rtems_test_name[] = "SPCLOCK_ERR 2"; |
---|
37 | |
---|
38 | /* forward declaration to avoid warnings */ |
---|
39 | rtems_task Init(rtems_task_argument argument); |
---|
40 | |
---|
41 | rtems_task Init( |
---|
42 | rtems_task_argument argument |
---|
43 | ) |
---|
44 | { |
---|
45 | TEST_BEGIN(); |
---|
46 | |
---|
47 | rtems_time_of_day time; |
---|
48 | rtems_status_code status; |
---|
49 | |
---|
50 | status = rtems_io_close( 0xffff, 0x0000, NULL); |
---|
51 | fatal_directive_status( |
---|
52 | status, |
---|
53 | RTEMS_INVALID_NUMBER, |
---|
54 | "rtems_io_close with bad major number" |
---|
55 | ); |
---|
56 | puts( "TA1 - rtems_io_close - RTEMS_INVALID_NUMBER" ); |
---|
57 | status = rtems_io_control( 0xffff, 0x00000, NULL); |
---|
58 | fatal_directive_status( |
---|
59 | status, |
---|
60 | RTEMS_INVALID_NUMBER, |
---|
61 | "rtems_io_close with bad major number" |
---|
62 | ); |
---|
63 | puts( "TA1 - rtems_io_control - RTEMS_INVALID_NUMBER" ); |
---|
64 | status = rtems_io_initialize( 0xffff, 0x00000, NULL); |
---|
65 | fatal_directive_status( |
---|
66 | status, |
---|
67 | RTEMS_INVALID_NUMBER, |
---|
68 | "rtems_io_initialize with bad major number" |
---|
69 | ); |
---|
70 | puts( "TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER" ); |
---|
71 | status = rtems_io_open( 0xffff, 0x00000, NULL); |
---|
72 | fatal_directive_status( |
---|
73 | status, |
---|
74 | RTEMS_INVALID_NUMBER, |
---|
75 | "rtems_io_open with bad major number" |
---|
76 | ); |
---|
77 | puts( "TA1 - rtems_io_open - RTEMS_INVALID_NUMBER" ); |
---|
78 | status = rtems_io_read( 0xffff, 0x00000, NULL); |
---|
79 | fatal_directive_status( |
---|
80 | status, |
---|
81 | RTEMS_INVALID_NUMBER, |
---|
82 | "rtems_io_read with bad major number" |
---|
83 | ); |
---|
84 | puts( "TA1 - rtems_io_read - RTEMS_INVALID_NUMBER" ); |
---|
85 | status = rtems_io_write( 0xffff, 0x0ffff, NULL); |
---|
86 | fatal_directive_status( |
---|
87 | status, |
---|
88 | RTEMS_INVALID_NUMBER, |
---|
89 | "rtems_io_write with bad major number" |
---|
90 | ); |
---|
91 | puts( "TA1 - rtems_io_write - RTEMS_INVALID_NUMBER" ); |
---|
92 | |
---|
93 | build_time( &time, 12, 31, 2000, 23, 59, 59, 0 ); |
---|
94 | status = rtems_clock_set( &time ); |
---|
95 | directive_failed( status, "rtems_clock_set" ); |
---|
96 | print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" ); |
---|
97 | status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); |
---|
98 | status = rtems_clock_get_tod( &time ); |
---|
99 | directive_failed( status, "rtems_clock_set" ); |
---|
100 | print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" ); |
---|
101 | |
---|
102 | build_time( &time, 12, 31, 1999, 23, 59, 59, 0 ); |
---|
103 | status = rtems_clock_set( &time ); |
---|
104 | directive_failed( status, "rtems_clock_set" ); |
---|
105 | print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" ); |
---|
106 | status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); |
---|
107 | status = rtems_clock_get_tod( &time ); |
---|
108 | directive_failed( status, "rtems_clock_get_tod" ); |
---|
109 | print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" ); |
---|
110 | |
---|
111 | build_time( &time, 12, 31, 2099, 23, 59, 59, 0 ); |
---|
112 | status = rtems_clock_set( &time ); |
---|
113 | directive_failed( status, "rtems_clock_set" ); |
---|
114 | print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" ); |
---|
115 | status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); |
---|
116 | status = rtems_clock_get_tod( &time ); |
---|
117 | directive_failed( status, "rtems_clock_set" ); |
---|
118 | print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" ); |
---|
119 | |
---|
120 | build_time( &time, 1, 1, 2100, 0, 0, 0, 0 ); |
---|
121 | status = rtems_clock_set( &time ); |
---|
122 | fatal_directive_status( status, RTEMS_INVALID_CLOCK, "rtems_clock_set" ); |
---|
123 | print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_INVALID_CLOCK\n" ); |
---|
124 | status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); |
---|
125 | status = rtems_clock_get_tod( &time ); |
---|
126 | directive_failed( status, "rtems_clock_set" ); |
---|
127 | print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" ); |
---|
128 | |
---|
129 | build_time( &time, 12, 31, 1991, 23, 59, 59, 0 ); |
---|
130 | status = rtems_clock_set( &time ); |
---|
131 | directive_failed( status, "rtems_clock_set" ); |
---|
132 | print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" ); |
---|
133 | status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); |
---|
134 | status = rtems_clock_get_tod( &time ); |
---|
135 | directive_failed( status, "rtems_clock_set" ); |
---|
136 | print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" ); |
---|
137 | |
---|
138 | TEST_END(); |
---|
139 | } |
---|
140 | |
---|
141 | #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER |
---|
142 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
143 | |
---|
144 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
145 | #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION |
---|
146 | |
---|
147 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
148 | |
---|
149 | #define CONFIGURE_INIT |
---|
150 | |
---|
151 | #include <rtems/confdefs.h> |
---|
152 | /* end of file */ |
---|