tests: Simplify fatal error test support

Move system.h to shared init.c.

Update #3818.
This commit is contained in:
Sebastian Huber
2019-11-12 09:47:20 +01:00
parent 6da85f49ea
commit 1e343825f4
7 changed files with 106 additions and 191 deletions
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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
+42 -6
View File
@@ -11,10 +11,15 @@
#include "config.h"
#endif
#include "tmacros.h"
#include <rtems/bspIo.h>
#define CONFIGURE_INIT
#include "system.h"
#include <tmacros.h>
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 <rtems/confdefs.h>
@@ -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 <rtems.h>
#include <tmacros.h>
/* 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 <rtems/confdefs.h>
/* global variables */
/* end of include file */
+17 -19
View File
@@ -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
+44 -5
View File
@@ -11,8 +11,15 @@
#include "config.h"
#endif
#define CONFIGURE_INIT
#include "system.h"
#include <rtems/bspIo.h>
#include <tmacros.h>
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 <rtems/confdefs.h>
@@ -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 <rtems.h>
/* 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 <rtems/confdefs.h>
/* global variables */
/* end of include file */