diff options
Diffstat (limited to 'testsuites/validation/bsps')
18 files changed, 2172 insertions, 0 deletions
diff --git a/testsuites/validation/bsps/tc-fatal-sparc-leon3-shutdown-halt.c b/testsuites/validation/bsps/tc-fatal-sparc-leon3-shutdown-halt.c new file mode 100644 index 0000000000..0b0b5cf5b7 --- /dev/null +++ b/testsuites/validation/bsps/tc-fatal-sparc-leon3-shutdown-halt.c @@ -0,0 +1,142 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup BspSparcLeon3ValFatalShutdownHalt + */ + +/* + * Copyright (C) 2021, 2022 embedded brains GmbH & Co. KG + * + * 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 <rtems/sysinit.h> + +#include "tx-support.h" + +#include <rtems/test.h> + +/** + * @defgroup BspSparcLeon3ValFatalShutdownHalt \ + * spec:/bsp/sparc/leon3/val/fatal-shutdown-halt + * + * @ingroup TestsuitesBspsFatalSparcLeon3Shutdown + * + * @brief Tests the leon3 BSP family shutdown procedure. + * + * This test case performs the following actions: + * + * - Check the effects of the leon3 BSP family shutdown procedure. + * + * - Check that no dynamic fatal error extension was invoked. This shows + * that the leon3 BSP family shutdown procedure called the wrapped + * _CPU_Fatal_halt() function of the test suite. + * + * @{ + */ + +static Atomic_Uint dynamic_fatal_extension_counter; + +static rtems_status_code status; + +static unsigned int Add( Atomic_Uint *a, unsigned int b ) +{ + return _Atomic_Fetch_add_uint( a, b, ATOMIC_ORDER_RELAXED ); +} + +static void DynamicFatalHandler( + rtems_fatal_source source, + bool always_set_to_false, + rtems_fatal_code code +) +{ + (void) source; + (void) code; + (void) always_set_to_false; + (void) Add( &dynamic_fatal_extension_counter, 1 ); +} + +static void InitBspSparcLeon3ValFatalShutdownHalt( void ) +{ + rtems_extensions_table table = { .fatal = DynamicFatalHandler }; + rtems_id id; + + status = rtems_extension_create( OBJECT_NAME, &table, &id ); +} + +RTEMS_SYSINIT_ITEM( + InitBspSparcLeon3ValFatalShutdownHalt, + RTEMS_SYSINIT_DEVICE_DRIVERS, + RTEMS_SYSINIT_ORDER_MIDDLE +); + +/** + * @brief Check the effects of the leon3 BSP family shutdown procedure. + */ +static void BspSparcLeon3ValFatalShutdownHalt_Action_0( void ) +{ + uint32_t counter; + + /* + * Check that no dynamic fatal error extension was invoked. This shows that + * the leon3 BSP family shutdown procedure called the wrapped + * _CPU_Fatal_halt() function of the test suite. + */ + T_step_rsc_success( 0, status ); + counter = Add( &dynamic_fatal_extension_counter, 0 ); + T_step_eq_u32( 1, counter, 0 ); +} + +/** + * @fn void T_case_body_BspSparcLeon3ValFatalShutdownHalt( void ) + */ +T_TEST_CASE( BspSparcLeon3ValFatalShutdownHalt ) +{ + T_plan( 2 ); + + BspSparcLeon3ValFatalShutdownHalt_Action_0(); +} + +/** @} */ diff --git a/testsuites/validation/bsps/tc-fatal-sparc-leon3-shutdown-request.c b/testsuites/validation/bsps/tc-fatal-sparc-leon3-shutdown-request.c new file mode 100644 index 0000000000..46bc44e7cb --- /dev/null +++ b/testsuites/validation/bsps/tc-fatal-sparc-leon3-shutdown-request.c @@ -0,0 +1,179 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup BspSparcLeon3ValFatalShutdownRequest + */ + +/* + * Copyright (C) 2021, 2022 embedded brains GmbH & Co. KG + * + * 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 <bsp/leon3.h> +#include <rtems/sysinit.h> +#include <rtems/score/smpimpl.h> + +#include "tx-support.h" + +#include <rtems/test.h> + +/** + * @defgroup BspSparcLeon3ValFatalShutdownRequest \ + * spec:/bsp/sparc/leon3/val/fatal-shutdown-request + * + * @ingroup TestsuitesBspsFatalSparcLeon3Shutdown + * + * @brief Tests the leon3 BSP family SMP-specific shutdown procedure. + * + * This test case performs the following actions: + * + * - Check the effects of the leon3 BSP family shutdown procedure. + * + * - Check that the second processor was not powered down during system + * initialization. + * + * - Wait until the second processor is powered down. + * + * - Check that the RTEMS_FATAL_SOURCE_SMP with SMP_FATAL_SHUTDOWN_RESPONSE + * fatal error occurred exactly once. + * + * - Check that the RTEMS_FATAL_SOURCE_SMP with SMP_FATAL_SHUTDOWN_RESPONSE + * fatal error occurred on the second processor. + * + * @{ + */ + +static uint32_t mpstat_during_sysinit; + +static Atomic_Uint shutdown_response_counter; + +static uint32_t shutdown_response_cpu_index = UINT32_MAX; + +static unsigned int Add( Atomic_Uint *a, unsigned int b ) +{ + return _Atomic_Fetch_add_uint( a, b, ATOMIC_ORDER_RELAXED ); +} + +static void ShutdownFatalHandler( + rtems_fatal_source source, + rtems_fatal_code code, + void *arg +) +{ + T_null( arg ); + + if ( + source == RTEMS_FATAL_SOURCE_SMP && + code == SMP_FATAL_SHUTDOWN_RESPONSE + ) { + (void) Add( &shutdown_response_counter, 1 ); + shutdown_response_cpu_index = rtems_scheduler_get_processor(); + } +} + +static void InitBspSparcLeon3ValFatalShutdownRequest( void ) +{ + irqamp *regs; + + regs = LEON3_IrqCtrl_Regs; + mpstat_during_sysinit = grlib_load_32( ®s->mpstat ); + SetFatalHandler( ShutdownFatalHandler, NULL ); +} + +RTEMS_SYSINIT_ITEM( + InitBspSparcLeon3ValFatalShutdownRequest, + RTEMS_SYSINIT_DEVICE_DRIVERS, + RTEMS_SYSINIT_ORDER_MIDDLE +); + +/** + * @brief Check the effects of the leon3 BSP family shutdown procedure. + */ +static void BspSparcLeon3ValFatalShutdownRequest_Action_0( void ) +{ + irqamp *regs; + uint32_t counter; + + regs = LEON3_IrqCtrl_Regs; + + /* + * Check that the second processor was not powered down during system + * initialization. + */ + T_step_eq_u32( 0, mpstat_during_sysinit & 0x2, 0 ); + + /* + * Wait until the second processor is powered down. + */ + while ( ( grlib_load_32( ®s->mpstat ) & 0x2 ) != 0x2U ) { + /* Wait */ + } + + /* + * Check that the RTEMS_FATAL_SOURCE_SMP with SMP_FATAL_SHUTDOWN_RESPONSE + * fatal error occurred exactly once. + */ + counter = Add( &shutdown_response_counter, 0 ); + T_step_eq_uint( 1, counter, 1 ); + + /* + * Check that the RTEMS_FATAL_SOURCE_SMP with SMP_FATAL_SHUTDOWN_RESPONSE + * fatal error occurred on the second processor. + */ + T_step_eq_u32( 2, shutdown_response_cpu_index, 1 ); +} + +/** + * @fn void T_case_body_BspSparcLeon3ValFatalShutdownRequest( void ) + */ +T_TEST_CASE( BspSparcLeon3ValFatalShutdownRequest ) +{ + T_plan( 3 ); + + BspSparcLeon3ValFatalShutdownRequest_Action_0(); +} + +/** @} */ diff --git a/testsuites/validation/bsps/tc-sparc-gr712rc.c b/testsuites/validation/bsps/tc-sparc-gr712rc.c new file mode 100644 index 0000000000..a16de3d6ed --- /dev/null +++ b/testsuites/validation/bsps/tc-sparc-gr712rc.c @@ -0,0 +1,124 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup BspSparcLeon3ValGr712rc + */ + +/* + * Copyright (C) 2021 embedded brains GmbH & Co. KG + * + * 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 <bsp.h> + +#include "tx-support.h" + +#include <rtems/test.h> + +/** + * @defgroup BspSparcLeon3ValGr712rc spec:/bsp/sparc/leon3/val/gr712rc + * + * @ingroup TestsuitesBspsValidationBsp0 + * + * @brief This test case collection provides validation test cases for the + * ``sparc/gr712rc`` BSP. + * + * This test case performs the following actions: + * + * - Validate the use of the ``-mfix-gr712rc`` compiler option. + * + * - Check that the compiler built-in define ``__FIX_LEON3FT_B2BST`` is + * defined. + * + * - Check that the compiler built-in define ``__FIX_LEON3FT_TN0018`` is + * defined. + * + * - Check that the ``SPARC_LEON3FT_B2BST_NOP`` define expands to a ``nop`` + * instruction. + * + * @{ + */ + +/** + * @brief Validate the use of the ``-mfix-gr712rc`` compiler option. + */ +static void BspSparcLeon3ValGr712rc_Action_0( void ) +{ + const char *s; + + /* + * Check that the compiler built-in define ``__FIX_LEON3FT_B2BST`` is + * defined. + */ + #if !defined(__FIX_LEON3FT_B2BST) + #error "__FIX_LEON3FT_B2BST is not defined" + #endif + + /* + * Check that the compiler built-in define ``__FIX_LEON3FT_TN0018`` is + * defined. + */ + #if !defined(__FIX_LEON3FT_TN0018) + #error "__FIX_LEON3FT_TN0018 is not defined" + #endif + + /* + * Check that the ``SPARC_LEON3FT_B2BST_NOP`` define expands to a ``nop`` + * instruction. + */ + s = RTEMS_XSTRING( SPARC_LEON3FT_B2BST_NOP ); + T_true( IsEqualIgnoreWhiteSpace( s, "nop" ) ); +} + +/** + * @fn void T_case_body_BspSparcLeon3ValGr712rc( void ) + */ +T_TEST_CASE( BspSparcLeon3ValGr712rc ) +{ + BspSparcLeon3ValGr712rc_Action_0(); +} + +/** @} */ diff --git a/testsuites/validation/bsps/tr-fatal-clock-xil-ttc-irq-install.c b/testsuites/validation/bsps/tr-fatal-clock-xil-ttc-irq-install.c new file mode 100644 index 0000000000..731b454ee4 --- /dev/null +++ b/testsuites/validation/bsps/tr-fatal-clock-xil-ttc-irq-install.c @@ -0,0 +1,187 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup DevClockXilTtcValFatalIrqInstall + */ + +/* + * Copyright (C) 2024 embedded brains GmbH & Co. KG + * + * 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 <bsp.h> +#include <rtems.h> +#include <bsp/fatal.h> +#include <rtems/sysinit.h> + +#include "tr-fatal-clock-xil-ttc-irq-install.h" + +#include <rtems/test.h> + +/** + * @defgroup DevClockXilTtcValFatalIrqInstall \ + * spec:/dev/clock/xil-ttc/val/fatal-irq-install + * + * @ingroup TestsuitesBspsFatalClockXilTtcIrqInstall + * + * @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:/dev/clock/xil-ttc/val/fatal-irq-install test + * case. + */ +typedef struct { + /** + * @brief This member contains a copy of the corresponding + * DevClockXilTtcValFatalIrqInstall_Run() parameter. + */ + rtems_fatal_source source; + + /** + * @brief This member contains a copy of the corresponding + * DevClockXilTtcValFatalIrqInstall_Run() parameter. + */ + rtems_fatal_code code; +} DevClockXilTtcValFatalIrqInstall_Context; + +static DevClockXilTtcValFatalIrqInstall_Context + DevClockXilTtcValFatalIrqInstall_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 ) +{ + (void) rtems_interrupt_entry_install( + XIL_CLOCK_TTC_IRQ, + RTEMS_INTERRUPT_UNIQUE, + &interrupt_entry + ); +} + +RTEMS_SYSINIT_ITEM( + OccupyClockInterrupt, + RTEMS_SYSINIT_DEVICE_DRIVERS, + RTEMS_SYSINIT_ORDER_FIRST +); + +static T_fixture DevClockXilTtcValFatalIrqInstall_Fixture = { + .setup = NULL, + .stop = NULL, + .teardown = NULL, + .scope = NULL, + .initial_context = &DevClockXilTtcValFatalIrqInstall_Instance +}; + +/** + * @brief The test action is carried out by the OccupyClockInterrupt() system + * initialization handler. + */ +static void DevClockXilTtcValFatalIrqInstall_Action_0( + DevClockXilTtcValFatalIrqInstall_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, + XIL_FATAL_TTC_IRQ_INSTALL + ); +} + +void DevClockXilTtcValFatalIrqInstall_Run( + rtems_fatal_source source, + rtems_fatal_code code +) +{ + DevClockXilTtcValFatalIrqInstall_Context *ctx; + + ctx = &DevClockXilTtcValFatalIrqInstall_Instance; + ctx->source = source; + ctx->code = code; + + ctx = T_case_begin( + "DevClockXilTtcValFatalIrqInstall", + &DevClockXilTtcValFatalIrqInstall_Fixture + ); + + T_plan( 2 ); + + DevClockXilTtcValFatalIrqInstall_Action_0( ctx ); + + T_case_end(); +} + +/** @} */ diff --git a/testsuites/validation/bsps/tr-fatal-clock-xil-ttc-irq-install.h b/testsuites/validation/bsps/tr-fatal-clock-xil-ttc-irq-install.h new file mode 100644 index 0000000000..74021233a0 --- /dev/null +++ b/testsuites/validation/bsps/tr-fatal-clock-xil-ttc-irq-install.h @@ -0,0 +1,84 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup DevClockXilTtcValFatalIrqInstall + */ + +/* + * Copyright (C) 2024 embedded brains GmbH & Co. KG + * + * 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_CLOCK_XIL_TTC_IRQ_INSTALL_H +#define _TR_FATAL_CLOCK_XIL_TTC_IRQ_INSTALL_H + +#include <rtems.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup DevClockXilTtcValFatalIrqInstall + * + * @{ + */ + +/** + * @brief Runs the parameterized test case. + * + * @param source is fatal source. + * + * @param code is fatal code. + */ +void DevClockXilTtcValFatalIrqInstall_Run( + rtems_fatal_source source, + rtems_fatal_code code +); + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* _TR_FATAL_CLOCK_XIL_TTC_IRQ_INSTALL_H */ diff --git a/testsuites/validation/bsps/tr-fatal-sparc-leon3-cache-snooping-disabled-boot.c b/testsuites/validation/bsps/tr-fatal-sparc-leon3-cache-snooping-disabled-boot.c new file mode 100644 index 0000000000..748fd88e70 --- /dev/null +++ b/testsuites/validation/bsps/tr-fatal-sparc-leon3-cache-snooping-disabled-boot.c @@ -0,0 +1,175 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup BspSparcLeon3ValFatalCacheSnoopingDisabledBoot + */ + +/* + * Copyright (C) 2021 embedded brains GmbH & Co. KG + * + * 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 <bsp/fatal.h> +#include <bsp/leon3.h> +#include <rtems/sysinit.h> + +#include "tr-fatal-sparc-leon3-cache-snooping-disabled-boot.h" + +#include <rtems/test.h> + +/** + * @defgroup BspSparcLeon3ValFatalCacheSnoopingDisabledBoot \ + * spec:/bsp/sparc/leon3/val/fatal-cache-snooping-disabled-boot + * + * @ingroup TestsuitesBspsFatalSparcLeon3CacheSnoopingDisabledBoot + * + * @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 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 +); + +static T_fixture BspSparcLeon3ValFatalCacheSnoopingDisabledBoot_Fixture = { + .setup = NULL, + .stop = NULL, + .teardown = NULL, + .scope = NULL, + .initial_context = &BspSparcLeon3ValFatalCacheSnoopingDisabledBoot_Instance +}; + +/** + * @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/bsps/tr-fatal-sparc-leon3-cache-snooping-disabled-boot.h b/testsuites/validation/bsps/tr-fatal-sparc-leon3-cache-snooping-disabled-boot.h new file mode 100644 index 0000000000..e375e6baac --- /dev/null +++ b/testsuites/validation/bsps/tr-fatal-sparc-leon3-cache-snooping-disabled-boot.h @@ -0,0 +1,84 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup BspSparcLeon3ValFatalCacheSnoopingDisabledBoot + */ + +/* + * Copyright (C) 2021 embedded brains GmbH & Co. KG + * + * 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_SPARC_LEON3_CACHE_SNOOPING_DISABLED_BOOT_H +#define _TR_FATAL_SPARC_LEON3_CACHE_SNOOPING_DISABLED_BOOT_H + +#include <rtems.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup BspSparcLeon3ValFatalCacheSnoopingDisabledBoot + * + * @{ + */ + +/** + * @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_SPARC_LEON3_CACHE_SNOOPING_DISABLED_BOOT_H */ diff --git a/testsuites/validation/bsps/tr-fatal-sparc-leon3-cache-snooping-disabled-secondary.c b/testsuites/validation/bsps/tr-fatal-sparc-leon3-cache-snooping-disabled-secondary.c new file mode 100644 index 0000000000..4d90abf42d --- /dev/null +++ b/testsuites/validation/bsps/tr-fatal-sparc-leon3-cache-snooping-disabled-secondary.c @@ -0,0 +1,176 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary + */ + +/* + * Copyright (C) 2021 embedded brains GmbH & Co. KG + * + * 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 <bsp/bootcard.h> +#include <bsp/fatal.h> +#include <bsp/leon3.h> + +#include "tr-fatal-sparc-leon3-cache-snooping-disabled-secondary.h" + +#include <rtems/test.h> + +/** + * @defgroup BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary \ + * spec:/bsp/sparc/leon3/val/fatal-cache-snooping-disabled-secondary + * + * @ingroup TestsuitesBspsFatalSparcLeon3CacheSnoopingDisabledSecondary + * + * @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; + +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 ); +} + +static T_fixture BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary_Fixture = { + .setup = NULL, + .stop = NULL, + .teardown = NULL, + .scope = NULL, + .initial_context = &BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary_Instance +}; + +/** + * @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/bsps/tr-fatal-sparc-leon3-cache-snooping-disabled-secondary.h b/testsuites/validation/bsps/tr-fatal-sparc-leon3-cache-snooping-disabled-secondary.h new file mode 100644 index 0000000000..0782942222 --- /dev/null +++ b/testsuites/validation/bsps/tr-fatal-sparc-leon3-cache-snooping-disabled-secondary.h @@ -0,0 +1,84 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary + */ + +/* + * Copyright (C) 2021 embedded brains GmbH & Co. KG + * + * 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_SPARC_LEON3_CACHE_SNOOPING_DISABLED_SECONDARY_H +#define _TR_FATAL_SPARC_LEON3_CACHE_SNOOPING_DISABLED_SECONDARY_H + +#include <rtems.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup BspSparcLeon3ValFatalCacheSnoopingDisabledSecondary + * + * @{ + */ + +/** + * @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_SPARC_LEON3_CACHE_SNOOPING_DISABLED_SECONDARY_H */ diff --git a/testsuites/validation/bsps/tr-fatal-sparc-leon3-clock-initialization.c b/testsuites/validation/bsps/tr-fatal-sparc-leon3-clock-initialization.c new file mode 100644 index 0000000000..5cd81b736c --- /dev/null +++ b/testsuites/validation/bsps/tr-fatal-sparc-leon3-clock-initialization.c @@ -0,0 +1,190 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup BspSparcLeon3ValFatalClockInitialization + */ + +/* + * Copyright (C) 2021 embedded brains GmbH & Co. KG + * + * 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 <bsp/fatal.h> +#include <bsp/leon3.h> +#include <rtems/irq-extension.h> +#include <rtems/sysinit.h> + +#include "tr-fatal-sparc-leon3-clock-initialization.h" + +#include <rtems/test.h> + +/** + * @defgroup BspSparcLeon3ValFatalClockInitialization \ + * spec:/bsp/sparc/leon3/val/fatal-clock-initialization + * + * @ingroup TestsuitesBspsFatalSparcLeon3ClockInitialization + * + * @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 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 +); + +static T_fixture BspSparcLeon3ValFatalClockInitialization_Fixture = { + .setup = NULL, + .stop = NULL, + .teardown = NULL, + .scope = NULL, + .initial_context = &BspSparcLeon3ValFatalClockInitialization_Instance +}; + +/** + * @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/bsps/tr-fatal-sparc-leon3-clock-initialization.h b/testsuites/validation/bsps/tr-fatal-sparc-leon3-clock-initialization.h new file mode 100644 index 0000000000..6997b3f22c --- /dev/null +++ b/testsuites/validation/bsps/tr-fatal-sparc-leon3-clock-initialization.h @@ -0,0 +1,84 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup BspSparcLeon3ValFatalClockInitialization + */ + +/* + * Copyright (C) 2021 embedded brains GmbH & Co. KG + * + * 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_SPARC_LEON3_CLOCK_INITIALIZATION_H +#define _TR_FATAL_SPARC_LEON3_CLOCK_INITIALIZATION_H + +#include <rtems.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup BspSparcLeon3ValFatalClockInitialization + * + * @{ + */ + +/** + * @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_SPARC_LEON3_CLOCK_INITIALIZATION_H */ diff --git a/testsuites/validation/bsps/ts-fatal-clock-xil-ttc-irq-install.c b/testsuites/validation/bsps/ts-fatal-clock-xil-ttc-irq-install.c new file mode 100644 index 0000000000..e5c1062348 --- /dev/null +++ b/testsuites/validation/bsps/ts-fatal-clock-xil-ttc-irq-install.c @@ -0,0 +1,79 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup TestsuitesBspsFatalClockXilTtcIrqInstall + */ + +/* + * Copyright (C) 2024 embedded brains GmbH & Co. KG + * + * 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-clock-xil-ttc-irq-install.h" + +#include <rtems/test.h> + +/** + * @defgroup TestsuitesBspsFatalClockXilTtcIrqInstall \ + * spec:/testsuites/bsps/fatal-clock-xil-ttc-irq-install + * + * @ingroup RTEMSTestSuitesValidation + * + * @brief This validation test suite contains a test case which triggers a + * fatal error during system initialization. + * + * @{ + */ + +const char rtems_test_name[] = "TestsuitesBspsFatalClockXilTtcIrqInstall"; + +#define FATAL_SYSINIT_RUN DevClockXilTtcValFatalIrqInstall_Run + +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#include "ts-fatal-sysinit.h" + +/** @} */ diff --git a/testsuites/validation/bsps/ts-fatal-sparc-leon3-cache-snooping-disabled-boot.c b/testsuites/validation/bsps/ts-fatal-sparc-leon3-cache-snooping-disabled-boot.c new file mode 100644 index 0000000000..53e18b5b0b --- /dev/null +++ b/testsuites/validation/bsps/ts-fatal-sparc-leon3-cache-snooping-disabled-boot.c @@ -0,0 +1,79 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup TestsuitesBspsFatalSparcLeon3CacheSnoopingDisabledBoot + */ + +/* + * Copyright (C) 2021 embedded brains GmbH & Co. KG + * + * 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-sparc-leon3-cache-snooping-disabled-boot.h" + +#include <rtems/test.h> + +/** + * @defgroup TestsuitesBspsFatalSparcLeon3CacheSnoopingDisabledBoot \ + * spec:/testsuites/bsps/fatal-sparc-leon3-cache-snooping-disabled-boot + * + * @ingroup RTEMSTestSuitesValidation + * + * @brief This validation test suite contains a test case which triggers a + * fatal error during system initialization. + * + * @{ + */ + +const char rtems_test_name[] = "TestsuitesBspsFatalSparcLeon3CacheSnoopingDisabledBoot"; + +#define FATAL_SYSINIT_RUN BspSparcLeon3ValFatalCacheSnoopingDisabledBoot_Run + +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER + +#include "ts-fatal-sysinit.h" + +/** @} */ diff --git a/testsuites/validation/bsps/ts-fatal-sparc-leon3-cache-snooping-disabled-secondary.c b/testsuites/validation/bsps/ts-fatal-sparc-leon3-cache-snooping-disabled-secondary.c new file mode 100644 index 0000000000..3b8829dcf9 --- /dev/null +++ b/testsuites/validation/bsps/ts-fatal-sparc-leon3-cache-snooping-disabled-secondary.c @@ -0,0 +1,82 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup TestsuitesBspsFatalSparcLeon3CacheSnoopingDisabledSecondary + */ + +/* + * Copyright (C) 2021 embedded brains GmbH & Co. KG + * + * 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-sparc-leon3-cache-snooping-disabled-secondary.h" + +#include <rtems/test.h> + +/** + * @defgroup TestsuitesBspsFatalSparcLeon3CacheSnoopingDisabledSecondary \ + * spec:/testsuites/bsps/fatal-sparc-leon3-cache-snooping-disabled-secondary + * + * @ingroup RTEMSTestSuitesValidation + * + * @brief This validation test suite contains a test case which triggers a + * fatal error during system initialization. + * + * @{ + */ + +const char rtems_test_name[] = "TestsuitesBspsFatalSparcLeon3CacheSnoopingDisabledSecondary"; + +#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/bsps/ts-fatal-sparc-leon3-clock-initialization.c b/testsuites/validation/bsps/ts-fatal-sparc-leon3-clock-initialization.c new file mode 100644 index 0000000000..b75223537f --- /dev/null +++ b/testsuites/validation/bsps/ts-fatal-sparc-leon3-clock-initialization.c @@ -0,0 +1,79 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup TestsuitesBspsFatalSparcLeon3ClockInitialization + */ + +/* + * Copyright (C) 2021 embedded brains GmbH & Co. KG + * + * 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-sparc-leon3-clock-initialization.h" + +#include <rtems/test.h> + +/** + * @defgroup TestsuitesBspsFatalSparcLeon3ClockInitialization \ + * spec:/testsuites/bsps/fatal-sparc-leon3-clock-initialization + * + * @ingroup RTEMSTestSuitesValidation + * + * @brief This validation test suite contains a test case which triggers a + * fatal error during system initialization. + * + * @{ + */ + +const char rtems_test_name[] = "TestsuitesBspsFatalSparcLeon3ClockInitialization"; + +#define FATAL_SYSINIT_RUN BspSparcLeon3ValFatalClockInitialization_Run + +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#include "ts-fatal-sysinit.h" + +/** @} */ diff --git a/testsuites/validation/bsps/ts-fatal-sparc-leon3-shutdown-response.c b/testsuites/validation/bsps/ts-fatal-sparc-leon3-shutdown-response.c new file mode 100644 index 0000000000..d730b6d027 --- /dev/null +++ b/testsuites/validation/bsps/ts-fatal-sparc-leon3-shutdown-response.c @@ -0,0 +1,94 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestSuiteTestsuitesFatalBspSparcLeon3ShutdownResponse + */ + +/* + * Copyright (C) 2021 embedded brains GmbH & Co. KG + * + * 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 <rtems/score/smpimpl.h> + +#include "tr-fatal-sparc-leon3-shutdown-response.h" + +#include <rtems/test.h> + +/** + * @defgroup RTEMSTestSuiteTestsuitesFatalBspSparcLeon3ShutdownResponse \ + * spec:/testsuites/fatal-sparc-leon3-shutdown-response + * + * @ingroup RTEMSTestSuitesValidation + * + * @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 + +static void FatalSysinitExit( rtems_fatal_code exit_code ) +{ + if ( exit_code == 0 ) { + rtems_fatal( RTEMS_FATAL_SOURCE_SMP, SMP_FATAL_SHUTDOWN ); + } else { + rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, exit_code ); + } +} + +#define FATAL_SYSINIT_EXIT( exit_code ) FatalSysinitExit( exit_code ) + +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_PROCESSORS 2 + +#include "ts-fatal-sysinit.h" + +/** @} */ diff --git a/testsuites/validation/bsps/ts-fatal-sparc-leon3-shutdown.c b/testsuites/validation/bsps/ts-fatal-sparc-leon3-shutdown.c new file mode 100644 index 0000000000..bc229e7824 --- /dev/null +++ b/testsuites/validation/bsps/ts-fatal-sparc-leon3-shutdown.c @@ -0,0 +1,177 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup TestsuitesBspsFatalSparcLeon3Shutdown + */ + +/* + * Copyright (C) 2021, 2022 embedded brains GmbH & Co. KG + * + * 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 <rtems.h> +#include <rtems/bspIo.h> +#include <rtems/test-info.h> +#include <rtems/test.h> +#include <rtems/testopts.h> +#include <rtems/score/smpimpl.h> + +#include "ts-config.h" +#include "tx-support.h" + +#include <rtems/test.h> + +/** + * @defgroup TestsuitesBspsFatalSparcLeon3Shutdown \ + * spec:/testsuites/bsps/fatal-sparc-leon3-shutdown + * + * @ingroup RTEMSTestSuitesValidation + * + * @brief This validation test suite provides an application configuration to + * perform a shutdown. + * + * @{ + */ + +const char rtems_test_name[] = "TestsuitesBspsFatalSparcLeon3Shutdown"; + +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_tick, + .allocate = T_memory_allocate, + .deallocate = T_memory_deallocate, + .action_count = T_ARRAY_SIZE( actions ), + .actions = actions +}; + +void __real__CPU_Fatal_halt( uint32_t source, CPU_Uint32ptr code ); + +void __wrap__CPU_Fatal_halt( uint32_t source, CPU_Uint32ptr code ); + +void __wrap__CPU_Fatal_halt( uint32_t source, CPU_Uint32ptr code ) +{ + int exit_code; + + T_register(); + exit_code = T_main( &test_config ); + + if ( exit_code == 0 ) { + rtems_test_end( rtems_test_name ); + } + +#if defined(RTEMS_GCOV_COVERAGE) + rtems_test_gcov_dump_info(); +#endif + __real__CPU_Fatal_halt( source, code ); +} + +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER + +#if defined(RTEMS_SMP) +#define CONFIGURE_MAXIMUM_PROCESSORS 2 + +#include <rtems/score/scheduleredfsmp.h> + +#define CONFIGURE_SCHEDULER_EDF_SMP + +#include <rtems/scheduler.h> + +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( 0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY ) +#endif /* RTEMS_SMP */ + +#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 0 + +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 + +#define CONFIGURE_DISABLE_NEWLIB_REENTRANCY + +#define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM + +#define CONFIGURE_IDLE_TASK_STORAGE_SIZE RTEMS_MINIMUM_STACK_SIZE + +#define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION + +static void *ShutdownIdleBody( uintptr_t arg ) +{ +#if defined(RTEMS_SMP) + if ( rtems_scheduler_get_processor() == 0 ) { + rtems_test_begin( rtems_test_name, TEST_STATE ); + rtems_fatal( RTEMS_FATAL_SOURCE_SMP, SMP_FATAL_SHUTDOWN ); + } + + return _CPU_Thread_Idle_body( arg ); +#else + rtems_test_begin( rtems_test_name, TEST_STATE ); + rtems_fatal( RTEMS_FATAL_SOURCE_APPLICATION, 123 ); +#endif +} + +#define CONFIGURE_IDLE_TASK_BODY ShutdownIdleBody + +#define CONFIGURE_INITIAL_EXTENSIONS { .fatal = FatalInitialExtension } + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> + +/** @} */ diff --git a/testsuites/validation/bsps/ts-validation-bsp-0.c b/testsuites/validation/bsps/ts-validation-bsp-0.c new file mode 100644 index 0000000000..c072c8fdf1 --- /dev/null +++ b/testsuites/validation/bsps/ts-validation-bsp-0.c @@ -0,0 +1,73 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup TestsuitesBspsValidationBsp0 + */ + +/* + * Copyright (C) 2021 embedded brains GmbH & Co. KG + * + * 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 <rtems/test.h> + +/** + * @defgroup TestsuitesBspsValidationBsp0 \ + * spec:/testsuites/bsps/validation-bsp-0 + * + * @ingroup RTEMSTestSuitesValidation + * + * @brief This general purpose validation test suite provides enough resources + * to run target-specific tests. + * + * @{ + */ + +const char rtems_test_name[] = "TestsuitesBspsValidationBsp0"; + +#include "ts-default.h" + +/** @} */ |