From 1e343825f4bb6e907684e3752445d6511186f924 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 11 Nov 2019 19:52:06 +0100 Subject: tests: Simplify fatal error test support Move system.h to shared init.c. Update #3818. --- testsuites/libtests/Makefile.am | 2 +- testsuites/psxtests/Makefile.am | 4 +- testsuites/psxtests/psxfatal_support/init.c | 48 ++++++++++++++-- testsuites/psxtests/psxfatal_support/system.h | 79 --------------------------- testsuites/sptests/Makefile.am | 36 ++++++------ testsuites/sptests/spfatal_support/init.c | 49 +++++++++++++++-- testsuites/sptests/spfatal_support/system.h | 79 --------------------------- 7 files changed, 106 insertions(+), 191 deletions(-) delete mode 100644 testsuites/psxtests/psxfatal_support/system.h delete mode 100644 testsuites/sptests/spfatal_support/system.h diff --git a/testsuites/libtests/Makefile.am b/testsuites/libtests/Makefile.am index 5ada4c4eb9..a9af43e1c9 100644 --- a/testsuites/libtests/Makefile.am +++ b/testsuites/libtests/Makefile.am @@ -314,7 +314,7 @@ lib_tests += devnullfatal01 lib_screens += devnullfatal01/devnullfatal01.scn lib_docs += devnullfatal01/devnullfatal01.doc devnullfatal01_SOURCES = ../sptests/spfatal_support/init.c \ - ../sptests/spfatal_support/system.h devnullfatal01/testcase.h + devnullfatal01/testcase.h devnullfatal01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_devnullfatal01) \ $(support_includes) -I$(top_srcdir)/../../sptests/spfatal_support \ -I$(top_srcdir)/devnullfatal01 diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am index 42d67e2fd9..0d213a4437 100755 --- a/testsuites/psxtests/Makefile.am +++ b/testsuites/psxtests/Makefile.am @@ -391,7 +391,7 @@ endif if TEST_psxfatal01 psx_tests += psxfatal01 psx_screens += psxfatal01/psxfatal01.scn -psxfatal01_SOURCES = psxfatal_support/init.c psxfatal_support/system.h \ +psxfatal01_SOURCES = psxfatal_support/init.c \ psxfatal01/testcase.h psxfatal01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_psxfatal01) \ $(support_includes) -I$(top_srcdir)/psxfatal01 @@ -400,7 +400,7 @@ endif if TEST_psxfatal02 psx_tests += psxfatal02 psx_screens += psxfatal02/psxfatal02.scn -psxfatal02_SOURCES = psxfatal_support/init.c psxfatal_support/system.h \ +psxfatal02_SOURCES = psxfatal_support/init.c \ psxfatal02/testcase.h psxfatal02_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_psxfatal02) \ $(support_includes) -I$(top_srcdir)/psxfatal02 diff --git a/testsuites/psxtests/psxfatal_support/init.c b/testsuites/psxtests/psxfatal_support/init.c index 38caa3f36a..2c305396d5 100644 --- a/testsuites/psxtests/psxfatal_support/init.c +++ b/testsuites/psxtests/psxfatal_support/init.c @@ -11,10 +11,15 @@ #include "config.h" #endif -#include "tmacros.h" +#include -#define CONFIGURE_INIT -#include "system.h" +#include + +void *POSIX_Init(void *argument); + +void force_error(void); + +#include "testcase.h" const char rtems_test_name[] = "PSXFATAL " FATAL_ERROR_TEST_NAME; @@ -38,7 +43,7 @@ void *POSIX_Init( rtems_test_exit(0); } -void Put_Error( rtems_fatal_source source, rtems_fatal_code error ) +static void Put_Error( rtems_fatal_source source, rtems_fatal_code error ) { if ( source == INTERNAL_ERROR_CORE ) { printk( rtems_internal_error_text( error ) ); @@ -56,12 +61,12 @@ void Put_Error( rtems_fatal_source source, rtems_fatal_code error ) } } -void Put_Source( rtems_fatal_source source ) +static void Put_Source( rtems_fatal_source source ) { printk( "%s", rtems_fatal_source_text( source ) ); } -void Fatal_extension( +static void Fatal_extension( rtems_fatal_source source, bool always_set_to_false, rtems_fatal_code error @@ -97,3 +102,34 @@ void Fatal_extension( TEST_END(); } } + +#define CONFIGURE_INIT + +#define CONFIGURE_INITIAL_EXTENSIONS \ + { \ + NULL, /* create */ \ + NULL, /* start */ \ + NULL, /* restart */ \ + NULL, /* delete */ \ + NULL, /* switch */ \ + NULL, /* begin */ \ + NULL, /* exitted */ \ + Fatal_extension /* fatal */ \ + }, \ + RTEMS_TEST_INITIAL_EXTENSION + +/* extra parameters may be in testcase.h */ +#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +/* always need an Init task, some cases need more tasks */ +#ifndef SPFATAL_TEST_CASE_EXTRA_THREADS +#define SPFATAL_TEST_CASE_EXTRA_THREADS 0 +#endif + +#define CONFIGURE_MAXIMUM_POSIX_THREADS \ + (SPFATAL_TEST_CASE_EXTRA_THREADS + 1) + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#include diff --git a/testsuites/psxtests/psxfatal_support/system.h b/testsuites/psxtests/psxfatal_support/system.h deleted file mode 100644 index 21a60f6396..0000000000 --- a/testsuites/psxtests/psxfatal_support/system.h +++ /dev/null @@ -1,79 +0,0 @@ -/** - * - * This include file contains information that is included in every - * function in the test set. - */ - -/* - * COPYRIGHT (c) 1989-2012. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -/* - * Some of the fatal error cases require the ability to peek inside RTEMS - */ - -#include -#include - -/* functions */ -void force_error(void); - -void Put_Source( rtems_fatal_source source ); - -void Put_Error( rtems_fatal_source source, rtems_fatal_code error ); - -void *POSIX_Init( - void *argument -); - -void Fatal_extension( - rtems_fatal_source source, - bool always_set_to_false, - rtems_fatal_code error -); - -/* need prototypes */ - -#include "testcase.h" - -/* configuration information */ - -extern rtems_extensions_table initial_extensions; - -#define CONFIGURE_INITIAL_EXTENSIONS \ - { \ - NULL, /* create */ \ - NULL, /* start */ \ - NULL, /* restart */ \ - NULL, /* delete */ \ - NULL, /* switch */ \ - NULL, /* begin */ \ - NULL, /* exitted */ \ - Fatal_extension /* fatal */ \ - }, \ - RTEMS_TEST_INITIAL_EXTENSION - -/* extra parameters may be in testcase.h */ -#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER - -/* always need an Init task, some cases need more tasks */ -#ifndef SPFATAL_TEST_CASE_EXTRA_THREADS -#define SPFATAL_TEST_CASE_EXTRA_THREADS 0 -#endif - -#define CONFIGURE_MAXIMUM_POSIX_THREADS \ - (SPFATAL_TEST_CASE_EXTRA_THREADS + 1) - -#define CONFIGURE_POSIX_INIT_THREAD_TABLE - -#include - -/* global variables */ - -/* end of include file */ diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index 4d033f6c53..900a2f80d4 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -890,7 +890,7 @@ if TEST_spfatal01 sp_tests += spfatal01 sp_screens += spfatal01/spfatal01.scn sp_docs += spfatal01/spfatal01.doc -spfatal01_SOURCES = spfatal_support/init.c spfatal_support/system.h \ +spfatal01_SOURCES = spfatal_support/init.c \ spfatal01/testcase.h spfatal01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal01) \ $(support_includes) -I$(top_srcdir)/spfatal01 @@ -900,7 +900,7 @@ if TEST_spfatal02 sp_tests += spfatal02 sp_screens += spfatal02/spfatal02.scn sp_docs += spfatal02/spfatal02.doc -spfatal02_SOURCES = spfatal_support/init.c spfatal_support/system.h \ +spfatal02_SOURCES = spfatal_support/init.c \ spfatal02/testcase.h spfatal02_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal02) \ $(support_includes) -I$(top_srcdir)/spfatal02 @@ -910,7 +910,7 @@ if TEST_spfatal03 sp_tests += spfatal03 sp_screens += spfatal03/spfatal03.scn sp_docs += spfatal03/spfatal03.doc -spfatal03_SOURCES = spfatal_support/init.c spfatal_support/system.h \ +spfatal03_SOURCES = spfatal_support/init.c \ spfatal03/testcase.h spfatal03_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal03) \ $(support_includes) -I$(top_srcdir)/spfatal03 @@ -920,7 +920,7 @@ if TEST_spfatal04 sp_tests += spfatal04 sp_screens += spfatal04/spfatal04.scn sp_docs += spfatal04/spfatal04.doc -spfatal04_SOURCES = spfatal_support/init.c spfatal_support/system.h \ +spfatal04_SOURCES = spfatal_support/init.c \ spfatal04/testcase.h spfatal04_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal04) \ $(support_includes) -I$(top_srcdir)/spfatal04 @@ -930,7 +930,7 @@ if TEST_spfatal05 sp_tests += spfatal05 sp_screens += spfatal05/spfatal05.scn sp_docs += spfatal05/spfatal05.doc -spfatal05_SOURCES = spfatal_support/init.c spfatal_support/system.h \ +spfatal05_SOURCES = spfatal_support/init.c \ spfatal05/testcase.h spfatal05_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal05) \ $(support_includes) -I$(top_srcdir)/spfatal05 @@ -940,7 +940,7 @@ if TEST_spfatal06 sp_tests += spfatal06 sp_screens += spfatal06/spfatal06.scn sp_docs += spfatal06/spfatal06.doc -spfatal06_SOURCES = spfatal_support/init.c spfatal_support/system.h \ +spfatal06_SOURCES = spfatal_support/init.c \ spfatal06/testcase.h spfatal06_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal06) \ $(support_includes) -I$(top_srcdir)/spfatal06 @@ -950,7 +950,7 @@ if TEST_spfatal08 sp_tests += spfatal08 sp_screens += spfatal08/spfatal08.scn sp_docs += spfatal08/spfatal08.doc -spfatal08_SOURCES = spfatal_support/init.c spfatal_support/system.h \ +spfatal08_SOURCES = spfatal_support/init.c \ spfatal08/testcase.h spfatal08_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal08) \ $(support_includes) -I$(top_srcdir)/spfatal08 @@ -960,7 +960,7 @@ if TEST_spfatal09 sp_tests += spfatal09 sp_screens += spfatal09/spfatal09.scn sp_docs += spfatal09/spfatal09.doc -spfatal09_SOURCES = spfatal_support/init.c spfatal_support/system.h \ +spfatal09_SOURCES = spfatal_support/init.c \ spfatal09/testcase.h spfatal09_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal09) \ $(support_includes) -I$(top_srcdir)/spfatal09 @@ -970,7 +970,7 @@ if TEST_spfatal10 sp_tests += spfatal10 sp_screens += spfatal10/spfatal10.scn sp_docs += spfatal10/spfatal10.doc -spfatal10_SOURCES = spfatal_support/init.c spfatal_support/system.h \ +spfatal10_SOURCES = spfatal_support/init.c \ spfatal10/testcase.h spfatal10_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal10) \ $(support_includes) -I$(top_srcdir)/spfatal10 @@ -980,7 +980,7 @@ if TEST_spfatal11 sp_tests += spfatal11 sp_screens += spfatal11/spfatal11.scn sp_docs += spfatal11/spfatal11.doc -spfatal11_SOURCES = spfatal_support/init.c spfatal_support/system.h \ +spfatal11_SOURCES = spfatal_support/init.c \ spfatal11/testcase.h spfatal11_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal11) \ $(support_includes) -I$(top_srcdir)/spfatal11 @@ -990,7 +990,7 @@ if TEST_spfatal12 sp_tests += spfatal12 sp_screens += spfatal12/spfatal12.scn sp_docs += spfatal12/spfatal12.doc -spfatal12_SOURCES = spfatal_support/init.c spfatal_support/system.h \ +spfatal12_SOURCES = spfatal_support/init.c \ spfatal12/testcase.h spfatal12_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal12) \ $(support_includes) -I$(top_srcdir)/spfatal12 @@ -1001,7 +1001,6 @@ sp_tests += spfatal14 sp_screens += spfatal14/spfatal14.scn sp_docs += spfatal14/spfatal14.doc spfatal14_SOURCES = spfatal_support/init.c \ - spfatal_support/system.h \ spfatal14/testcase.h spfatal14_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal14) \ $(support_includes) -I$(top_srcdir)/spfatal14 @@ -1012,7 +1011,6 @@ sp_tests += spfatal15 sp_screens += spfatal15/spfatal15.scn sp_docs += spfatal15/spfatal15.doc spfatal15_SOURCES = spfatal_support/init.c \ - spfatal_support/system.h \ spfatal15/testcase.h spfatal15_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal15) \ $(support_includes) -I$(top_srcdir)/spfatal15 @@ -1022,7 +1020,7 @@ if TEST_spfatal24 sp_tests += spfatal24 sp_screens += spfatal24/spfatal24.scn sp_docs += spfatal24/spfatal24.doc -spfatal24_SOURCES = spfatal_support/init.c spfatal_support/system.h \ +spfatal24_SOURCES = spfatal_support/init.c \ spfatal24/testcase.h spfatal24_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal24) \ $(support_includes) -I$(top_srcdir)/spfatal24 @@ -1032,7 +1030,7 @@ if TEST_spfatal25 sp_tests += spfatal25 sp_screens += spfatal25/spfatal25.scn sp_docs += spfatal25/spfatal25.doc -spfatal25_SOURCES = spfatal_support/init.c spfatal_support/system.h \ +spfatal25_SOURCES = spfatal_support/init.c \ spfatal25/testcase.h spfatal25_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal25) \ $(support_includes) -I$(top_srcdir)/spfatal25 @@ -1051,7 +1049,7 @@ if TEST_spfatal27 sp_tests += spfatal27 sp_screens += spfatal27/spfatal27.scn sp_docs += spfatal27/spfatal27.doc -spfatal27_SOURCES = spfatal_support/init.c spfatal_support/system.h \ +spfatal27_SOURCES = spfatal_support/init.c \ spfatal27/testcase.h spfatal27_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal27) \ $(support_includes) -I$(top_srcdir)/spfatal27 @@ -1061,7 +1059,7 @@ if TEST_spfatal28 sp_tests += spfatal28 sp_screens += spfatal28/spfatal28.scn sp_docs += spfatal28/spfatal28.doc -spfatal28_SOURCES = spfatal_support/init.c spfatal_support/system.h \ +spfatal28_SOURCES = spfatal_support/init.c \ spfatal28/testcase.h spfatal28_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal28) \ $(support_includes) -I$(top_srcdir)/spfatal28 @@ -1071,7 +1069,7 @@ if TEST_spfatal29 sp_tests += spfatal29 sp_screens += spfatal29/spfatal29.scn sp_docs += spfatal29/spfatal29.doc -spfatal29_SOURCES = spfatal_support/init.c spfatal_support/system.h \ +spfatal29_SOURCES = spfatal_support/init.c \ spfatal29/testcase.h spfatal29_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal29) \ $(support_includes) -I$(top_srcdir)/spfatal29 @@ -1099,7 +1097,7 @@ if TEST_spfatal32 sp_tests += spfatal32 sp_screens += spfatal32/spfatal32.scn sp_docs += spfatal32/spfatal32.doc -spfatal32_SOURCES = spfatal_support/init.c spfatal_support/system.h \ +spfatal32_SOURCES = spfatal_support/init.c \ spfatal32/testcase.h spfatal32_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal32) \ $(support_includes) -I$(top_srcdir)/spfatal32 diff --git a/testsuites/sptests/spfatal_support/init.c b/testsuites/sptests/spfatal_support/init.c index f8d7225954..e5aae95027 100644 --- a/testsuites/sptests/spfatal_support/init.c +++ b/testsuites/sptests/spfatal_support/init.c @@ -11,8 +11,15 @@ #include "config.h" #endif -#define CONFIGURE_INIT -#include "system.h" +#include + +#include + +rtems_task Init( rtems_task_argument argument ); + +void force_error( void ); + +#include "testcase.h" const char rtems_test_name[] = "SPFATAL " FATAL_ERROR_TEST_NAME; @@ -36,7 +43,8 @@ rtems_task Init( rtems_test_exit(0); } -void Put_Error( uint32_t source, uint32_t error ) +#ifdef FATAL_ERROR_EXPECTED_ERROR +static void Put_Error( uint32_t source, uint32_t error ) { if ( source == INTERNAL_ERROR_CORE ) { printk( rtems_internal_error_text( error ) ); @@ -48,8 +56,9 @@ void Put_Error( uint32_t source, uint32_t error ) printk( "%s", rtems_status_text( error ) ); } } +#endif -void Put_Source( rtems_fatal_source source ) +static void Put_Source( rtems_fatal_source source ) { printk( "%s", rtems_fatal_source_text( source ) ); } @@ -63,7 +72,7 @@ static bool is_expected_error( rtems_fatal_code error ) #endif /* FATAL_ERROR_EXPECTED_ERROR */ } -void Fatal_extension( +static void Fatal_extension( rtems_fatal_source source, bool always_set_to_false, rtems_fatal_code error @@ -103,3 +112,33 @@ void Fatal_extension( TEST_END(); } } + +#define CONFIGURE_INIT + +#define CONFIGURE_INITIAL_EXTENSIONS \ + { \ + NULL, /* create */ \ + NULL, /* start */ \ + NULL, /* restart */ \ + NULL, /* delete */ \ + NULL, /* switch */ \ + NULL, /* begin */ \ + NULL, /* exitted */ \ + Fatal_extension /* fatal */ \ + }, \ + RTEMS_TEST_INITIAL_EXTENSION + +/* extra parameters may be in testcase.h */ +#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +/* always need an Init task, some cases need more tasks */ +#ifndef SPFATAL_TEST_CASE_EXTRA_TASKS +#define SPFATAL_TEST_CASE_EXTRA_TASKS 0 +#endif +#define CONFIGURE_MAXIMUM_TASKS \ + (SPFATAL_TEST_CASE_EXTRA_TASKS + 1) + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#include diff --git a/testsuites/sptests/spfatal_support/system.h b/testsuites/sptests/spfatal_support/system.h deleted file mode 100644 index c03b303c2b..0000000000 --- a/testsuites/sptests/spfatal_support/system.h +++ /dev/null @@ -1,79 +0,0 @@ -/* system.h - * - * This include file contains information that is included in every - * function in the test set. - * - * COPYRIGHT (c) 1989-2009. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -/* - * Some of the fatal error cases require the ability to peek inside RTEMS - */ - -#include "tmacros.h" - -#include - -/* functions */ - -rtems_task Init( - rtems_task_argument argument -); - -void Fatal_extension( - rtems_fatal_source source, - bool always_set_to_false, - rtems_fatal_code error -); - -void Put_Error( - uint32_t source, - uint32_t error -); - -void Put_Source( rtems_fatal_source source ); - -void force_error(void); - -#include "testcase.h" - -/* configuration information */ - -extern rtems_extensions_table initial_extensions; - -#define CONFIGURE_INITIAL_EXTENSIONS \ - { \ - NULL, /* create */ \ - NULL, /* start */ \ - NULL, /* restart */ \ - NULL, /* delete */ \ - NULL, /* switch */ \ - NULL, /* begin */ \ - NULL, /* exitted */ \ - Fatal_extension /* fatal */ \ - }, \ - RTEMS_TEST_INITIAL_EXTENSION - -/* extra parameters may be in testcase.h */ -#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER - -/* always need an Init task, some cases need more tasks */ -#ifndef SPFATAL_TEST_CASE_EXTRA_TASKS -#define SPFATAL_TEST_CASE_EXTRA_TASKS 0 -#endif -#define CONFIGURE_MAXIMUM_TASKS \ - (SPFATAL_TEST_CASE_EXTRA_TASKS + 1) - -#define CONFIGURE_RTEMS_INIT_TASKS_TABLE - -#include - -/* global variables */ - -/* end of include file */ -- cgit v1.2.3