From 748e99bc015c6808a33838e012080f693fe149b9 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 30 Jul 2021 14:28:02 +0200 Subject: validation: Test some fatal errors --- ...sp-sparc-leon3-cache-snooping-disabled-boot.yml | 21 ++ ...arc-leon3-cache-snooping-disabled-secondary.yml | 22 ++ .../fatal-bsp-sparc-leon3-clock-initialization.yml | 21 ++ .../fatal-bsp-sparc-leon3-shutdown-nop.yml | 23 ++ .../fatal-bsp-sparc-leon3-shutdown-request.yml | 24 ++ .../fatal-bsp-sparc-leon3-shutdown-response.yml | 24 ++ .../fatal-bsp-sparc-leon3-shutdown-timeout.yml | 24 ++ .../fatal-init-task-construct-failed.yml | 21 ++ .../validation/fatal-too-large-tls-size.yml | 21 ++ spec/build/testsuites/validation/grp.yml | 16 + spec/build/testsuites/validation/validation-0.yml | 1 + spec/build/testsuites/validation/validation-1.yml | 1 + testsuites/validation/tc-score-fatal.c | 367 +++++++++++++++++++++ ...-bsp-sparc-leon3-cache-snooping-disabled-boot.c | 175 ++++++++++ ...-bsp-sparc-leon3-cache-snooping-disabled-boot.h | 84 +++++ ...sparc-leon3-cache-snooping-disabled-secondary.c | 176 ++++++++++ ...sparc-leon3-cache-snooping-disabled-secondary.h | 84 +++++ ...tr-fatal-bsp-sparc-leon3-clock-initialization.c | 190 +++++++++++ ...tr-fatal-bsp-sparc-leon3-clock-initialization.h | 84 +++++ .../tr-fatal-bsp-sparc-leon3-shutdown-response.c | 190 +++++++++++ .../tr-fatal-bsp-sparc-leon3-shutdown-response.h | 84 +++++ .../tr-fatal-bsp-sparc-leon3-shutdown-timeout.c | 185 +++++++++++ .../tr-fatal-bsp-sparc-leon3-shutdown-timeout.h | 84 +++++ .../tr-fatal-init-task-construct-failed.c | 158 +++++++++ .../tr-fatal-init-task-construct-failed.h | 84 +++++ .../validation/tr-fatal-too-large-tls-size.c | 168 ++++++++++ .../validation/tr-fatal-too-large-tls-size.h | 84 +++++ ...-bsp-sparc-leon3-cache-snooping-disabled-boot.c | 79 +++++ ...sparc-leon3-cache-snooping-disabled-secondary.c | 82 +++++ ...ts-fatal-bsp-sparc-leon3-clock-initialization.c | 79 +++++ .../ts-fatal-bsp-sparc-leon3-shutdown-nop.c | 114 +++++++ .../ts-fatal-bsp-sparc-leon3-shutdown-response.c | 81 +++++ .../ts-fatal-bsp-sparc-leon3-shutdown-timeout.c | 81 +++++ .../ts-fatal-init-task-construct-failed.c | 95 ++++++ testsuites/validation/ts-fatal-sysinit.h | 132 ++++++++ .../validation/ts-fatal-too-large-tls-size.c | 82 +++++ 36 files changed, 3241 insertions(+) create mode 100644 spec/build/testsuites/validation/fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.yml create mode 100644 spec/build/testsuites/validation/fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.yml create mode 100644 spec/build/testsuites/validation/fatal-bsp-sparc-leon3-clock-initialization.yml create mode 100644 spec/build/testsuites/validation/fatal-bsp-sparc-leon3-shutdown-nop.yml create mode 100644 spec/build/testsuites/validation/fatal-bsp-sparc-leon3-shutdown-request.yml create mode 100644 spec/build/testsuites/validation/fatal-bsp-sparc-leon3-shutdown-response.yml create mode 100644 spec/build/testsuites/validation/fatal-bsp-sparc-leon3-shutdown-timeout.yml create mode 100644 spec/build/testsuites/validation/fatal-init-task-construct-failed.yml create mode 100644 spec/build/testsuites/validation/fatal-too-large-tls-size.yml create mode 100644 testsuites/validation/tc-score-fatal.c create mode 100644 testsuites/validation/tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.c create mode 100644 testsuites/validation/tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.h create mode 100644 testsuites/validation/tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.c create mode 100644 testsuites/validation/tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.h create mode 100644 testsuites/validation/tr-fatal-bsp-sparc-leon3-clock-initialization.c create mode 100644 testsuites/validation/tr-fatal-bsp-sparc-leon3-clock-initialization.h create mode 100644 testsuites/validation/tr-fatal-bsp-sparc-leon3-shutdown-response.c create mode 100644 testsuites/validation/tr-fatal-bsp-sparc-leon3-shutdown-response.h create mode 100644 testsuites/validation/tr-fatal-bsp-sparc-leon3-shutdown-timeout.c create mode 100644 testsuites/validation/tr-fatal-bsp-sparc-leon3-shutdown-timeout.h create mode 100644 testsuites/validation/tr-fatal-init-task-construct-failed.c create mode 100644 testsuites/validation/tr-fatal-init-task-construct-failed.h create mode 100644 testsuites/validation/tr-fatal-too-large-tls-size.c create mode 100644 testsuites/validation/tr-fatal-too-large-tls-size.h create mode 100644 testsuites/validation/ts-fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.c create mode 100644 testsuites/validation/ts-fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.c create mode 100644 testsuites/validation/ts-fatal-bsp-sparc-leon3-clock-initialization.c create mode 100644 testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-nop.c create mode 100644 testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-response.c create mode 100644 testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-timeout.c create mode 100644 testsuites/validation/ts-fatal-init-task-construct-failed.c create mode 100644 testsuites/validation/ts-fatal-sysinit.h create mode 100644 testsuites/validation/ts-fatal-too-large-tls-size.c diff --git a/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.yml b/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.yml new file mode 100644 index 0000000000..0522d85e51 --- /dev/null +++ b/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.yml @@ -0,0 +1,21 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +build-type: test-program +cflags: [] +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +cppflags: [] +cxxflags: [] +enabled-by: bsps/sparc/leon3 +features: c cprogram +includes: [] +ldflags: [] +links: [] +source: +- testsuites/validation/tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.c +- testsuites/validation/ts-fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.c +stlib: [] +target: testsuites/validation/ts-fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.exe +type: build +use-after: +- validation +use-before: [] diff --git a/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.yml b/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.yml new file mode 100644 index 0000000000..2c40bef27b --- /dev/null +++ b/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.yml @@ -0,0 +1,22 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +build-type: test-program +cflags: [] +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +cppflags: [] +cxxflags: [] +enabled-by: bsps/sparc/leon3 +features: c cprogram +includes: [] +ldflags: +- -Wl,--wrap=bsp_start_on_secondary_processor +links: [] +source: +- testsuites/validation/tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.c +- testsuites/validation/ts-fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.c +stlib: [] +target: testsuites/validation/ts-fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.exe +type: build +use-after: +- validation +use-before: [] diff --git a/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-clock-initialization.yml b/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-clock-initialization.yml new file mode 100644 index 0000000000..fab4045c90 --- /dev/null +++ b/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-clock-initialization.yml @@ -0,0 +1,21 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +build-type: test-program +cflags: [] +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +cppflags: [] +cxxflags: [] +enabled-by: bsps/sparc/leon3 +features: c cprogram +includes: [] +ldflags: [] +links: [] +source: +- testsuites/validation/tr-fatal-bsp-sparc-leon3-clock-initialization.c +- testsuites/validation/ts-fatal-bsp-sparc-leon3-clock-initialization.c +stlib: [] +target: testsuites/validation/ts-fatal-bsp-sparc-leon3-clock-initialization.exe +type: build +use-after: +- validation +use-before: [] diff --git a/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-shutdown-nop.yml b/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-shutdown-nop.yml new file mode 100644 index 0000000000..0bebc1d5e2 --- /dev/null +++ b/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-shutdown-nop.yml @@ -0,0 +1,23 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +build-type: test-program +cflags: [] +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +cppflags: [] +cxxflags: [] +enabled-by: + and: + - RTEMS_SMP + - bsps/sparc/leon3 +features: c cprogram +includes: [] +ldflags: [] +links: [] +source: +- testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-nop.c +stlib: [] +target: testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-nop.exe +type: build +use-after: +- validation +use-before: [] diff --git a/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-shutdown-request.yml b/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-shutdown-request.yml new file mode 100644 index 0000000000..730102a1de --- /dev/null +++ b/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-shutdown-request.yml @@ -0,0 +1,24 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +build-type: test-program +cflags: [] +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +cppflags: [] +cxxflags: [] +enabled-by: + and: + - RTEMS_SMP + - bsps/sparc/leon3 +features: c cprogram +includes: [] +ldflags: [] +links: [] +source: +- testsuites/validation/tr-fatal-bsp-sparc-leon3-shutdown-response.c +- testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-response.c +stlib: [] +target: testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-response.exe +type: build +use-after: +- validation +use-before: [] diff --git a/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-shutdown-response.yml b/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-shutdown-response.yml new file mode 100644 index 0000000000..730102a1de --- /dev/null +++ b/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-shutdown-response.yml @@ -0,0 +1,24 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +build-type: test-program +cflags: [] +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +cppflags: [] +cxxflags: [] +enabled-by: + and: + - RTEMS_SMP + - bsps/sparc/leon3 +features: c cprogram +includes: [] +ldflags: [] +links: [] +source: +- testsuites/validation/tr-fatal-bsp-sparc-leon3-shutdown-response.c +- testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-response.c +stlib: [] +target: testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-response.exe +type: build +use-after: +- validation +use-before: [] diff --git a/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-shutdown-timeout.yml b/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-shutdown-timeout.yml new file mode 100644 index 0000000000..0d3b4c9569 --- /dev/null +++ b/spec/build/testsuites/validation/fatal-bsp-sparc-leon3-shutdown-timeout.yml @@ -0,0 +1,24 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +build-type: test-program +cflags: [] +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +cppflags: [] +cxxflags: [] +enabled-by: + and: + - RTEMS_SMP + - bsps/sparc/leon3 +features: c cprogram +includes: [] +ldflags: [] +links: [] +source: +- testsuites/validation/tr-fatal-bsp-sparc-leon3-shutdown-timeout.c +- testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-timeout.c +stlib: [] +target: testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-timeout.exe +type: build +use-after: +- validation +use-before: [] diff --git a/spec/build/testsuites/validation/fatal-init-task-construct-failed.yml b/spec/build/testsuites/validation/fatal-init-task-construct-failed.yml new file mode 100644 index 0000000000..eebbd1edaa --- /dev/null +++ b/spec/build/testsuites/validation/fatal-init-task-construct-failed.yml @@ -0,0 +1,21 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +build-type: test-program +cflags: [] +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +cppflags: [] +cxxflags: [] +enabled-by: true +features: c cprogram +includes: [] +ldflags: [] +links: [] +source: +- testsuites/validation/tr-fatal-init-task-construct-failed.c +- testsuites/validation/ts-fatal-init-task-construct-failed.c +stlib: [] +target: testsuites/validation/ts-fatal-init-task-construct-failed.exe +type: build +use-after: +- validation +use-before: [] diff --git a/spec/build/testsuites/validation/fatal-too-large-tls-size.yml b/spec/build/testsuites/validation/fatal-too-large-tls-size.yml new file mode 100644 index 0000000000..fb1ddf450f --- /dev/null +++ b/spec/build/testsuites/validation/fatal-too-large-tls-size.yml @@ -0,0 +1,21 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +build-type: test-program +cflags: [] +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +cppflags: [] +cxxflags: [] +enabled-by: true +features: c cprogram +includes: [] +ldflags: [] +links: [] +source: +- testsuites/validation/tr-fatal-too-large-tls-size.c +- testsuites/validation/ts-fatal-too-large-tls-size.c +stlib: [] +target: testsuites/validation/ts-fatal-too-large-tls-size.exe +type: build +use-after: +- validation +use-before: [] diff --git a/spec/build/testsuites/validation/grp.yml b/spec/build/testsuites/validation/grp.yml index 1566b62db1..7a2d45b3f6 100644 --- a/spec/build/testsuites/validation/grp.yml +++ b/spec/build/testsuites/validation/grp.yml @@ -12,6 +12,22 @@ ldflags: [] links: - role: build-dependency uid: libvalidation +- role: build-dependency + uid: fatal-bsp-sparc-leon3-cache-snooping-disabled-boot +- role: build-dependency + uid: fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary +- role: build-dependency + uid: fatal-bsp-sparc-leon3-clock-initialization +- role: build-dependency + uid: fatal-bsp-sparc-leon3-shutdown-nop +- role: build-dependency + uid: fatal-bsp-sparc-leon3-shutdown-response +- role: build-dependency + uid: fatal-bsp-sparc-leon3-shutdown-timeout +- role: build-dependency + uid: fatal-init-task-construct-failed +- role: build-dependency + uid: fatal-too-large-tls-size - role: build-dependency uid: model-0 - role: build-dependency diff --git a/spec/build/testsuites/validation/validation-0.yml b/spec/build/testsuites/validation/validation-0.yml index 7d674ac030..bc78584e04 100644 --- a/spec/build/testsuites/validation/validation-0.yml +++ b/spec/build/testsuites/validation/validation-0.yml @@ -64,6 +64,7 @@ source: - testsuites/validation/tc-scheduler-ident-by-processor.c - testsuites/validation/tc-scheduler-ident-by-processor-set.c - testsuites/validation/tc-scheduler-remove-processor.c +- testsuites/validation/tc-score-fatal.c - testsuites/validation/tc-sem-create.c - testsuites/validation/tc-sem-ident.c - testsuites/validation/tc-sem-obtain.c diff --git a/spec/build/testsuites/validation/validation-1.yml b/spec/build/testsuites/validation/validation-1.yml index d53750a358..6490b91b1e 100644 --- a/spec/build/testsuites/validation/validation-1.yml +++ b/spec/build/testsuites/validation/validation-1.yml @@ -14,6 +14,7 @@ source: - testsuites/validation/tc-sem-delete.c - testsuites/validation/tc-signal-catch.c - testsuites/validation/tc-signal-send.c +- testsuites/validation/tc-score-fatal.c - testsuites/validation/tc-task-construct-errors.c - testsuites/validation/tc-task-create-errors.c - testsuites/validation/tc-task-mode.c diff --git a/testsuites/validation/tc-score-fatal.c b/testsuites/validation/tc-score-fatal.c new file mode 100644 index 0000000000..1edb45514f --- /dev/null +++ b/testsuites/validation/tc-score-fatal.c @@ -0,0 +1,367 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseScoreValFatal + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +#include "tx-support.h" + +#include + +/** + * @defgroup RTEMSTestCaseScoreValFatal spec:/score/val/fatal + * + * @ingroup RTEMSTestSuiteTestsuitesValidation0 + * @ingroup RTEMSTestSuiteTestsuitesValidation1 + * + * @brief Tests some fatal errors. + * + * This test case performs the following actions: + * + * - Construct a task with a task body which returns. Check that the right + * fatal error occurs. + * + * - Construct a task which performs a thread dispatch with maskable interrupts + * disabled. Check that the right fatal error occurs or no fatal error + * occurs. + * + * - Construct a task which performs a direct thread dispatch with a thread + * dispatch level not equal to one. Check that the right fatal error occurs. + * + * - Create a mutex and construct a task which produces a deadlock which + * involves the allocator mutex. + * + * @{ + */ + +typedef struct { + Atomic_Uint counter; + rtems_fatal_source source; + bool always_set_to_false; + rtems_fatal_code code; +} FatalInfo; + +static FatalInfo fatal_info; + +static unsigned int GetFatalCounter( void ) +{ + return _Atomic_Load_uint( &fatal_info.counter, ATOMIC_ORDER_RELAXED ); +} + +static unsigned int ResetFatalInfo( void ) +{ + fatal_info.source = RTEMS_FATAL_SOURCE_APPLICATION; + fatal_info.always_set_to_false = true; + fatal_info.code = INTERNAL_ERROR_NO_MPCI; + + return GetFatalCounter(); +} + +static void Fatal( + rtems_fatal_source source, + bool always_set_to_false, + rtems_fatal_code code +) +{ + fatal_info.source = source; + fatal_info.always_set_to_false = always_set_to_false; + fatal_info.code = code; + _Atomic_Fetch_add_uint( &fatal_info.counter, 1, ATOMIC_ORDER_RELAXED ); +} + +static void FatalTaskExit( + rtems_fatal_source source, + bool always_set_to_false, + rtems_fatal_code code +) +{ + Fatal( source, always_set_to_false, code ); + rtems_task_exit(); +} + +static void ExitTask( rtems_task_argument arg ) +{ + (void) arg; +} + +static void FatalBadThreadDispatchEnvironment( + rtems_fatal_source source, + bool always_set_to_false, + rtems_fatal_code code +) +{ + Fatal( source, always_set_to_false, code ); + _ISR_Set_level( 0 ); + _Thread_Dispatch_direct_no_return( _Per_CPU_Get() ); +} + +static void ISRDisabledThreadDispatchTask( rtems_task_argument arg ) +{ + rtems_interrupt_level level; + + (void) arg; + rtems_interrupt_local_disable( level ); + (void) level; + rtems_task_exit(); +} + +static void FatalBadThreadDispatchDisableLevel( + rtems_fatal_source source, + bool always_set_to_false, + rtems_fatal_code code +) +{ + Per_CPU_Control *cpu_self; + + Fatal( source, always_set_to_false, code ); + cpu_self = _Per_CPU_Get(); + _Thread_Dispatch_unnest( cpu_self ); + _Thread_Dispatch_direct_no_return( cpu_self ); +} + +static void BadLevelThreadDispatchTask( rtems_task_argument arg ) +{ + (void) arg; + _Thread_Dispatch_disable(); + rtems_task_exit(); +} + +static jmp_buf before_deadlock; + +static rtems_id deadlock_mutex; + +static bool ThreadCreateDeadlock( rtems_tcb *executing, rtems_tcb *created ) +{ + (void) executing; + (void) created; + + ObtainMutex( deadlock_mutex ); + ReleaseMutex( deadlock_mutex ); + + return true; +} + +static void FatalThreadQueueDeadlock( + rtems_fatal_source source, + bool always_set_to_false, + rtems_fatal_code code +) +{ + Fatal( source, always_set_to_false, code ); + longjmp( before_deadlock, 1 ); +} + +static void ThreadQueueDeadlockTask( rtems_task_argument arg ) +{ + rtems_id id; + + (void) arg; + id = CreateTask( "DORM", PRIO_NORMAL ); + DeleteTask( id ); + + rtems_task_exit(); +} + +/** + * @brief Construct a task with a task body which returns. Check that the + * right fatal error occurs. + */ +static void ScoreValFatal_Action_0( void ) +{ + rtems_id id; + unsigned int counter; + + SetFatalExtension( FatalTaskExit ); + SetSelfPriority( PRIO_NORMAL ); + counter = ResetFatalInfo(); + id = CreateTask( "EXIT", PRIO_HIGH ); + StartTask( id, ExitTask, NULL ); + T_eq_uint( GetFatalCounter(), counter + 1 ); + T_eq_int( fatal_info.source, INTERNAL_ERROR_CORE ); + T_false( fatal_info.always_set_to_false ); + T_eq_ulong( fatal_info.code, INTERNAL_ERROR_THREAD_EXITTED ); + RestoreRunnerPriority(); + SetFatalExtension( NULL ); +} + +/** + * @brief Construct a task which performs a thread dispatch with maskable + * interrupts disabled. Check that the right fatal error occurs or no fatal + * error occurs. + */ +static void ScoreValFatal_Action_1( void ) +{ + rtems_id id; + unsigned int counter; + + SetFatalExtension( FatalBadThreadDispatchEnvironment ); + SetSelfPriority( PRIO_NORMAL ); + counter = ResetFatalInfo(); + id = CreateTask( "BENV", PRIO_HIGH ); + StartTask( id, ISRDisabledThreadDispatchTask, NULL ); + + if ( rtems_configuration_get_maximum_processors() > 1 ) { + T_eq_uint( GetFatalCounter(), counter + 1 ); + T_eq_int( fatal_info.source, INTERNAL_ERROR_CORE ); + T_false( fatal_info.always_set_to_false ); + T_eq_ulong( + fatal_info.code, + INTERNAL_ERROR_BAD_THREAD_DISPATCH_ENVIRONMENT + ); + } else { + T_eq_uint( GetFatalCounter(), counter ); + } + + RestoreRunnerPriority(); + SetFatalExtension( NULL ); +} + +/** + * @brief Construct a task which performs a direct thread dispatch with a + * thread dispatch level not equal to one. Check that the right fatal error + * occurs. + */ +static void ScoreValFatal_Action_2( void ) +{ + rtems_id id; + unsigned int counter; + + SetFatalExtension( FatalBadThreadDispatchDisableLevel ); + SetSelfPriority( PRIO_NORMAL ); + counter = ResetFatalInfo(); + id = CreateTask( "BLVL", PRIO_HIGH ); + StartTask( id, BadLevelThreadDispatchTask, NULL ); + T_eq_uint( GetFatalCounter(), counter + 1 ); + T_eq_int( fatal_info.source, INTERNAL_ERROR_CORE ); + T_false( fatal_info.always_set_to_false ); + T_eq_ulong( + fatal_info.code, + INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL + ); + RestoreRunnerPriority(); + SetFatalExtension( NULL ); +} + +/** + * @brief Create a mutex and construct a task which produces a deadlock which + * involves the allocator mutex. + */ +static void ScoreValFatal_Action_3( void ) +{ + rtems_extensions_table extensions; + rtems_status_code sc; + rtems_id extension_id; + rtems_id task_id; + unsigned int counter; + + memset( &extensions, 0, sizeof( extensions ) ); + extensions.thread_create = ThreadCreateDeadlock; + + sc = rtems_extension_create( + rtems_build_name( 'T', 'E', 'X', 'T' ), + &extensions, + &extension_id + ); + T_rsc_success( sc ); + + deadlock_mutex = CreateMutex(); + + SetFatalExtension( FatalThreadQueueDeadlock ); + SetSelfPriority( PRIO_NORMAL ); + counter = ResetFatalInfo(); + + ObtainMutex( deadlock_mutex ); + + task_id = CreateTask( "WORK", PRIO_HIGH ); + StartTask( task_id, ThreadQueueDeadlockTask, NULL ); + + if ( setjmp( before_deadlock ) == 0 ) { + (void) CreateTask( "DLCK", PRIO_NORMAL ); + } + + ReleaseMutex( deadlock_mutex ); + + T_eq_uint( GetFatalCounter(), counter + 1 ); + T_eq_int( fatal_info.source, INTERNAL_ERROR_CORE ); + T_false( fatal_info.always_set_to_false ); + T_eq_ulong( + fatal_info.code, + INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK + ); + + RestoreRunnerPriority(); + SetFatalExtension( NULL ); + + sc = rtems_extension_delete( extension_id ); + T_rsc_success( sc ); + + DeleteMutex( deadlock_mutex ); +} + +/** + * @fn void T_case_body_ScoreValFatal( void ) + */ +T_TEST_CASE( ScoreValFatal ) +{ + ScoreValFatal_Action_0(); + ScoreValFatal_Action_1(); + ScoreValFatal_Action_2(); + ScoreValFatal_Action_3(); +} + +/** @} */ diff --git a/testsuites/validation/tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.c b/testsuites/validation/tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.c new file mode 100644 index 0000000000..fc22235018 --- /dev/null +++ b/testsuites/validation/tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.c @@ -0,0 +1,175 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseBspSparcLeon3ValFatalCacheSnoopingDisabledBoot + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include "tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.h" + +#include + +/** + * @defgroup RTEMSTestCaseBspSparcLeon3ValFatalCacheSnoopingDisabledBoot \ + * spec:/bsp/sparc/leon3/val/fatal-cache-snooping-disabled-boot + * + * @ingroup RTEMSTestSuiteTestsuitesFatalBspSparcLeon3CacheSnoopingDisabledBoot + * + * @brief Tests a fatal error. + * + * This test case performs the following actions: + * + * - The test action is carried out by the DisableCacheSnooping() system + * initialization handler. + * + * - Check that the expected fatal source is present. + * + * - Check that the expected fatal code is present. + * + * @{ + */ + +/** + * @brief Test context for + * spec:/bsp/sparc/leon3/val/fatal-cache-snooping-disabled-boot test case. + */ +typedef struct { + /** + * @brief This member contains a copy of the corresponding + * BspSparcLeon3ValFatalCacheSnoopingDisabledBoot_Run() parameter. + */ + rtems_fatal_source source; + + /** + * @brief This member contains a copy of the corresponding + * BspSparcLeon3ValFatalCacheSnoopingDisabledBoot_Run() parameter. + */ + rtems_fatal_code code; +} BspSparcLeon3ValFatalCacheSnoopingDisabledBoot_Context; + +static BspSparcLeon3ValFatalCacheSnoopingDisabledBoot_Context + BspSparcLeon3ValFatalCacheSnoopingDisabledBoot_Instance; + +static T_fixture BspSparcLeon3ValFatalCacheSnoopingDisabledBoot_Fixture = { + .setup = NULL, + .stop = NULL, + .teardown = NULL, + .scope = NULL, + .initial_context = &BspSparcLeon3ValFatalCacheSnoopingDisabledBoot_Instance +}; + +static void DisableCacheSnooping( void ) +{ + uint32_t control; + + control = leon3_get_cache_control_register(); + control &= ~LEON3_REG_CACHE_CTRL_DS; + leon3_set_cache_control_register( control ); +} + +RTEMS_SYSINIT_ITEM( + DisableCacheSnooping, + RTEMS_SYSINIT_BSP_EARLY, + RTEMS_SYSINIT_ORDER_FIRST +); + +/** + * @brief The test action is carried out by the DisableCacheSnooping() system + * initialization handler. + */ +static void BspSparcLeon3ValFatalCacheSnoopingDisabledBoot_Action_0( + BspSparcLeon3ValFatalCacheSnoopingDisabledBoot_Context *ctx +) +{ + /* Nothing to do */ + + /* + * Check that the expected fatal source is present. + */ + T_step_eq_int( 0, ctx->source, RTEMS_FATAL_SOURCE_BSP ); + + /* + * Check that the expected fatal code is present. + */ + T_step_eq_ulong( + 1, + ctx->code, + LEON3_FATAL_INVALID_CACHE_CONFIG_BOOT_PROCESSOR + ); +} + +void BspSparcLeon3ValFatalCacheSnoopingDisabledBoot_Run( + rtems_fatal_source source, + rtems_fatal_code code +) +{ + BspSparcLeon3ValFatalCacheSnoopingDisabledBoot_Context *ctx; + + ctx = &BspSparcLeon3ValFatalCacheSnoopingDisabledBoot_Instance; + ctx->source = source; + ctx->code = code; + + ctx = T_case_begin( + "BspSparcLeon3ValFatalCacheSnoopingDisabledBoot", + &BspSparcLeon3ValFatalCacheSnoopingDisabledBoot_Fixture + ); + + T_plan( 2 ); + + BspSparcLeon3ValFatalCacheSnoopingDisabledBoot_Action_0( ctx ); + + T_case_end(); +} + +/** @} */ diff --git a/testsuites/validation/tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.h b/testsuites/validation/tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.h new file mode 100644 index 0000000000..5254d0caf3 --- /dev/null +++ b/testsuites/validation/tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.h @@ -0,0 +1,84 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseBspSparcLeon3ValFatalCacheSnoopingDisabledBoot + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifndef _TR_FATAL_BSP_SPARC_LEON3_CACHE_SNOOPING_DISABLED_BOOT_H +#define _TR_FATAL_BSP_SPARC_LEON3_CACHE_SNOOPING_DISABLED_BOOT_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup RTEMSTestCaseBspSparcLeon3ValFatalCacheSnoopingDisabledBoot + * + * @{ + */ + +/** + * @brief Runs the parameterized test case. + * + * @param source is fatal source. + * + * @param code is fatal code. + */ +void BspSparcLeon3ValFatalCacheSnoopingDisabledBoot_Run( + rtems_fatal_source source, + rtems_fatal_code code +); + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* _TR_FATAL_BSP_SPARC_LEON3_CACHE_SNOOPING_DISABLED_BOOT_H */ diff --git a/testsuites/validation/tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.c b/testsuites/validation/tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.c new file mode 100644 index 0000000000..03fdad088c --- /dev/null +++ b/testsuites/validation/tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.c @@ -0,0 +1,176 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseBspSparcLeon3ValFatalCacheSnoopingDisabledSecondary + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include "tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.h" + +#include + +/** + * @defgroup RTEMSTestCaseBspSparcLeon3ValFatalCacheSnoopingDisabledSecondary \ + * spec:/bsp/sparc/leon3/val/fatal-cache-snooping-disabled-secondary + * + * @ingroup RTEMSTestSuiteTestsuitesFatalBspSparcLeon3CacheSnoopingDisabledSecondary + * + * @brief Tests a fatal error. + * + * This test case performs the following actions: + * + * - The test action is carried out by the wrapped + * bsp_start_on_secondary_processor() function. + * + * - Check that the expected fatal source is present. + * + * - Check that the expected fatal code is present. + * + * @{ + */ + +/** + * @brief Test context for + * spec:/bsp/sparc/leon3/val/fatal-cache-snooping-disabled-secondary test + * case. + */ +typedef struct { + /** + * @brief This member contains a copy of the corresponding + * BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary_Run() parameter. + */ + rtems_fatal_source source; + + /** + * @brief This member contains a copy of the corresponding + * BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary_Run() parameter. + */ + rtems_fatal_code code; +} BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary_Context; + +static BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary_Context + BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary_Instance; + +static T_fixture BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary_Fixture = { + .setup = NULL, + .stop = NULL, + .teardown = NULL, + .scope = NULL, + .initial_context = &BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary_Instance +}; + +void __real_bsp_start_on_secondary_processor( struct Per_CPU_Control *cpu_self ); + +void __wrap_bsp_start_on_secondary_processor( struct Per_CPU_Control *cpu_self ); + +void __wrap_bsp_start_on_secondary_processor( struct Per_CPU_Control *cpu_self ) +{ + uint32_t control; + + control = leon3_get_cache_control_register(); + control &= ~LEON3_REG_CACHE_CTRL_DS; + leon3_set_cache_control_register( control ); + + __real_bsp_start_on_secondary_processor( cpu_self ); +} + +/** + * @brief The test action is carried out by the wrapped + * bsp_start_on_secondary_processor() function. + */ +static void BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary_Action_0( + BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary_Context *ctx +) +{ + /* Nothing to do */ + + /* + * Check that the expected fatal source is present. + */ + T_step_eq_int( 0, ctx->source, RTEMS_FATAL_SOURCE_BSP ); + + /* + * Check that the expected fatal code is present. + */ + T_step_eq_ulong( + 1, + ctx->code, + LEON3_FATAL_INVALID_CACHE_CONFIG_SECONDARY_PROCESSOR + ); +} + +void BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary_Run( + rtems_fatal_source source, + rtems_fatal_code code +) +{ + BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary_Context *ctx; + + ctx = &BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary_Instance; + ctx->source = source; + ctx->code = code; + + ctx = T_case_begin( + "BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary", + &BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary_Fixture + ); + + T_plan( 2 ); + + BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary_Action_0( ctx ); + + T_case_end(); +} + +/** @} */ diff --git a/testsuites/validation/tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.h b/testsuites/validation/tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.h new file mode 100644 index 0000000000..638f3f204a --- /dev/null +++ b/testsuites/validation/tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.h @@ -0,0 +1,84 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseBspSparcLeon3ValFatalCacheSnoopingDisabledSecondary + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifndef _TR_FATAL_BSP_SPARC_LEON3_CACHE_SNOOPING_DISABLED_SECONDARY_H +#define _TR_FATAL_BSP_SPARC_LEON3_CACHE_SNOOPING_DISABLED_SECONDARY_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup RTEMSTestCaseBspSparcLeon3ValFatalCacheSnoopingDisabledSecondary + * + * @{ + */ + +/** + * @brief Runs the parameterized test case. + * + * @param source is fatal source. + * + * @param code is fatal code. + */ +void BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary_Run( + rtems_fatal_source source, + rtems_fatal_code code +); + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* _TR_FATAL_BSP_SPARC_LEON3_CACHE_SNOOPING_DISABLED_SECONDARY_H */ diff --git a/testsuites/validation/tr-fatal-bsp-sparc-leon3-clock-initialization.c b/testsuites/validation/tr-fatal-bsp-sparc-leon3-clock-initialization.c new file mode 100644 index 0000000000..0127567aaa --- /dev/null +++ b/testsuites/validation/tr-fatal-bsp-sparc-leon3-clock-initialization.c @@ -0,0 +1,190 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseBspSparcLeon3ValFatalClockInitialization + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "tr-fatal-bsp-sparc-leon3-clock-initialization.h" + +#include + +/** + * @defgroup RTEMSTestCaseBspSparcLeon3ValFatalClockInitialization \ + * spec:/bsp/sparc/leon3/val/fatal-clock-initialization + * + * @ingroup RTEMSTestSuiteTestsuitesFatalBspSparcLeon3ClockInitialization + * + * @brief Tests a fatal error. + * + * This test case performs the following actions: + * + * - The test action is carried out by the OccupyClockInterrupt() system + * initialization handler. + * + * - Check that the expected fatal source is present. + * + * - Check that the expected fatal code is present. + * + * @{ + */ + +/** + * @brief Test context for spec:/bsp/sparc/leon3/val/fatal-clock-initialization + * test case. + */ +typedef struct { + /** + * @brief This member contains a copy of the corresponding + * BspSparcLeon3ValFatalClockInitialization_Run() parameter. + */ + rtems_fatal_source source; + + /** + * @brief This member contains a copy of the corresponding + * BspSparcLeon3ValFatalClockInitialization_Run() parameter. + */ + rtems_fatal_code code; +} BspSparcLeon3ValFatalClockInitialization_Context; + +static BspSparcLeon3ValFatalClockInitialization_Context + BspSparcLeon3ValFatalClockInitialization_Instance; + +static T_fixture BspSparcLeon3ValFatalClockInitialization_Fixture = { + .setup = NULL, + .stop = NULL, + .teardown = NULL, + .scope = NULL, + .initial_context = &BspSparcLeon3ValFatalClockInitialization_Instance +}; + +static void ClockInterrupt( void *arg ) +{ + (void) arg; +} + +static rtems_interrupt_entry interrupt_entry = RTEMS_INTERRUPT_ENTRY_INITIALIZER( + ClockInterrupt, + NULL, + "Clock" +); + +static void OccupyClockInterrupt( void ) +{ + rtems_vector_number vector; + + vector = GPTIMER_CONFIG_IRQ_GET( grlib_load_32( &LEON3_Timer_Regs->config ) ); + (void) rtems_interrupt_entry_install( + vector, + RTEMS_INTERRUPT_UNIQUE, + &interrupt_entry + ); +} + +RTEMS_SYSINIT_ITEM( + OccupyClockInterrupt, + RTEMS_SYSINIT_DEVICE_DRIVERS, + RTEMS_SYSINIT_ORDER_FIRST +); + +/** + * @brief The test action is carried out by the OccupyClockInterrupt() system + * initialization handler. + */ +static void BspSparcLeon3ValFatalClockInitialization_Action_0( + BspSparcLeon3ValFatalClockInitialization_Context *ctx +) +{ + /* Nothing to do */ + + /* + * Check that the expected fatal source is present. + */ + T_step_eq_int( 0, ctx->source, RTEMS_FATAL_SOURCE_BSP ); + + /* + * Check that the expected fatal code is present. + */ + T_step_eq_ulong( + 1, + ctx->code, + LEON3_FATAL_CLOCK_INITIALIZATION + ); +} + +void BspSparcLeon3ValFatalClockInitialization_Run( + rtems_fatal_source source, + rtems_fatal_code code +) +{ + BspSparcLeon3ValFatalClockInitialization_Context *ctx; + + ctx = &BspSparcLeon3ValFatalClockInitialization_Instance; + ctx->source = source; + ctx->code = code; + + ctx = T_case_begin( + "BspSparcLeon3ValFatalClockInitialization", + &BspSparcLeon3ValFatalClockInitialization_Fixture + ); + + T_plan( 2 ); + + BspSparcLeon3ValFatalClockInitialization_Action_0( ctx ); + + T_case_end(); +} + +/** @} */ diff --git a/testsuites/validation/tr-fatal-bsp-sparc-leon3-clock-initialization.h b/testsuites/validation/tr-fatal-bsp-sparc-leon3-clock-initialization.h new file mode 100644 index 0000000000..f782643359 --- /dev/null +++ b/testsuites/validation/tr-fatal-bsp-sparc-leon3-clock-initialization.h @@ -0,0 +1,84 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseBspSparcLeon3ValFatalClockInitialization + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifndef _TR_FATAL_BSP_SPARC_LEON3_CLOCK_INITIALIZATION_H +#define _TR_FATAL_BSP_SPARC_LEON3_CLOCK_INITIALIZATION_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup RTEMSTestCaseBspSparcLeon3ValFatalClockInitialization + * + * @{ + */ + +/** + * @brief Runs the parameterized test case. + * + * @param source is fatal source. + * + * @param code is fatal code. + */ +void BspSparcLeon3ValFatalClockInitialization_Run( + rtems_fatal_source source, + rtems_fatal_code code +); + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* _TR_FATAL_BSP_SPARC_LEON3_CLOCK_INITIALIZATION_H */ diff --git a/testsuites/validation/tr-fatal-bsp-sparc-leon3-shutdown-response.c b/testsuites/validation/tr-fatal-bsp-sparc-leon3-shutdown-response.c new file mode 100644 index 0000000000..c6f22c2523 --- /dev/null +++ b/testsuites/validation/tr-fatal-bsp-sparc-leon3-shutdown-response.c @@ -0,0 +1,190 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseBspSparcLeon3ValFatalShutdownResponse + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include "tr-fatal-bsp-sparc-leon3-shutdown-response.h" + +#include + +/** + * @defgroup RTEMSTestCaseBspSparcLeon3ValFatalShutdownResponse \ + * spec:/bsp/sparc/leon3/val/fatal-shutdown-response + * + * @ingroup RTEMSTestSuiteTestsuitesFatalBspSparcLeon3ShutdownResponse + * + * @brief Tests a fatal error. + * + * This test case performs the following actions: + * + * - Request an SMP shutdown on the second processor and wait for a power down + * of this processor. + * + * - Check that the expected fatal source is present. + * + * - Check that the expected fatal code is present. + * + * - Check that the second processor was not powered down before the shutdown + * request. + * + * - Wait until the second processor is powered down. + * + * @{ + */ + +/** + * @brief Test context for spec:/bsp/sparc/leon3/val/fatal-shutdown-response + * test case. + */ +typedef struct { + /** + * @brief This member contains a copy of the corresponding + * BspSparcLeon3ValFatalShutdownResponse_Run() parameter. + */ + rtems_fatal_source source; + + /** + * @brief This member contains a copy of the corresponding + * BspSparcLeon3ValFatalShutdownResponse_Run() parameter. + */ + rtems_fatal_code code; +} BspSparcLeon3ValFatalShutdownResponse_Context; + +static BspSparcLeon3ValFatalShutdownResponse_Context + BspSparcLeon3ValFatalShutdownResponse_Instance; + +static T_fixture BspSparcLeon3ValFatalShutdownResponse_Fixture = { + .setup = NULL, + .stop = NULL, + .teardown = NULL, + .scope = NULL, + .initial_context = &BspSparcLeon3ValFatalShutdownResponse_Instance +}; + +static void TriggerTestCase( void ) +{ + rtems_fatal( RTEMS_FATAL_SOURCE_APPLICATION, 123456 ); +} + +RTEMS_SYSINIT_ITEM( + TriggerTestCase, + RTEMS_SYSINIT_DEVICE_DRIVERS, + RTEMS_SYSINIT_ORDER_MIDDLE +); + +/** + * @brief Request an SMP shutdown on the second processor and wait for a power + * down of this processor. + */ +static void BspSparcLeon3ValFatalShutdownResponse_Action_0( + BspSparcLeon3ValFatalShutdownResponse_Context *ctx +) +{ + irqamp *regs; + uint32_t mpstat; + + regs = LEON3_IrqCtrl_Regs; + mpstat = grlib_load_32( ®s->mpstat ); + _SMP_Request_shutdown(); + + /* + * Check that the expected fatal source is present. + */ + T_step_eq_int( 0, ctx->source, RTEMS_FATAL_SOURCE_APPLICATION ); + + /* + * Check that the expected fatal code is present. + */ + T_step_eq_ulong( 1, ctx->code, 123456 ); + + /* + * Check that the second processor was not powered down before the shutdown + * request. + */ + T_step_eq_u32( 2, mpstat & 0x2U, 0 ); + + /* + * Wait until the second processor is powered down. + */ + while ( ( grlib_load_32( ®s->mpstat ) & 0x2U ) != 0x2U ) { + /* Wait */ + } +} + +void BspSparcLeon3ValFatalShutdownResponse_Run( + rtems_fatal_source source, + rtems_fatal_code code +) +{ + BspSparcLeon3ValFatalShutdownResponse_Context *ctx; + + ctx = &BspSparcLeon3ValFatalShutdownResponse_Instance; + ctx->source = source; + ctx->code = code; + + ctx = T_case_begin( + "BspSparcLeon3ValFatalShutdownResponse", + &BspSparcLeon3ValFatalShutdownResponse_Fixture + ); + + T_plan( 3 ); + + BspSparcLeon3ValFatalShutdownResponse_Action_0( ctx ); + + T_case_end(); +} + +/** @} */ diff --git a/testsuites/validation/tr-fatal-bsp-sparc-leon3-shutdown-response.h b/testsuites/validation/tr-fatal-bsp-sparc-leon3-shutdown-response.h new file mode 100644 index 0000000000..15e02131d3 --- /dev/null +++ b/testsuites/validation/tr-fatal-bsp-sparc-leon3-shutdown-response.h @@ -0,0 +1,84 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseBspSparcLeon3ValFatalShutdownResponse + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifndef _TR_FATAL_BSP_SPARC_LEON3_SHUTDOWN_RESPONSE_H +#define _TR_FATAL_BSP_SPARC_LEON3_SHUTDOWN_RESPONSE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup RTEMSTestCaseBspSparcLeon3ValFatalShutdownResponse + * + * @{ + */ + +/** + * @brief Runs the parameterized test case. + * + * @param source is fatal source. + * + * @param code is fatal code. + */ +void BspSparcLeon3ValFatalShutdownResponse_Run( + rtems_fatal_source source, + rtems_fatal_code code +); + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* _TR_FATAL_BSP_SPARC_LEON3_SHUTDOWN_RESPONSE_H */ diff --git a/testsuites/validation/tr-fatal-bsp-sparc-leon3-shutdown-timeout.c b/testsuites/validation/tr-fatal-bsp-sparc-leon3-shutdown-timeout.c new file mode 100644 index 0000000000..7493f14423 --- /dev/null +++ b/testsuites/validation/tr-fatal-bsp-sparc-leon3-shutdown-timeout.c @@ -0,0 +1,185 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseBspSparcLeon3ValFatalShutdownTimeout + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include "tr-fatal-bsp-sparc-leon3-shutdown-timeout.h" + +#include + +/** + * @defgroup RTEMSTestCaseBspSparcLeon3ValFatalShutdownTimeout \ + * spec:/bsp/sparc/leon3/val/fatal-shutdown-timeout + * + * @ingroup RTEMSTestSuiteTestsuitesFatalBspSparcLeon3ShutdownTimeout + * + * @brief Tests a fatal error. + * + * This test case performs the following actions: + * + * - Request the second processor to wait in an infinite loop with maskable + * interrupts disabled. The test suite will only finish execution if + * bsp_fatal_extension() halts the processor after a shutdown request + * timeout. + * + * - Check that the expected fatal source is present. + * + * - Check that the expected fatal code is present. + * + * @{ + */ + +/** + * @brief Test context for spec:/bsp/sparc/leon3/val/fatal-shutdown-timeout + * test case. + */ +typedef struct { + /** + * @brief This member contains a copy of the corresponding + * BspSparcLeon3ValFatalShutdownTimeout_Run() parameter. + */ + rtems_fatal_source source; + + /** + * @brief This member contains a copy of the corresponding + * BspSparcLeon3ValFatalShutdownTimeout_Run() parameter. + */ + rtems_fatal_code code; +} BspSparcLeon3ValFatalShutdownTimeout_Context; + +static BspSparcLeon3ValFatalShutdownTimeout_Context + BspSparcLeon3ValFatalShutdownTimeout_Instance; + +static T_fixture BspSparcLeon3ValFatalShutdownTimeout_Fixture = { + .setup = NULL, + .stop = NULL, + .teardown = NULL, + .scope = NULL, + .initial_context = &BspSparcLeon3ValFatalShutdownTimeout_Instance +}; + +static void IdleHandler( void *arg ) +{ + (void) arg; + (void) _CPU_Thread_Idle_body( 0 ); +} + +static const Per_CPU_Job_context idle_context = { + .handler = IdleHandler +}; + +static Per_CPU_Job idle_job = { + .context = &idle_context +}; + +static void TriggerTestCase( void ) +{ + rtems_fatal( RTEMS_FATAL_SOURCE_APPLICATION, 123456 ); +} + +RTEMS_SYSINIT_ITEM( + TriggerTestCase, + RTEMS_SYSINIT_DEVICE_DRIVERS, + RTEMS_SYSINIT_ORDER_MIDDLE +); + +/** + * @brief Request the second processor to wait in an infinite loop with + * maskable interrupts disabled. The test suite will only finish execution + * if bsp_fatal_extension() halts the processor after a shutdown request + * timeout. + */ +static void BspSparcLeon3ValFatalShutdownTimeout_Action_0( + BspSparcLeon3ValFatalShutdownTimeout_Context *ctx +) +{ + _Per_CPU_Submit_job( _Per_CPU_Get_by_index( 1 ), &idle_job ); + + /* + * Check that the expected fatal source is present. + */ + T_step_eq_int( 0, ctx->source, RTEMS_FATAL_SOURCE_APPLICATION ); + + /* + * Check that the expected fatal code is present. + */ + T_step_eq_ulong( 1, ctx->code, 123456 ); +} + +void BspSparcLeon3ValFatalShutdownTimeout_Run( + rtems_fatal_source source, + rtems_fatal_code code +) +{ + BspSparcLeon3ValFatalShutdownTimeout_Context *ctx; + + ctx = &BspSparcLeon3ValFatalShutdownTimeout_Instance; + ctx->source = source; + ctx->code = code; + + ctx = T_case_begin( + "BspSparcLeon3ValFatalShutdownTimeout", + &BspSparcLeon3ValFatalShutdownTimeout_Fixture + ); + + T_plan( 2 ); + + BspSparcLeon3ValFatalShutdownTimeout_Action_0( ctx ); + + T_case_end(); +} + +/** @} */ diff --git a/testsuites/validation/tr-fatal-bsp-sparc-leon3-shutdown-timeout.h b/testsuites/validation/tr-fatal-bsp-sparc-leon3-shutdown-timeout.h new file mode 100644 index 0000000000..536c3c5989 --- /dev/null +++ b/testsuites/validation/tr-fatal-bsp-sparc-leon3-shutdown-timeout.h @@ -0,0 +1,84 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseBspSparcLeon3ValFatalShutdownTimeout + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifndef _TR_FATAL_BSP_SPARC_LEON3_SHUTDOWN_TIMEOUT_H +#define _TR_FATAL_BSP_SPARC_LEON3_SHUTDOWN_TIMEOUT_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup RTEMSTestCaseBspSparcLeon3ValFatalShutdownTimeout + * + * @{ + */ + +/** + * @brief Runs the parameterized test case. + * + * @param source is fatal source. + * + * @param code is fatal code. + */ +void BspSparcLeon3ValFatalShutdownTimeout_Run( + rtems_fatal_source source, + rtems_fatal_code code +); + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* _TR_FATAL_BSP_SPARC_LEON3_SHUTDOWN_TIMEOUT_H */ diff --git a/testsuites/validation/tr-fatal-init-task-construct-failed.c b/testsuites/validation/tr-fatal-init-task-construct-failed.c new file mode 100644 index 0000000000..9e9b4c865b --- /dev/null +++ b/testsuites/validation/tr-fatal-init-task-construct-failed.c @@ -0,0 +1,158 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseAcfgValFatalInitTaskConstructFailed + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "tr-fatal-init-task-construct-failed.h" + +#include + +/** + * @defgroup RTEMSTestCaseAcfgValFatalInitTaskConstructFailed \ + * spec:/acfg/val/fatal-init-task-construct-failed + * + * @ingroup RTEMSTestSuiteTestsuitesFatalInitTaskConstructFailed + * + * @brief Tests a fatal error. + * + * This test case performs the following actions: + * + * - The test action is carried out by configuring an invalid task priority + * used to construct the initialization task. + * + * - Check that the expected fatal source is present. + * + * - Check that the expected fatal code is present. + * + * @{ + */ + +/** + * @brief Test context for spec:/acfg/val/fatal-init-task-construct-failed test + * case. + */ +typedef struct { + /** + * @brief This member contains a copy of the corresponding + * AcfgValFatalInitTaskConstructFailed_Run() parameter. + */ + rtems_fatal_source source; + + /** + * @brief This member contains a copy of the corresponding + * AcfgValFatalInitTaskConstructFailed_Run() parameter. + */ + rtems_fatal_code code; +} AcfgValFatalInitTaskConstructFailed_Context; + +static AcfgValFatalInitTaskConstructFailed_Context + AcfgValFatalInitTaskConstructFailed_Instance; + +static T_fixture AcfgValFatalInitTaskConstructFailed_Fixture = { + .setup = NULL, + .stop = NULL, + .teardown = NULL, + .scope = NULL, + .initial_context = &AcfgValFatalInitTaskConstructFailed_Instance +}; + +/** + * @brief The test action is carried out by configuring an invalid task + * priority used to construct the initialization task. + */ +static void AcfgValFatalInitTaskConstructFailed_Action_0( + AcfgValFatalInitTaskConstructFailed_Context *ctx +) +{ + /* Nothing to do */ + + /* + * Check that the expected fatal source is present. + */ + T_step_eq_int( 0, ctx->source, INTERNAL_ERROR_CORE ); + + /* + * Check that the expected fatal code is present. + */ + T_step_eq_ulong( + 1, + ctx->code, + INTERNAL_ERROR_RTEMS_INIT_TASK_CONSTRUCT_FAILED + ); +} + +void AcfgValFatalInitTaskConstructFailed_Run( + rtems_fatal_source source, + rtems_fatal_code code +) +{ + AcfgValFatalInitTaskConstructFailed_Context *ctx; + + ctx = &AcfgValFatalInitTaskConstructFailed_Instance; + ctx->source = source; + ctx->code = code; + + ctx = T_case_begin( + "AcfgValFatalInitTaskConstructFailed", + &AcfgValFatalInitTaskConstructFailed_Fixture + ); + + T_plan( 2 ); + + AcfgValFatalInitTaskConstructFailed_Action_0( ctx ); + + T_case_end(); +} + +/** @} */ diff --git a/testsuites/validation/tr-fatal-init-task-construct-failed.h b/testsuites/validation/tr-fatal-init-task-construct-failed.h new file mode 100644 index 0000000000..1685ed567f --- /dev/null +++ b/testsuites/validation/tr-fatal-init-task-construct-failed.h @@ -0,0 +1,84 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseAcfgValFatalInitTaskConstructFailed + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifndef _TR_FATAL_INIT_TASK_CONSTRUCT_FAILED_H +#define _TR_FATAL_INIT_TASK_CONSTRUCT_FAILED_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup RTEMSTestCaseAcfgValFatalInitTaskConstructFailed + * + * @{ + */ + +/** + * @brief Runs the parameterized test case. + * + * @param source is fatal source. + * + * @param code is fatal code. + */ +void AcfgValFatalInitTaskConstructFailed_Run( + rtems_fatal_source source, + rtems_fatal_code code +); + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* _TR_FATAL_INIT_TASK_CONSTRUCT_FAILED_H */ diff --git a/testsuites/validation/tr-fatal-too-large-tls-size.c b/testsuites/validation/tr-fatal-too-large-tls-size.c new file mode 100644 index 0000000000..87d8336b88 --- /dev/null +++ b/testsuites/validation/tr-fatal-too-large-tls-size.c @@ -0,0 +1,168 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseAcfgValFatalTooLargeTlsSize + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "tr-fatal-too-large-tls-size.h" + +#include + +/** + * @defgroup RTEMSTestCaseAcfgValFatalTooLargeTlsSize \ + * spec:/acfg/val/fatal-too-large-tls-size + * + * @ingroup RTEMSTestSuiteTestsuitesFatalTooLargeTlsSize + * + * @brief Tests a fatal error. + * + * This test case performs the following actions: + * + * - The test action is carried out by providing a thread-local storage object + * of sufficient size with respect to the application configuration of the + * test suite. + * + * - Check that the expected fatal source is present. + * + * - Check that the expected fatal code is present. + * + * @{ + */ + +/** + * @brief Test context for spec:/acfg/val/fatal-too-large-tls-size test case. + */ +typedef struct { + /** + * @brief This member contains a copy of the corresponding + * AcfgValFatalTooLargeTlsSize_Run() parameter. + */ + rtems_fatal_source source; + + /** + * @brief This member contains a copy of the corresponding + * AcfgValFatalTooLargeTlsSize_Run() parameter. + */ + rtems_fatal_code code; +} AcfgValFatalTooLargeTlsSize_Context; + +static AcfgValFatalTooLargeTlsSize_Context + AcfgValFatalTooLargeTlsSize_Instance; + +static T_fixture AcfgValFatalTooLargeTlsSize_Fixture = { + .setup = NULL, + .stop = NULL, + .teardown = NULL, + .scope = NULL, + .initial_context = &AcfgValFatalTooLargeTlsSize_Instance +}; + +static volatile _Thread_local uint8_t large_tls_object[ RTEMS_TASK_STORAGE_ALIGNMENT + 1 ]; + +static volatile bool shall_not_load_the_value; + +/** + * @brief The test action is carried out by providing a thread-local storage + * object of sufficient size with respect to the application configuration of + * the test suite. + */ +static void AcfgValFatalTooLargeTlsSize_Action_0( + AcfgValFatalTooLargeTlsSize_Context *ctx +) +{ + if ( shall_not_load_the_value ) { + uint8_t value; + + value = large_tls_object[ 0 ]; + RTEMS_OBFUSCATE_VARIABLE( value ); + } + + /* + * Check that the expected fatal source is present. + */ + T_step_eq_int( 0, ctx->source, INTERNAL_ERROR_CORE ); + + /* + * Check that the expected fatal code is present. + */ + T_step_eq_ulong( + 1, + ctx->code, + INTERNAL_ERROR_TOO_LARGE_TLS_SIZE + ); +} + +void AcfgValFatalTooLargeTlsSize_Run( + rtems_fatal_source source, + rtems_fatal_code code +) +{ + AcfgValFatalTooLargeTlsSize_Context *ctx; + + ctx = &AcfgValFatalTooLargeTlsSize_Instance; + ctx->source = source; + ctx->code = code; + + ctx = T_case_begin( + "AcfgValFatalTooLargeTlsSize", + &AcfgValFatalTooLargeTlsSize_Fixture + ); + + T_plan( 2 ); + + AcfgValFatalTooLargeTlsSize_Action_0( ctx ); + + T_case_end(); +} + +/** @} */ diff --git a/testsuites/validation/tr-fatal-too-large-tls-size.h b/testsuites/validation/tr-fatal-too-large-tls-size.h new file mode 100644 index 0000000000..1b5c24e469 --- /dev/null +++ b/testsuites/validation/tr-fatal-too-large-tls-size.h @@ -0,0 +1,84 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseAcfgValFatalTooLargeTlsSize + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifndef _TR_FATAL_TOO_LARGE_TLS_SIZE_H +#define _TR_FATAL_TOO_LARGE_TLS_SIZE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup RTEMSTestCaseAcfgValFatalTooLargeTlsSize + * + * @{ + */ + +/** + * @brief Runs the parameterized test case. + * + * @param source is fatal source. + * + * @param code is fatal code. + */ +void AcfgValFatalTooLargeTlsSize_Run( + rtems_fatal_source source, + rtems_fatal_code code +); + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* _TR_FATAL_TOO_LARGE_TLS_SIZE_H */ diff --git a/testsuites/validation/ts-fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.c b/testsuites/validation/ts-fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.c new file mode 100644 index 0000000000..082f0efeb7 --- /dev/null +++ b/testsuites/validation/ts-fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.c @@ -0,0 +1,79 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestSuiteTestsuitesFatalBspSparcLeon3CacheSnoopingDisabledBoot + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-boot.h" + +#include + +/** + * @defgroup RTEMSTestSuiteTestsuitesFatalBspSparcLeon3CacheSnoopingDisabledBoot \ + * spec:/testsuites/fatal-bsp-sparc-leon3-cache-snooping-disabled-boot + * + * @ingroup RTEMSTestSuites + * + * @brief This validation test suite contains a test case which triggers a + * fatal error during system initialization. + * + * @{ + */ + +const char rtems_test_name[] = "FatalBspSparcLeon3CacheSnoopingDisabledBoot"; + +#define FATAL_SYSINIT_RUN BspSparcLeon3ValFatalCacheSnoopingDisabledBoot_Run + +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER + +#include "ts-fatal-sysinit.h" + +/** @} */ diff --git a/testsuites/validation/ts-fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.c b/testsuites/validation/ts-fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.c new file mode 100644 index 0000000000..8037a2529b --- /dev/null +++ b/testsuites/validation/ts-fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.c @@ -0,0 +1,82 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestSuiteTestsuitesFatalBspSparcLeon3CacheSnoopingDisabledSecondary + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "tr-fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary.h" + +#include + +/** + * @defgroup RTEMSTestSuiteTestsuitesFatalBspSparcLeon3CacheSnoopingDisabledSecondary \ + * spec:/testsuites/fatal-bsp-sparc-leon3-cache-snooping-disabled-secondary + * + * @ingroup RTEMSTestSuites + * + * @brief This validation test suite contains a test case which triggers a + * fatal error during system initialization. + * + * @{ + */ + +const char rtems_test_name[] = "FatalBspSparcLeon3CacheSnoopingDisabledSecondary"; + +#define FATAL_SYSINIT_RUN \ + BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary_Run + +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_PROCESSORS 2 + +#include "ts-fatal-sysinit.h" + +/** @} */ diff --git a/testsuites/validation/ts-fatal-bsp-sparc-leon3-clock-initialization.c b/testsuites/validation/ts-fatal-bsp-sparc-leon3-clock-initialization.c new file mode 100644 index 0000000000..e9dfcddb59 --- /dev/null +++ b/testsuites/validation/ts-fatal-bsp-sparc-leon3-clock-initialization.c @@ -0,0 +1,79 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestSuiteTestsuitesFatalBspSparcLeon3ClockInitialization + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "tr-fatal-bsp-sparc-leon3-clock-initialization.h" + +#include + +/** + * @defgroup RTEMSTestSuiteTestsuitesFatalBspSparcLeon3ClockInitialization \ + * spec:/testsuites/fatal-bsp-sparc-leon3-clock-initialization + * + * @ingroup RTEMSTestSuites + * + * @brief This validation test suite contains a test case which triggers a + * fatal error during system initialization. + * + * @{ + */ + +const char rtems_test_name[] = "FatalBspSparcLeon3ClockInitialization"; + +#define FATAL_SYSINIT_RUN BspSparcLeon3ValFatalClockInitialization_Run + +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#include "ts-fatal-sysinit.h" + +/** @} */ diff --git a/testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-nop.c b/testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-nop.c new file mode 100644 index 0000000000..afe66d92d5 --- /dev/null +++ b/testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-nop.c @@ -0,0 +1,114 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestSuiteTestsuitesFatalBspSparcLeon3ShutdownNop + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "ts-config.h" + +#include + +/** + * @defgroup RTEMSTestSuiteTestsuitesFatalBspSparcLeon3ShutdownNop \ + * spec:/testsuites/fatal-bsp-sparc-leon3-shutdown-nop + * + * @ingroup RTEMSTestSuites + * + * @brief This validation test suite provides an application configuration to + * perform a shutdown with present but not configured processors and a + * processor which is configured but not present. It contains no test cases. + * + * @{ + */ + +const char rtems_test_name[] = "FatalBspSparcLeon3ShutdownNop"; + +static void FinishTestSuite( void ) +{ + rtems_fatal( RTEMS_FATAL_SOURCE_APPLICATION, 123456 ); +} + +RTEMS_SYSINIT_ITEM( + FinishTestSuite, + RTEMS_SYSINIT_DEVICE_DRIVERS, + RTEMS_SYSINIT_ORDER_MIDDLE +); + +#define FATAL_SYSINIT_RUN( source, code ) do { } while ( 0 ) + +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_PROCESSORS 5 + +#include + +#define CONFIGURE_SCHEDULER_EDF_SMP + +#include + +RTEMS_SCHEDULER_EDF_SMP( a ); + +#define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ + RTEMS_SCHEDULER_TABLE_EDF_SMP( a, TEST_SCHEDULER_A_NAME ) + +#define CONFIGURE_SCHEDULER_ASSIGNMENTS \ + RTEMS_SCHEDULER_ASSIGN( 0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY ), \ + RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \ + RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \ + RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER, \ + RTEMS_SCHEDULER_ASSIGN( 0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL ) + +#include "ts-fatal-sysinit.h" + +/** @} */ diff --git a/testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-response.c b/testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-response.c new file mode 100644 index 0000000000..c31aef5a7f --- /dev/null +++ b/testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-response.c @@ -0,0 +1,81 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestSuiteTestsuitesFatalBspSparcLeon3ShutdownResponse + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "tr-fatal-bsp-sparc-leon3-shutdown-response.h" + +#include + +/** + * @defgroup RTEMSTestSuiteTestsuitesFatalBspSparcLeon3ShutdownResponse \ + * spec:/testsuites/fatal-bsp-sparc-leon3-shutdown-response + * + * @ingroup RTEMSTestSuites + * + * @brief This validation test suite contains a test case which performs a + * system shutdown. + * + * @{ + */ + +const char rtems_test_name[] = "FatalBspSparcLeon3ShutdownResponse"; + +#define FATAL_SYSINIT_RUN BspSparcLeon3ValFatalShutdownResponse_Run + +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_PROCESSORS 2 + +#include "ts-fatal-sysinit.h" + +/** @} */ diff --git a/testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-timeout.c b/testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-timeout.c new file mode 100644 index 0000000000..20be30a0db --- /dev/null +++ b/testsuites/validation/ts-fatal-bsp-sparc-leon3-shutdown-timeout.c @@ -0,0 +1,81 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestSuiteTestsuitesFatalBspSparcLeon3ShutdownTimeout + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "tr-fatal-bsp-sparc-leon3-shutdown-timeout.h" + +#include + +/** + * @defgroup RTEMSTestSuiteTestsuitesFatalBspSparcLeon3ShutdownTimeout \ + * spec:/testsuites/fatal-bsp-sparc-leon3-shutdown-timeout + * + * @ingroup RTEMSTestSuites + * + * @brief This validation test suite contains a test case which performs a + * system shutdown. + * + * @{ + */ + +const char rtems_test_name[] = "FatalBspSparcLeon3ShutdownTimeout"; + +#define FATAL_SYSINIT_RUN BspSparcLeon3ValFatalShutdownTimeout_Run + +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_PROCESSORS 2 + +#include "ts-fatal-sysinit.h" + +/** @} */ diff --git a/testsuites/validation/ts-fatal-init-task-construct-failed.c b/testsuites/validation/ts-fatal-init-task-construct-failed.c new file mode 100644 index 0000000000..8efd2b32ce --- /dev/null +++ b/testsuites/validation/ts-fatal-init-task-construct-failed.c @@ -0,0 +1,95 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestSuiteTestsuitesFatalInitTaskConstructFailed + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "tr-fatal-init-task-construct-failed.h" + +#include + +/** + * @defgroup RTEMSTestSuiteTestsuitesFatalInitTaskConstructFailed \ + * spec:/testsuites/fatal-init-task-construct-failed + * + * @ingroup RTEMSTestSuites + * + * @brief This validation test suite contains a test case which triggers a + * fatal error during system initialization. + * + * @{ + */ + +const char rtems_test_name[] = "FatalInitTaskConstructFailed"; + +#define FATAL_SYSINIT_RUN AcfgValFatalInitTaskConstructFailed_Run + +static void Init( rtems_task_argument arg ) +{ + (void) arg; + rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, 1 ); +} + +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 1 + +#define CONFIGURE_MINIMUM_TASKS_WITH_USER_PROVIDED_STORAGE 1 + +#define CONFIGURE_INIT_TASK_PRIORITY 0 + +#define CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE RTEMS_MINIMUM_STACK_SIZE + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#include "ts-fatal-sysinit.h" + +/** @} */ diff --git a/testsuites/validation/ts-fatal-sysinit.h b/testsuites/validation/ts-fatal-sysinit.h new file mode 100644 index 0000000000..3b2b278e07 --- /dev/null +++ b/testsuites/validation/ts-fatal-sysinit.h @@ -0,0 +1,132 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @brief This header file provides a configurable validation test suite runner + * and application configuration for fatal error tests which occur during + * system initialization. + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include + +#include + +static char buffer[ 512 ]; + +static const T_action actions[] = { + T_report_hash_sha256 +}; + +static const T_config test_config = { + .name = rtems_test_name, + .buf = buffer, + .buf_size = sizeof( buffer ), + .putchar = rtems_put_char, + .verbosity = RTEMS_TEST_VERBOSITY, + .now = T_now_clock, + .allocate = T_memory_allocate, + .deallocate = T_memory_deallocate, + .action_count = T_ARRAY_SIZE( actions ), + .actions = actions +}; + +static Atomic_Uint counter; + +static void FatalExtension( + rtems_fatal_source source, + bool always_set_to_false, + rtems_fatal_code code +) +{ + uint32_t exit_code; + + (void) always_set_to_false; + + if ( source == RTEMS_FATAL_SOURCE_EXIT ) { + return; + } + + if ( _Atomic_Fetch_add_uint( &counter, 1, ATOMIC_ORDER_RELAXED ) != 0 ) { + return; + } + + T_make_runner(); + FATAL_SYSINIT_RUN( source, code ); + + if ( T_run_finalize() ) { + rtems_test_end( rtems_test_name ); + exit_code = 0; + } else { + exit_code = 1; + } + + rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, exit_code ); +} + +static void TestRunInitialize( void ) +{ + rtems_test_begin( rtems_test_name, TEST_STATE ); + T_run_initialize( &test_config ); +} + +RTEMS_SYSINIT_ITEM( + TestRunInitialize, + RTEMS_SYSINIT_BSP_EARLY, + RTEMS_SYSINIT_ORDER_FIRST +); + +#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 0 + +#define CONFIGURE_DISABLE_NEWLIB_REENTRANCY + +#define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM + +#define CONFIGURE_INITIAL_EXTENSIONS { .fatal = FatalExtension } + +#if !defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) +#define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION + +static void *IdleBody( uintptr_t ignored ) +{ + (void) ignored; + + rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, 1 ); +} + +#define CONFIGURE_IDLE_TASK_BODY IdleBody +#endif + +#define CONFIGURE_INIT + +#include diff --git a/testsuites/validation/ts-fatal-too-large-tls-size.c b/testsuites/validation/ts-fatal-too-large-tls-size.c new file mode 100644 index 0000000000..ba41390680 --- /dev/null +++ b/testsuites/validation/ts-fatal-too-large-tls-size.c @@ -0,0 +1,82 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestSuiteTestsuitesFatalTooLargeTlsSize + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "tr-fatal-too-large-tls-size.h" + +#include + +/** + * @defgroup RTEMSTestSuiteTestsuitesFatalTooLargeTlsSize \ + * spec:/testsuites/fatal-too-large-tls-size + * + * @ingroup RTEMSTestSuites + * + * @brief This validation test suite contains a test case which triggers a + * fatal error during system initialization. + * + * @{ + */ + +const char rtems_test_name[] = "FatalTooLargeTlsSize"; + +#define FATAL_SYSINIT_RUN AcfgValFatalTooLargeTlsSize_Run + +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE \ + RTEMS_TASK_STORAGE_ALIGNMENT + +#include "ts-fatal-sysinit.h" + +/** @} */ -- cgit v1.2.3