]> rtime.felk.cvut.cz Git - arc.git/blob - system/kernel/testsystem/os_test.h
d1c438a210b3cf2fb56c4331d46145e289c0b519
[arc.git] / system / kernel / testsystem / os_test.h
1 /* -------------------------------- Arctic Core ------------------------------
2  * Arctic Core - the open source AUTOSAR platform http://arccore.com
3  *
4  * Copyright (C) 2009  ArcCore AB <contact@arccore.com>
5  *
6  * This source code is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License version 2 as published by the
8  * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13  * for more details.
14  * -------------------------------- Arctic Core ------------------------------*/
15 /*
16  * Contains mostly macros for the test-system. Most macro's have the same
17  * name as in embUnit, to make it easier to use.
18  *
19  */
20
21 #ifndef OS_TEST_H_\r
22 #define OS_TEST_H_\r
23 \r
24 #include "test_framework.h"
25 #include "debug.h"\r
26 \r
27 typedef void (*test_func_t)( void );
28 \r
29
30 #define TEST_INIT()                     printf("Test init\n");\r
31 #define TEST_FAIL(_text)                test_fail((_text),  __FILE__,  __LINE__, __FUNCTION__ )\r
32 #define TEST_OK()                               test_ok();
33 #define TEST_ASSERT(_cond)                      if(!(_cond)) { TEST_FAIL(#_cond); }
34 /* Start to run a test */
35 #define TEST_RUN()                              printf("Running test %d\n",test_nr);
36 /* Indicate that a test is done */
37 //#define TEST_DONE()
38 #define TEST_START(_str,_nr)            testStart(_str,_nr)
39 #define TEST_NEXT(_str,_next_nr)        testEnd(); testStart(_str,_next_nr);
40 \r
41 \r
42 extern int test_suite;\r
43 extern int test_nr;
44
45 #define TASK_ID_ILL                     99
46 #define RES_ID_ILL                              99
47 #define ALARM_ID_ILL                    99
48 #define SCHTBL_ID_ILL   99
49 #define COUNTER_ID_ILL                  99
50 \r
51 #if 1\r
52 #define SECTION_SUP\r
53 #define SECTION_USER\r
54 #else\r
55 #define SECTION_SUP                     __attribute__ ((section(".text_app_sup")))\r
56 #define SECTION_USER            __attribute__ ((section(".text_app_user")))\r
57 #endif\r
58 \r
59 #define SECTION_BSS_SUPER       __attribute__ ((aligned (16),section(".bss")))\r
60 #define SECTION_BSS_USER        __attribute__ ((aligned (16),section(".bss")))\r
61
62 #define OS_STR__(x)             #x
63 #define OS_STRSTR__(x)  OS_STR__(x)
64
65 #define DECLARE_TEST_BTASK(_nr, _task1, _task2, _task3 ) \
66                 __attribute__ ((section (".test_btask"))) const test_func_t btask_sup_matrix_ ## _nr[3] = { _task1, _task2, _task3 }
67
68 #define DECLARE_TEST_ETASK(_nr, _task1, _task2, _task3 ) \
69                 __attribute__ ((section (".test_etask"))) const test_func_t etask_sup_matrix_ ## _nr[3]  = { _task1, _task2, _task3 }
70 \r
71 #define DECLARE_TASKS(_nr) \\r
72         void etask_sup_l_##_nr( void ); \\r
73         void etask_sup_m_##_nr( void ); \\r
74         void etask_sup_h_##_nr( void ); \\r
75         void btask_sup_l_##_nr( void ); \\r
76         void btask_sup_m_##_nr( void ); \\r
77         void btask_sup_h_##_nr( void );\r
78 \r
79 \r
80 /*\r
81  * Declare tests
82  */\r
83 \r
84 // Test master processes\r
85 void OsIdle(void );\r
86 void etask_master( void );\r
87 void etask_sup_l( void ) SECTION_SUP;\r
88 void etask_sup_m( void ) SECTION_SUP;\r
89 void etask_sup_h( void ) SECTION_SUP;\r
90 \r
91 void btask_sup_l( void ) SECTION_SUP;\r
92 void btask_sup_m( void ) SECTION_SUP;\r
93 void btask_sup_h( void ) SECTION_SUP;\r
94 \r
95 \r
96 // Tests\r
97 DECLARE_TASKS(01);\r
98 DECLARE_TASKS(02);\r
99 DECLARE_TASKS(03);
100 DECLARE_TASKS(04);\r
101 \r
102 #endif /* OS_TEST_H_ */\r