source: rtems/testsuites/sptests/spclock_err02/init.c @ 7b5f6643

4.11
Last change on this file since 7b5f6643 was 7b5f6643, checked in by Chirayu Desai <cdesai@…>, on Dec 24, 2013 at 1:32:37 PM

sptests: refactor sp09/screen13 into a new test spclock_err02

  • Property mode set to 100644
File size: 4.4 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.com/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
17/* forward declaration to avoid warnings */
18rtems_task Init(rtems_task_argument argument);
19
20rtems_task Init(
21  rtems_task_argument argument
22)
23{
24  puts( "\n\n*** TEST SPCLOCK_ERR02 ***" );
25
26  rtems_time_of_day time;
27  rtems_status_code status;
28
29  status = rtems_io_close( 0xffff, 0x0000, NULL);
30  fatal_directive_status(
31    status,
32    RTEMS_INVALID_NUMBER,
33    "rtems_io_close with bad major number"
34  );
35  puts( "TA1 - rtems_io_close - RTEMS_INVALID_NUMBER" );
36  status = rtems_io_control( 0xffff, 0x00000, NULL);
37  fatal_directive_status(
38    status,
39    RTEMS_INVALID_NUMBER,
40    "rtems_io_close with bad major number"
41  );
42  puts( "TA1 - rtems_io_control - RTEMS_INVALID_NUMBER" );
43  status = rtems_io_initialize( 0xffff, 0x00000, NULL);
44  fatal_directive_status(
45    status,
46    RTEMS_INVALID_NUMBER,
47    "rtems_io_initialize with bad major number"
48  );
49  puts( "TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER" );
50  status = rtems_io_open( 0xffff, 0x00000, NULL);
51  fatal_directive_status(
52    status,
53    RTEMS_INVALID_NUMBER,
54    "rtems_io_open with bad major number"
55  );
56  puts( "TA1 - rtems_io_open - RTEMS_INVALID_NUMBER" );
57  status = rtems_io_read( 0xffff, 0x00000, NULL);
58  fatal_directive_status(
59    status,
60    RTEMS_INVALID_NUMBER,
61    "rtems_io_read with bad major number"
62  );
63  puts( "TA1 - rtems_io_read - RTEMS_INVALID_NUMBER" );
64  status = rtems_io_write( 0xffff, 0x0ffff, NULL);
65  fatal_directive_status(
66    status,
67    RTEMS_INVALID_NUMBER,
68    "rtems_io_write with bad major number"
69  );
70  puts( "TA1 - rtems_io_write - RTEMS_INVALID_NUMBER" );
71
72  build_time( &time, 12, 31, 2000, 23, 59, 59, 0 );
73  status = rtems_clock_set( &time );
74  directive_failed( status, "rtems_clock_set" );
75  print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
76  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
77  status = rtems_clock_get_tod( &time );
78  directive_failed( status, "rtems_clock_set" );
79  print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
80
81  build_time( &time, 12, 31, 1999, 23, 59, 59, 0 );
82  status = rtems_clock_set( &time );
83  directive_failed( status, "rtems_clock_set" );
84  print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
85  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
86  status = rtems_clock_get_tod( &time );
87  directive_failed( status, "rtems_clock_get_tod" );
88  print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
89
90  build_time( &time, 12, 31, 2100, 23, 59, 59, 0 );
91  status = rtems_clock_set( &time );
92  directive_failed( status, "rtems_clock_set" );
93  print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
94  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
95  status = rtems_clock_get_tod( &time );
96  directive_failed( status, "rtems_clock_set" );
97  print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
98
99  build_time( &time, 12, 31, 2099, 23, 59, 59, 0 );
100  status = rtems_clock_set( &time );
101  directive_failed( status, "rtems_clock_set" );
102  print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
103  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
104  status = rtems_clock_get_tod( &time );
105  directive_failed( status, "rtems_clock_set" );
106  print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
107
108  build_time( &time, 12, 31, 1991, 23, 59, 59, 0 );
109  status = rtems_clock_set( &time );
110  directive_failed( status, "rtems_clock_set" );
111  print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
112  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
113  status = rtems_clock_get_tod( &time );
114  directive_failed( status, "rtems_clock_set" );
115  print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
116
117  puts( "*** END OF TEST SPCLOCK_ERR02 ***" );
118}
119
120#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
121#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
122
123#define CONFIGURE_MAXIMUM_TASKS             1
124#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
125
126#define CONFIGURE_INIT
127
128#include <rtems/confdefs.h>
129/* end of file */
Note: See TracBrowser for help on using the repository browser.