Ticket #1593: sysinit_testcase_v1.patch
File sysinit_testcase_v1.patch, 13.6 KB (added by zhangwenjie, on 07/27/10 at 14:17:05) |
---|
-
testsuites/sptests/ChangeLog
diff --git a/testsuites/sptests/ChangeLog b/testsuites/sptests/ChangeLog index ff494c4..64d5582 100644
a b 1 2010-07-27 Zhang Wenjie <157724595@163.com> 2 3 PR 1593/sptests 4 * sptests/Makefile.am, sptests/configure.ac, 5 sptests/spsysinit/Makefile.am, sptests/spsysinit/spsysinit.doc, 6 sptests/spsysinit/spsysinit.scn, sptests/spsysinit/init.c, 7 sptests/spsysinit/sysinitfirst.c, sptests/spsysinit/sysinitlast.c, 8 sptests/spsysinit/sysinitsecond.c, sptests/spsysinit/sysinitthird.c, 9 sptests/spsysinit/sysinittest.h: Add the test case for Sysinit API. 10 1 11 2010-06-24 Bharath Suri <bharath.s.jois@gmail.com> 2 12 3 13 * Makefile.am, configure.ac: Removed some fifo tests. -
testsuites/sptests/Makefile.am
diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index 16b95e3..93abdfd 100644
a b SUBDIRS = \ 25 25 spintrcritical05 spintrcritical06 spintrcritical07 spintrcritical08 \ 26 26 spintrcritical09 spintrcritical10 spintrcritical11 spintrcritical12 \ 27 27 spintrcritical13 spintrcritical14 spintrcritical15 spintrcritical16 \ 28 spintrcritical17 spmkdir 28 spintrcritical17 spmkdir spsysinit 29 29 30 30 DIST_SUBDIRS = $(SUBDIRS) spfatal_support spintrcritical_support 31 31 EXTRA_DIST = spfatal_support/init.c spfatal_support/system.h -
testsuites/sptests/configure.ac
diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac index 748a1d8..1b39b8f 100644
a b spstkalloc/Makefile 148 148 spthreadq01/Makefile 149 149 spwatchdog/Makefile 150 150 spwkspace/Makefile 151 spsysinit/Makefile 151 152 ]) 152 153 AC_OUTPUT -
new file testsuites/sptests/spsysinit/Makefile.am
diff --git a/testsuites/sptests/spsysinit/Makefile.am b/testsuites/sptests/spsysinit/Makefile.am new file mode 100644 index 0000000..cd4844f
- + 1 ## 2 ## $Id: Makefile.am,v 1.23 2009/04/03 12:48:12 ralf Exp $ 3 ## 4 5 MANAGERS = io semaphore 6 7 noinst_LIBRARIES = libsysinit.a 8 libsysinit_a_SOURCES = sysinitfirst.c sysinitsecond.c \ 9 sysinitthird.c sysinitlast.c 10 11 rtems_tests_PROGRAMS = spsysinit 12 spsysinit_SOURCES = init.c sysinittest.h 13 14 dist_rtems_tests_DATA = spsysinit.scn 15 dist_rtems_tests_DATA += spsysinit.doc 16 17 include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg 18 include $(top_srcdir)/../automake/compile.am 19 include $(top_srcdir)/../automake/leaf.am 20 21 spsysinit_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) 22 23 AM_CPPFLAGS += -I$(top_srcdir)/../support/include 24 25 spsysinit_LDLIBS = -L. -lsysinit 26 27 LINK_OBJS = $(spsysinit_OBJECTS) $(spsysinit_LDADD) 28 LINK_LIBS = $(spsysinit_LDLIBS) 29 30 spsysinit$(EXEEXT): $(spsysinit_OBJECTS) $(spsysinit_DEPENDENCIES) 31 @rm -f spsysinit$(EXEEXT) 32 $(make-exe) 33 34 include $(top_srcdir)/../automake/local.am -
new file testsuites/sptests/spsysinit/init.c
diff --git a/testsuites/sptests/spsysinit/init.c b/testsuites/sptests/spsysinit/init.c new file mode 100644 index 0000000..34c915a
- + 1 /** 2 * @file 3 * 4 * @ingroup test_sysinit 5 * 6 * @brief test sysinit API . 7 */ 8 9 /* 10 * 11 * Copyright (c) 2010 12 * Zhangwenjie <157724595@163.com> 13 * 14 * The license and distribution terms for this file may be 15 * found in the file LICENSE in this distribution or at 16 * http://www.rtems.com/license/LICENSE. 17 * 18 * $Id$ 19 */ 20 21 #define CONFIGURE_INIT 22 #include <tmacros.h> 23 #include <rtems/score/sysinit.h> 24 #include "sysinittest.h" 25 26 Group_Order Running_Order = 0; 27 28 SYSINIT_REFERENCE( Sysinit_Group_First_Test ); 29 SYSINIT_REFERENCE( Sysinit_Group_Second_Test ); 30 SYSINIT_REFERENCE( Sysinit_Group_Third_Test ); 31 SYSINIT_REFERENCE( Sysinit_Group_Last_Test ); 32 33 rtems_task Init( 34 rtems_task_argument argument 35 ) 36 { 37 puts( "\n\n*** SYSINIT TEST 1 ***" ); 38 39 Running_Order = ORDER_GROUP_FIRST; 40 puts( "\nSysinit Iterate:" ); 41 42 _Sysinit_Iterate( SYSINIT_TEST_NOMAL ); 43 44 Running_Order = ORDER_GROUP_LAST; 45 puts( "\n\nSysinit Iterate Reversed:" ); 46 47 _Sysinit_Iterate_reversed( SYSINIT_TEST_REVERSED ); 48 49 puts( "\n*** END OF SYSINIT TEST 1 ***" ); 50 51 rtems_test_exit( 0 ); 52 } 53 54 /* configuration information */ 55 56 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 57 #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER 58 59 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE 60 61 #define CONFIGURE_EXTRA_TASK_STACKS (1 * RTEMS_MINIMUM_STACK_SIZE) 62 #define CONFIGURE_MAXIMUM_TASKS 1 63 64 #include <rtems/confdefs.h> 65 /*end of file*/ -
new file testsuites/sptests/spsysinit/spsysinit.doc
diff --git a/testsuites/sptests/spsysinit/spsysinit.doc b/testsuites/sptests/spsysinit/spsysinit.doc new file mode 100644 index 0000000..fac0eab
- + 1 # 2 # $Id$ 3 # 4 # Copyright (c) 2009 5 # Zhangwenjie <157724595@163.com> 6 # 7 # The license and distribution terms for this file may be 8 # found in the file LICENSE in this distribution or at 9 # http://www.rtems.com/license/LICENSE. 10 # 11 12 This file describes the directives and concepts tested by this test set. 13 14 test set name: spsysinit01 15 16 directives: 17 18 _Sysinit_Iterate 19 _Sysinit_Iterate_reversed 20 SYSINIT_ENTRY 21 SYSINIT_REFERENCE 22 23 concepts: 24 25 a. Verifies sysinit API can iterate every reference object in nomal order 26 and in reversed order 27 28 b. Verifies executive can include only wanted reference object into sysinit 29 section. 30 31 output: 32 33 "Sysinit module start nomal test" is printed in nomal sequenced order . 34 Then "Sysinit module start reversed test" is printed in reversed sequenced 35 order. -
new file testsuites/sptests/spsysinit/spsysinit.scn
diff --git a/testsuites/sptests/spsysinit/spsysinit.scn b/testsuites/sptests/spsysinit/spsysinit.scn new file mode 100644 index 0000000..ff89bae
- + 1 *** SYSINIT TEST 1 *** 2 Sysinit Iterate: 3 First Sysinit module start nomal test 4 Second Sysinit module start nomal test 5 Third Sysinit module start nomal test 6 Last Sysinit module start nomal test 7 8 Sysinit Iterate Reversed: 9 Last Sysinit module start reversed test 10 Third Sysinit module start reversed test 11 Second Sysinit module start reversed test 12 First Sysinit module start reversed test 13 *** END OF SYSINIT TEST 1 *** 14 -
new file testsuites/sptests/spsysinit/sysinitfirst.c
diff --git a/testsuites/sptests/spsysinit/sysinitfirst.c b/testsuites/sptests/spsysinit/sysinitfirst.c new file mode 100644 index 0000000..4760a7c
- + 1 /** 2 * @file 3 * 4 * @ingroup test_sysinit 5 * 6 * @brief Sysinit_Group_First_Test for sequenced initialization api and 7 * it is compiled into a library. 8 */ 9 10 /* 11 * 12 * Copyright (c) 2010 13 * Zhangwenjie <157724595@163.com> 14 * 15 * The license and distribution terms for this file may be 16 * found in the file LICENSE in this distribution or at 17 * http://www.rtems.com/license/LICENSE. 18 * 19 * $Id$ 20 */ 21 22 #include <tmacros.h> 23 #include <rtems/score/sysinit.h> 24 #include "sysinittest.h" 25 26 void Sysinit_Group_First_Test( 27 Sysinit_State state 28 ) 29 { 30 switch ( state ) { 31 case SYSINIT_INITIALIZE: 32 break; 33 case SYSINIT_TERMINATE: 34 break; 35 case SYSINIT_TEST_NOMAL: 36 if ( Running_Order > ORDER_GROUP_FIRST ) 37 directive_failed( RTEMS_INTERNAL_ERROR, "Sysinit_Group_First_Test" ); 38 puts( "\nFirst Sysinit module start nomal test" ); 39 break; 40 case SYSINIT_TEST_REVERSED: 41 if ( Running_Order < ORDER_GROUP_FIRST ) 42 directive_failed( RTEMS_INTERNAL_ERROR, "Sysinit_Group_First_Test" ); 43 puts( "\nFirst Sysinit module start reversed test" ); 44 break; 45 default: 46 puts( "\nFirst Sysinit module is in wrong status" ); 47 rtems_fatal_error_occurred( RTEMS_INCORRECT_STATE ); 48 break; 49 } 50 51 Running_Order = ORDER_GROUP_FIRST; 52 } 53 54 SYSINIT_ENTRY( Sysinit_Group_First_Test, SYSINIT_TEST_GROUP_FIRST ); -
new file testsuites/sptests/spsysinit/sysinitlast.c
diff --git a/testsuites/sptests/spsysinit/sysinitlast.c b/testsuites/sptests/spsysinit/sysinitlast.c new file mode 100644 index 0000000..debf5f8
- + 1 /** 2 * @file 3 * 4 * @ingroup test_sysinit 5 * 6 * @brief Sysinit_Group_Last_Test for sequenced initialization api and 7 * it is compiled into a library. 8 */ 9 10 /* 11 * 12 * Copyright (c) 2010 13 * Zhangwenjie <157724595@163.com> 14 * 15 * The license and distribution terms for this file may be 16 * found in the file LICENSE in this distribution or at 17 * http://www.rtems.com/license/LICENSE. 18 * 19 * $Id$ 20 */ 21 22 #include <tmacros.h> 23 #include <rtems/score/sysinit.h> 24 #include "sysinittest.h" 25 26 void Sysinit_Group_Last_Test( 27 Sysinit_State state 28 ) 29 { 30 switch ( state ) { 31 case SYSINIT_INITIALIZE: 32 break; 33 case SYSINIT_TERMINATE: 34 break; 35 case SYSINIT_TEST_NOMAL: 36 if ( Running_Order > ORDER_GROUP_LAST ) 37 directive_failed( RTEMS_INTERNAL_ERROR, "Sysinit_Group_Last_Test" ); 38 puts( "\nLast Sysinit module start nomal test" ); 39 break; 40 case SYSINIT_TEST_REVERSED: 41 if ( Running_Order < ORDER_GROUP_LAST ) 42 directive_failed( RTEMS_INTERNAL_ERROR, "Sysinit_Group_Last_Test" ); 43 puts( "\nLast Sysinit module start reversed test" ); 44 break; 45 default: 46 puts( "\nLast Sysinit module is in wrong status" ); 47 rtems_fatal_error_occurred( RTEMS_INCORRECT_STATE ); 48 break; 49 } 50 51 Running_Order = ORDER_GROUP_LAST; 52 } 53 54 SYSINIT_ENTRY( Sysinit_Group_Last_Test, SYSINIT_GROUP_LAST ); -
new file testsuites/sptests/spsysinit/sysinitsecond.c
diff --git a/testsuites/sptests/spsysinit/sysinitsecond.c b/testsuites/sptests/spsysinit/sysinitsecond.c new file mode 100644 index 0000000..1d6791d
- + 1 /** 2 * @file 3 * 4 * @ingroup test_sysinit 5 * 6 * @brief Sysinit_Group_Second_Test for sequenced initialization api and 7 * it is compiled into a library. 8 */ 9 10 /* 11 * 12 * Copyright (c) 2010 13 * Zhangwenjie <157724595@163.com> 14 * 15 * The license and distribution terms for this file may be 16 * found in the file LICENSE in this distribution or at 17 * http://www.rtems.com/license/LICENSE. 18 * 19 * $Id$ 20 */ 21 #include <tmacros.h> 22 #include <rtems/score/sysinit.h> 23 #include "sysinittest.h" 24 25 void Sysinit_Group_Second_Test( 26 Sysinit_State state 27 ) 28 { 29 switch ( state ) { 30 case SYSINIT_INITIALIZE: 31 break; 32 case SYSINIT_TERMINATE: 33 break; 34 case SYSINIT_TEST_NOMAL: 35 if ( Running_Order > ORDER_GROUP_SECOND ) 36 directive_failed( RTEMS_INTERNAL_ERROR, "Sysinit_Group_Second_Test" ); 37 puts( "\nSecond Sysinit module start nomal test" ); 38 break; 39 case SYSINIT_TEST_REVERSED: 40 if ( Running_Order < ORDER_GROUP_SECOND ) 41 directive_failed( RTEMS_INTERNAL_ERROR, "Sysinit_Group_Second_Test" ); 42 puts( "\nSecond Sysinit module start reversed test" ); 43 break; 44 default: 45 puts( "\nSecond Sysinit module is in wrong status" ); 46 rtems_fatal_error_occurred( RTEMS_INCORRECT_STATE ); 47 break; 48 } 49 50 Running_Order = ORDER_GROUP_SECOND; 51 } 52 53 SYSINIT_ENTRY( Sysinit_Group_Second_Test, SYSINIT_TEST_GROUP_SECOND ); -
new file testsuites/sptests/spsysinit/sysinittest.h
diff --git a/testsuites/sptests/spsysinit/sysinittest.h b/testsuites/sptests/spsysinit/sysinittest.h new file mode 100644 index 0000000..66dcedc
- + 1 /** 2 * @file 3 * 4 * @ingroup test_sysinit 5 * 6 * @brief This include file contains information that is included in every 7 * sysinit function module in the test set. 8 */ 9 10 /* 11 * 12 * Copyright (c) 2010 13 * Zhangwenjie <157724595@163.com> 14 * 15 * The license and distribution terms for this file may be 16 * found in the file LICENSE in this distribution or at 17 * http://www.rtems.com/license/LICENSE. 18 * 19 * $Id$ 20 */ 21 22 /** 23 * @brief Group Order. 24 */ 25 typedef enum { 26 ORDER_GROUP_FIRST = 0, 27 ORDER_GROUP_SECOND, 28 ORDER_GROUP_THIRD, 29 ORDER_GROUP_LAST 30 } Group_Order; 31 32 #define SYSINIT_TEST_GROUP_FIRST "9000" 33 #define SYSINIT_TEST_GROUP_SECOND "9001" 34 #define SYSINIT_TEST_GROUP_THIRD "9002" 35 #define SYSINIT_TEST_GROUP_LAST "9999" 36 37 #define SYSINIT_TEST_NOMAL 21458 38 #define SYSINIT_TEST_REVERSED 21459 39 40 extern Group_Order Running_Order; 41 42 /* end of include file */ -
new file testsuites/sptests/spsysinit/sysinitthird.c
diff --git a/testsuites/sptests/spsysinit/sysinitthird.c b/testsuites/sptests/spsysinit/sysinitthird.c new file mode 100644 index 0000000..51ac23b
- + 1 /** 2 * @file 3 * 4 * @ingroup test_sysinit 5 * 6 * @brief Sysinit_Group_Third_Test for sequenced initialization api and 7 * it is compiled into a library. 8 */ 9 10 /* 11 * 12 * Copyright (c) 2010 13 * Zhangwenjie <157724595@163.com> 14 * 15 * The license and distribution terms for this file may be 16 * found in the file LICENSE in this distribution or at 17 * http://www.rtems.com/license/LICENSE. 18 * 19 * $Id$ 20 */ 21 22 #include <tmacros.h> 23 #include <rtems/score/sysinit.h> 24 #include "sysinittest.h" 25 26 void Sysinit_Group_Third_Test( 27 Sysinit_State state 28 ) 29 { 30 switch ( state ) { 31 case SYSINIT_INITIALIZE: 32 break; 33 case SYSINIT_TERMINATE: 34 break; 35 case SYSINIT_TEST_NOMAL: 36 if ( Running_Order > ORDER_GROUP_THIRD ) 37 directive_failed( RTEMS_INTERNAL_ERROR, "Sysinit_Group_Third_Test" ); 38 puts( "\nThird Sysinit module start nomal test" ); 39 break; 40 case SYSINIT_TEST_REVERSED: 41 if ( Running_Order < ORDER_GROUP_THIRD ) 42 directive_failed( RTEMS_INTERNAL_ERROR, "Sysinit_Group_Third_Test" ); 43 puts( "\nThird Sysinit module start reversed test" ); 44 break; 45 default: 46 puts( "\nThird Sysinit module is in wrong status" ); 47 rtems_fatal_error_occurred( RTEMS_INCORRECT_STATE ); 48 break; 49 } 50 51 Running_Order = ORDER_GROUP_THIRD; 52 } 53 54 SYSINIT_ENTRY( Sysinit_Group_Third_Test, SYSINIT_TEST_GROUP_THIRD );