From c5af8aa0704d52e1d9757b863ed2831282642a56 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 19 Nov 2020 08:40:13 +0100 Subject: config: Simplify task stack allocator init Replace runtime checks with compile time assertions. This makes the INTERNAL_ERROR_BAD_STACK_HOOK obsolete. --- testsuites/sptests/Makefile.am | 9 ------- testsuites/sptests/configure.ac | 1 - testsuites/sptests/spfatal06/init.c | 38 ----------------------------- testsuites/sptests/spfatal06/spfatal06.doc | 20 --------------- testsuites/sptests/spfatal06/spfatal06.scn | 3 --- testsuites/sptests/spinternalerror01/init.c | 15 ++++++++++-- testsuites/sptests/sptimecounter01/init.c | 15 ++++++++++-- 7 files changed, 26 insertions(+), 75 deletions(-) delete mode 100644 testsuites/sptests/spfatal06/init.c delete mode 100644 testsuites/sptests/spfatal06/spfatal06.doc delete mode 100644 testsuites/sptests/spfatal06/spfatal06.scn (limited to 'testsuites/sptests') diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index 854ec3daf8..14788f7fb1 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -940,15 +940,6 @@ spfatal05_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal05) \ $(support_includes) endif -if TEST_spfatal06 -sp_tests += spfatal06 -sp_screens += spfatal06/spfatal06.scn -sp_docs += spfatal06/spfatal06.doc -spfatal06_SOURCES = spfatal06/init.c -spfatal06_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spfatal06) \ - $(support_includes) -endif - if TEST_spfatal09 sp_tests += spfatal09 sp_screens += spfatal09/spfatal09.scn diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac index 460917dd04..099ff0412b 100644 --- a/testsuites/sptests/configure.ac +++ b/testsuites/sptests/configure.ac @@ -141,7 +141,6 @@ RTEMS_TEST_CHECK([spfatal02]) RTEMS_TEST_CHECK([spfatal03]) RTEMS_TEST_CHECK([spfatal04]) RTEMS_TEST_CHECK([spfatal05]) -RTEMS_TEST_CHECK([spfatal06]) RTEMS_TEST_CHECK([spfatal09]) RTEMS_TEST_CHECK([spfatal10]) RTEMS_TEST_CHECK([spfatal11]) diff --git a/testsuites/sptests/spfatal06/init.c b/testsuites/sptests/spfatal06/init.c deleted file mode 100644 index cef38f5fe2..0000000000 --- a/testsuites/sptests/spfatal06/init.c +++ /dev/null @@ -1,38 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "../spfatal_support/spfatal.h" - -/* - * Classic API Init task create failure - * - * COPYRIGHT (c) 1989-2008. - * 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. - */ - -#define FATAL_ERROR_TEST_NAME "6" -#define FATAL_ERROR_DESCRIPTION \ - "Core initialize with invalid stack hook" -#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE -#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_BAD_STACK_HOOK - -#define CONFIGURE_TASK_STACK_ALLOCATOR New_stack_allocate_hook - -#define CONFIGURE_TASK_STACK_DEALLOCATOR NULL - -static void *New_stack_allocate_hook(size_t unused) -{ - return NULL; -} - -static void force_error(void) -{ - /* we will not run this far */ -} - -#include "../spfatal_support/spfatalimpl.h" diff --git a/testsuites/sptests/spfatal06/spfatal06.doc b/testsuites/sptests/spfatal06/spfatal06.doc deleted file mode 100644 index 5deaa3267b..0000000000 --- a/testsuites/sptests/spfatal06/spfatal06.doc +++ /dev/null @@ -1,20 +0,0 @@ -# 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. -# - -This file describes the directives and concepts tested by this test set. - -test set name: spfatal06 - -directives: - - None specifically - -concepts: - -+ Ensure that the error condition when the BSP specific stack allocator - hook is incorrectly configured is properly treated as a fatal error. diff --git a/testsuites/sptests/spfatal06/spfatal06.scn b/testsuites/sptests/spfatal06/spfatal06.scn deleted file mode 100644 index 69d3d52fd4..0000000000 --- a/testsuites/sptests/spfatal06/spfatal06.scn +++ /dev/null @@ -1,3 +0,0 @@ -*** TEST FATAL 6 *** -Fatal error (Core initialize with invalid stack hook) hit -*** END OF TEST FATAL 6 *** diff --git a/testsuites/sptests/spinternalerror01/init.c b/testsuites/sptests/spinternalerror01/init.c index 592cfcfa58..349f9fa1b9 100644 --- a/testsuites/sptests/spinternalerror01/init.c +++ b/testsuites/sptests/spinternalerror01/init.c @@ -58,6 +58,17 @@ static void *idle_body(uintptr_t ignored) return NULL; } +static void *stack_allocate(size_t size) +{ + (void) size; + return NULL; +} + +static void stack_free(void *ptr) +{ + (void) ptr; +} + #define CONFIGURE_INITIAL_EXTENSIONS \ { .fatal = fatal_extension }, \ RTEMS_TEST_INITIAL_EXTENSION @@ -76,9 +87,9 @@ static void *idle_body(uintptr_t ignored) #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER 0 -#define CONFIGURE_TASK_STACK_ALLOCATOR NULL +#define CONFIGURE_TASK_STACK_ALLOCATOR stack_allocate -#define CONFIGURE_TASK_STACK_DEALLOCATOR NULL +#define CONFIGURE_TASK_STACK_DEALLOCATOR stack_free #define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION diff --git a/testsuites/sptests/sptimecounter01/init.c b/testsuites/sptests/sptimecounter01/init.c index 81b705473e..13a00209fa 100644 --- a/testsuites/sptests/sptimecounter01/init.c +++ b/testsuites/sptests/sptimecounter01/init.c @@ -210,6 +210,17 @@ void boot_card(const char *cmdline) _Terminate(RTEMS_FATAL_SOURCE_EXIT, 0); } +static void *stack_allocate(size_t size) +{ + (void) size; + return NULL; +} + +static void stack_free(void *ptr) +{ + (void) ptr; +} + #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER #define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM @@ -224,9 +235,9 @@ void boot_card(const char *cmdline) #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER 0 -#define CONFIGURE_TASK_STACK_ALLOCATOR NULL +#define CONFIGURE_TASK_STACK_ALLOCATOR stack_allocate -#define CONFIGURE_TASK_STACK_DEALLOCATOR NULL +#define CONFIGURE_TASK_STACK_DEALLOCATOR stack_free #define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION -- cgit v1.2.3