source: rtems/testsuites/sptests/spclock_err02/init.c

Last change on this file was c4b8b147, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 3, 2017 at 7:35:38 AM

tests: Use simple console driver

Update #3170.
Update #3199.

  • Property mode set to 100644
File size: 4.5 KB
Line 
1/*
2 *  COPYRIGHT (c) 2013.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.org/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <tmacros.h>
15#include "test_support.h"
16
17const char rtems_test_name[] = "SPCLOCK_ERR 2";
18
19/* forward declaration to avoid warnings */
20rtems_task Init(rtems_task_argument argument);
21
22rtems_task Init(
23  rtems_task_argument argument
24)
25{
26  TEST_BEGIN();
27
28  rtems_time_of_day time;
29  rtems_status_code status;
30
31  status = rtems_io_close( 0xffff, 0x0000, NULL);
32  fatal_directive_status(
33    status,
34    RTEMS_INVALID_NUMBER,
35    "rtems_io_close with bad major number"
36  );
37  puts( "TA1 - rtems_io_close - RTEMS_INVALID_NUMBER" );
38  status = rtems_io_control( 0xffff, 0x00000, NULL);
39  fatal_directive_status(
40    status,
41    RTEMS_INVALID_NUMBER,
42    "rtems_io_close with bad major number"
43  );
44  puts( "TA1 - rtems_io_control - RTEMS_INVALID_NUMBER" );
45  status = rtems_io_initialize( 0xffff, 0x00000, NULL);
46  fatal_directive_status(
47    status,
48    RTEMS_INVALID_NUMBER,
49    "rtems_io_initialize with bad major number"
50  );
51  puts( "TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER" );
52  status = rtems_io_open( 0xffff, 0x00000, NULL);
53  fatal_directive_status(
54    status,
55    RTEMS_INVALID_NUMBER,
56    "rtems_io_open with bad major number"
57  );
58  puts( "TA1 - rtems_io_open - RTEMS_INVALID_NUMBER" );
59  status = rtems_io_read( 0xffff, 0x00000, NULL);
60  fatal_directive_status(
61    status,
62    RTEMS_INVALID_NUMBER,
63    "rtems_io_read with bad major number"
64  );
65  puts( "TA1 - rtems_io_read - RTEMS_INVALID_NUMBER" );
66  status = rtems_io_write( 0xffff, 0x0ffff, NULL);
67  fatal_directive_status(
68    status,
69    RTEMS_INVALID_NUMBER,
70    "rtems_io_write with bad major number"
71  );
72  puts( "TA1 - rtems_io_write - RTEMS_INVALID_NUMBER" );
73
74  build_time( &time, 12, 31, 2000, 23, 59, 59, 0 );
75  status = rtems_clock_set( &time );
76  directive_failed( status, "rtems_clock_set" );
77  print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
78  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
79  status = rtems_clock_get_tod( &time );
80  directive_failed( status, "rtems_clock_set" );
81  print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
82
83  build_time( &time, 12, 31, 1999, 23, 59, 59, 0 );
84  status = rtems_clock_set( &time );
85  directive_failed( status, "rtems_clock_set" );
86  print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
87  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
88  status = rtems_clock_get_tod( &time );
89  directive_failed( status, "rtems_clock_get_tod" );
90  print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
91
92  build_time( &time, 12, 31, 2100, 23, 59, 59, 0 );
93  status = rtems_clock_set( &time );
94  directive_failed( status, "rtems_clock_set" );
95  print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
96  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
97  status = rtems_clock_get_tod( &time );
98  directive_failed( status, "rtems_clock_set" );
99  print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
100
101  build_time( &time, 12, 31, 2099, 23, 59, 59, 0 );
102  status = rtems_clock_set( &time );
103  directive_failed( status, "rtems_clock_set" );
104  print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
105  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
106  status = rtems_clock_get_tod( &time );
107  directive_failed( status, "rtems_clock_set" );
108  print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
109
110  build_time( &time, 12, 31, 1991, 23, 59, 59, 0 );
111  status = rtems_clock_set( &time );
112  directive_failed( status, "rtems_clock_set" );
113  print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
114  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
115  status = rtems_clock_get_tod( &time );
116  directive_failed( status, "rtems_clock_set" );
117  print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
118
119  TEST_END();
120}
121
122#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
123#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
124
125#define CONFIGURE_MAXIMUM_TASKS             1
126#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
127
128#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
129
130#define CONFIGURE_INIT
131
132#include <rtems/confdefs.h>
133/* end of file */
Note: See TracBrowser for help on using the repository browser.