source: rtems/testsuites/sptests/spclock_err02/init.c @ 98c6d50

5
Last change on this file since 98c6d50 was 98c6d50, checked in by Chris Johns <chrisj@…>, on 10/19/17 at 05:39:16

testsuite: Use printk for all test output where possible.

  • Remove the printf support leaving the direct printk support configured with TESTS_USE_PRINTK and all other output goes via a buffered vsniprintf call to printk.
  • Control the test's single init for functions and global data with TEST_INIT and not CONFIGURE_INIT. They are now separate.

Updates #3170.

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