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

Last change on this file was f6bcf163, checked in by Sebastian Huber <sebastian.huber@…>, on 10/25/22 at 05:59:15

sptests: Avoid fatal error to end a test

End the test with a normal exit instead of
INTERNAL_ERROR_THREAD_EXITTED.

  • Property mode set to 100644
File size: 5.7 KB
RevLine 
[e7d46b73]1/* SPDX-License-Identifier: BSD-2-Clause */
2
[7b5f6643]3/*
4 *  COPYRIGHT (c) 2013.
[ac7d5ef0]5 *  On-Line Applications Research Corporation (OAR).
6 *
[e7d46b73]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.
[ac7d5ef0]27 */
28
[7d3f9c6]29#ifdef HAVE_CONFIG_H
30#include "config.h"
31#endif
32
[7b5f6643]33#include <tmacros.h>
34#include "test_support.h"
35
[6c0301d]36const char rtems_test_name[] = "SPCLOCK_ERR 2";
37
[7b5f6643]38/* forward declaration to avoid warnings */
39rtems_task Init(rtems_task_argument argument);
[ac7d5ef0]40
[7b5f6643]41rtems_task Init(
42  rtems_task_argument argument
43)
[ac7d5ef0]44{
[6c0301d]45  TEST_BEGIN();
[7b5f6643]46
[ac7d5ef0]47  rtems_time_of_day time;
48  rtems_status_code status;
49
[4b374f36]50  status = rtems_io_close( 0xffff, 0x0000, NULL);
[ac7d5ef0]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" );
[4b374f36]57  status = rtems_io_control( 0xffff, 0x00000, NULL);
[ac7d5ef0]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" );
[4b374f36]64  status = rtems_io_initialize( 0xffff, 0x00000, NULL);
[ac7d5ef0]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" );
[4b374f36]71  status = rtems_io_open( 0xffff, 0x00000, NULL);
[ac7d5ef0]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" );
[4b374f36]78  status = rtems_io_read( 0xffff, 0x00000, NULL);
[ac7d5ef0]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" );
[4b374f36]85  status = rtems_io_write( 0xffff, 0x0ffff, NULL);
[ac7d5ef0]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" );
[1f7ee02]97  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
[bcf16c0]98  status = rtems_clock_get_tod( &time );
[ac7d5ef0]99  directive_failed( status, "rtems_clock_set" );
[bcf16c0]100  print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
[ac7d5ef0]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" );
[1f7ee02]106  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
[bcf16c0]107  status = rtems_clock_get_tod( &time );
[f4773a47]108  directive_failed( status, "rtems_clock_get_tod" );
109  print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
[ac7d5ef0]110
[ad41c179]111  build_time( &time, 12, 31, 2099, 23, 59, 59, 0 );
[ac7d5ef0]112  status = rtems_clock_set( &time );
113  directive_failed( status, "rtems_clock_set" );
114  print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" );
[acf5212]115  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
[bcf16c0]116  status = rtems_clock_get_tod( &time );
[ac7d5ef0]117  directive_failed( status, "rtems_clock_set" );
[bcf16c0]118  print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
[ac7d5ef0]119
[ad41c179]120  build_time( &time, 1, 1, 2100, 0, 0, 0, 0 );
[ac7d5ef0]121  status = rtems_clock_set( &time );
[ad41c179]122  fatal_directive_status( status, RTEMS_INVALID_CLOCK, "rtems_clock_set" );
123  print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_INVALID_CLOCK\n" );
[1f7ee02]124  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
[bcf16c0]125  status = rtems_clock_get_tod( &time );
[ac7d5ef0]126  directive_failed( status, "rtems_clock_set" );
[bcf16c0]127  print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
[ac7d5ef0]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" );
[1f7ee02]133  status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() );
[bcf16c0]134  status = rtems_clock_get_tod( &time );
[ac7d5ef0]135  directive_failed( status, "rtems_clock_set" );
[bcf16c0]136  print_time( "TA1 - rtems_clock_get_tod - ", &time, " - RTEMS_SUCCESSFUL\n" );
[7b5f6643]137
[6c0301d]138  TEST_END();
[f6bcf163]139  rtems_test_exit( 0 );
[ac7d5ef0]140}
[7b5f6643]141
[c4b8b147]142#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
[7b5f6643]143#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
144
145#define CONFIGURE_MAXIMUM_TASKS             1
[6c0301d]146#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
147
[7b5f6643]148#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
149
150#define CONFIGURE_INIT
151
152#include <rtems/confdefs.h>
153/* end of file */
Note: See TracBrowser for help on using the repository browser.