RTEMS
testrun.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 
11 /*
12  * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions
16  * are met:
17  * 1. Redistributions of source code must retain the above copyright
18  * notice, this list of conditions and the following disclaimer.
19  * 2. Redistributions in binary form must reproduce the above copyright
20  * notice, this list of conditions and the following disclaimer in the
21  * documentation and/or other materials provided with the distribution.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #ifdef HAVE_CONFIG_H
37 #include "config.h"
38 #endif
39 
40 #include <rtems/test-info.h>
41 #include <rtems/test.h>
42 
43 static char buffer[ 512 ];
44 
45 static const T_action actions[] = {
46  T_report_hash_sha256,
47  T_check_task_context,
48  T_check_file_descriptors,
49  T_check_rtems_barriers,
50  T_check_rtems_extensions,
51  T_check_rtems_message_queues,
52  T_check_rtems_partitions,
53  T_check_rtems_periods,
54  T_check_rtems_regions,
55  T_check_rtems_semaphores,
56  T_check_rtems_tasks,
57  T_check_rtems_timers,
58  T_check_posix_keys
59 };
60 
61 static const T_config config = {
62  .name = rtems_test_name,
63  .buf = buffer,
64  .buf_size = sizeof( buffer ),
65  .putchar = T_putchar_default,
66  .verbosity = T_VERBOSE,
67  .now = T_now_clock,
68  .action_count = T_ARRAY_SIZE( actions ),
69  .actions = actions
70 };
71 
74  const RTEMS_TEST_STATE state
75 )
76 {
77  (void) arg;
78 
80  T_register();
81 
82  if ( T_main( &config ) == 0 ) {
84  }
85 
86  rtems_test_exit( 0 );
87 }
const char rtems_test_name[]
Each test must define a test name string.
RTEMS_TEST_STATE
Test states.
Definition: test-info.h:65
int rtems_test_begin(const char *name, const RTEMS_TEST_STATE state)
Prints a begin of test message using printf().
Definition: testbeginend.c:38
CPU_Uint32ptr rtems_task_argument
This type is used to represent task argument values.
Definition: tasks.h:115
int rtems_test_end(const char *name)
Prints an end of test message using printf().
Definition: testbeginend.c:75
void rtems_test_run(rtems_task_argument arg, const RTEMS_TEST_STATE state)
Runs the test cases of the RTEMS Test Framework using a default configuration in the context of a tas...
Definition: testrun.c:72
void rtems_test_exit(int status) RTEMS_NO_RETURN
Exit the test without calling exit() since it closes stdin, etc and pulls in stdio code...
Definition: testbeginend.c:83