diff options
Diffstat (limited to 'testsuites/validation')
93 files changed, 4477 insertions, 161 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" + +/** @} */ diff --git a/testsuites/validation/tc-basedefs.c b/testsuites/validation/tc-basedefs.c index 94600f5241..835f76ec64 100644 --- a/testsuites/validation/tc-basedefs.c +++ b/testsuites/validation/tc-basedefs.c @@ -432,6 +432,12 @@ * - Checked that the RTEMS_ZERO_LENGTH_ARRAY macro produces a structure * similar to a structure with one element. * + * - Use the RTEMS_DEFINE_GLOBAL_SYMBOL() macro at the beginning of this file + * and assign the address of the symbol to an object. + * + * - Check that the RTEMS_DEFINE_GLOBAL_SYMBOL() macro defines a global + * symbol with the correct value. + * * @{ */ @@ -527,8 +533,18 @@ RTEMS_COMPILER_PURE_ATTRIBUTE static int compiler_pure_attribute_func( void ) return 21; } +static int global_symbol_base; + RTEMS_DEFINE_GLOBAL_SYMBOL( - GLOBAL_SYMBOL, GLOBAL_SYMBOL_VALULE( abc ) ); + GLOBAL_SYMBOL, + RTEMS_SYMBOL_NAME( global_symbol_base ) + GLOBAL_SYMBOL_VALULE( abc ) +); + +RTEMS_DECLARE_GLOBAL_SYMBOL( global_symbol_2 ); + +RTEMS_DEFINE_GLOBAL_SYMBOL( global_symbol_2, 0x123 ); + +static const char * const volatile global_symbol_2_object = global_symbol_2; static int deprecated_func( int i ) RTEMS_DEPRECATED; static int deprecated_func( int i ) @@ -1055,7 +1071,11 @@ static void RtemsBasedefsValBasedefs_Action_18( void ) * which is defined in a file different from the file in which the gobal * symbol is defined. */ - T_step_eq_int( 45, basedefs_get_global_symbol(), 0xabc ); + T_step_eq_uptr( + 45, + basedefs_get_global_symbol() - (uintptr_t) &global_symbol_base, + 0xabc + ); } /** @@ -1089,7 +1109,11 @@ static void RtemsBasedefsValBasedefs_Action_20( void ) * Check that the RTEMS_DEFINE_GLOBAL_SYMBOL() macro defines a global symbol * with the correct value. */ - T_step_eq_int( 49, (uintptr_t) global_symbol, 0xabc ); + T_step_eq_uptr( + 49, + (uintptr_t) global_symbol - (uintptr_t) &global_symbol_base, + 0xabc + ); } /** @@ -1926,11 +1950,26 @@ static void RtemsBasedefsValBasedefs_Action_55( void ) } /** + * @brief Use the RTEMS_DEFINE_GLOBAL_SYMBOL() macro at the beginning of this + * file and assign the address of the symbol to an object. + */ +static void RtemsBasedefsValBasedefs_Action_56( void ) +{ + /* No action */ + + /* + * Check that the RTEMS_DEFINE_GLOBAL_SYMBOL() macro defines a global symbol + * with the correct value. + */ + T_step_eq_uptr( 129, (uintptr_t) global_symbol_2_object, 0x123 ); +} + +/** * @fn void T_case_body_RtemsBasedefsValBasedefs( void ) */ T_TEST_CASE( RtemsBasedefsValBasedefs ) { - T_plan( 129 ); + T_plan( 130 ); RtemsBasedefsValBasedefs_Action_0(); RtemsBasedefsValBasedefs_Action_1(); @@ -1988,6 +2027,7 @@ T_TEST_CASE( RtemsBasedefsValBasedefs ) RtemsBasedefsValBasedefs_Action_53(); RtemsBasedefsValBasedefs_Action_54(); RtemsBasedefsValBasedefs_Action_55(); + RtemsBasedefsValBasedefs_Action_56(); } /** @} */ diff --git a/testsuites/validation/tc-clock-nanosleep.c b/testsuites/validation/tc-clock-nanosleep.c index 2e2d9e343c..514f5376ba 100644 --- a/testsuites/validation/tc-clock-nanosleep.c +++ b/testsuites/validation/tc-clock-nanosleep.c @@ -166,29 +166,29 @@ typedef struct { /** * @brief This member provides the scheduler operation records. */ - T_scheduler_log_4 scheduler_log;; + T_scheduler_log_4 scheduler_log; /** * @brief This member contains the CLOCK_REALTIME value before the * clock_nanosleep() call. */ - struct timespec now_realtime;; + struct timespec now_realtime; /** * @brief This member contains the CLOCK_MONOTONIC value before the * clock_nanosleep() call. */ - struct timespec now_monotonic;; + struct timespec now_monotonic; /** * @brief This member contains the worker task identifier. */ - rtems_id worker_id;; + rtems_id worker_id; /** * @brief This member contains the timer information of the worker task. */ - TaskTimerInfo timer_info;; + TaskTimerInfo timer_info; /** * @brief This member provides the object referenced by the ``rqtp`` diff --git a/testsuites/validation/tc-cpu-performance.c b/testsuites/validation/tc-cpu-performance.c new file mode 100644 index 0000000000..4f090e704f --- /dev/null +++ b/testsuites/validation/tc-cpu-performance.c @@ -0,0 +1,270 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup ScoreCpuValPerf + */ + +/* + * Copyright (C) 2023 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/cpuimpl.h> + +#include "tx-support.h" + +#include <rtems/test.h> + +/** + * @defgroup ScoreCpuValPerf spec:/score/cpu/val/perf + * + * @ingroup TestsuitesPerformanceNoClock0 + * + * @brief This test case provides a context to run CPU port performance tests. + * + * @{ + */ + +/** + * @brief Test context for spec:/score/cpu/val/perf test case. + */ +typedef struct { + /** + * @brief This member references the measure runtime context. + */ + T_measure_runtime_context *context; + + /** + * @brief This member provides the measure runtime request. + */ + T_measure_runtime_request request; + + /** + * @brief This member provides an optional measurement begin time point. + */ + T_ticks begin; + + /** + * @brief This member provides an optional measurement end time point. + */ + T_ticks end; +} ScoreCpuValPerf_Context; + +static ScoreCpuValPerf_Context + ScoreCpuValPerf_Instance; + +static void ScoreCpuValPerf_Setup_Context( ScoreCpuValPerf_Context *ctx ) +{ + T_measure_runtime_config config; + + memset( &config, 0, sizeof( config ) ); + config.sample_count = 100; + ctx->request.arg = ctx; + ctx->request.flags = T_MEASURE_RUNTIME_REPORT_SAMPLES; + ctx->context = T_measure_runtime_create( &config ); + T_assert_not_null( ctx->context ); +} + +static void ScoreCpuValPerf_Setup_Wrap( void *arg ) +{ + ScoreCpuValPerf_Context *ctx; + + ctx = arg; + ScoreCpuValPerf_Setup_Context( ctx ); +} + +static T_fixture ScoreCpuValPerf_Fixture = { + .setup = ScoreCpuValPerf_Setup_Wrap, + .stop = NULL, + .teardown = NULL, + .scope = NULL, + .initial_context = &ScoreCpuValPerf_Instance +}; + +/** + * @defgroup ScoreCpuReqPerfEmpty spec:/score/cpu/req/perf-empty + * + * @{ + */ + +/** + * @brief Do nothing and just return. + */ +static void ScoreCpuReqPerfEmpty_Body( ScoreCpuValPerf_Context *ctx ) +{ + /* No code */ +} + +static void ScoreCpuReqPerfEmpty_Body_Wrap( void *arg ) +{ + ScoreCpuValPerf_Context *ctx; + + ctx = arg; + ScoreCpuReqPerfEmpty_Body( ctx ); +} + +/** + * @brief Discard samples interrupted by a clock tick. + */ +static bool ScoreCpuReqPerfEmpty_Teardown( + ScoreCpuValPerf_Context *ctx, + T_ticks *delta, + uint32_t tic, + uint32_t toc, + unsigned int retry +) +{ + return tic == toc; +} + +static bool ScoreCpuReqPerfEmpty_Teardown_Wrap( + void *arg, + T_ticks *delta, + uint32_t tic, + uint32_t toc, + unsigned int retry +) +{ + ScoreCpuValPerf_Context *ctx; + + ctx = arg; + return ScoreCpuReqPerfEmpty_Teardown( ctx, delta, tic, toc, retry ); +} + +/** @} */ + +/** + * @defgroup ScoreCpuReqPerfNops spec:/score/cpu/req/perf-nops + * + * @{ + */ + +/** + * @brief Execute exactly 1000 no-operation instructions. + */ +static void ScoreCpuReqPerfNops_Body( ScoreCpuValPerf_Context *ctx ) +{ + #define NOPS_10 \ + _CPU_Instruction_no_operation(); _CPU_Instruction_no_operation(); \ + _CPU_Instruction_no_operation(); _CPU_Instruction_no_operation(); \ + _CPU_Instruction_no_operation(); _CPU_Instruction_no_operation(); \ + _CPU_Instruction_no_operation(); _CPU_Instruction_no_operation(); \ + _CPU_Instruction_no_operation(); _CPU_Instruction_no_operation(); + #define NOPS_100 NOPS_10 NOPS_10 NOPS_10 NOPS_10 NOPS_10 NOPS_10 NOPS_10 \ + NOPS_10 NOPS_10 NOPS_10 + NOPS_100 + NOPS_100 + NOPS_100 + NOPS_100 + NOPS_100 + NOPS_100 + NOPS_100 + NOPS_100 + NOPS_100 + NOPS_100 +} + +static void ScoreCpuReqPerfNops_Body_Wrap( void *arg ) +{ + ScoreCpuValPerf_Context *ctx; + + ctx = arg; + ScoreCpuReqPerfNops_Body( ctx ); +} + +/** + * @brief Discard samples interrupted by a clock tick. + */ +static bool ScoreCpuReqPerfNops_Teardown( + ScoreCpuValPerf_Context *ctx, + T_ticks *delta, + uint32_t tic, + uint32_t toc, + unsigned int retry +) +{ + return tic == toc; +} + +static bool ScoreCpuReqPerfNops_Teardown_Wrap( + void *arg, + T_ticks *delta, + uint32_t tic, + uint32_t toc, + unsigned int retry +) +{ + ScoreCpuValPerf_Context *ctx; + + ctx = arg; + return ScoreCpuReqPerfNops_Teardown( ctx, delta, tic, toc, retry ); +} + +/** @} */ + +/** + * @fn void T_case_body_ScoreCpuValPerf( void ) + */ +T_TEST_CASE_FIXTURE( ScoreCpuValPerf, &ScoreCpuValPerf_Fixture ) +{ + ScoreCpuValPerf_Context *ctx; + + ctx = T_fixture_context(); + + ctx->request.name = "ScoreCpuReqPerfEmpty"; + ctx->request.setup = NULL; + ctx->request.body = ScoreCpuReqPerfEmpty_Body_Wrap; + ctx->request.teardown = ScoreCpuReqPerfEmpty_Teardown_Wrap; + T_measure_runtime( ctx->context, &ctx->request ); + + ctx->request.name = "ScoreCpuReqPerfNops"; + ctx->request.setup = NULL; + ctx->request.body = ScoreCpuReqPerfNops_Body_Wrap; + ctx->request.teardown = ScoreCpuReqPerfNops_Teardown_Wrap; + T_measure_runtime( ctx->context, &ctx->request ); +} + +/** @} */ diff --git a/testsuites/validation/tc-dev-clock-xil-ttc.c b/testsuites/validation/tc-dev-clock-xil-ttc.c new file mode 100644 index 0000000000..70f49a4cc6 --- /dev/null +++ b/testsuites/validation/tc-dev-clock-xil-ttc.c @@ -0,0 +1,136 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup DevClockXilTtcValTickCatchUp + */ + +/* + * 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 <rtems.h> +#include <sys/time.h> + +#include <rtems/test.h> + +/** + * @defgroup DevClockXilTtcValTickCatchUp \ + * spec:/dev/clock/xil-ttc/val/tick-catch-up + * + * @ingroup TestsuitesBspsValidationBsp0 + * + * @brief Tests some Xilinx TTC clock driver functions. + * + * This test case performs the following actions: + * + * - Synchronize with the clock tick. Disable interrupts. Busy wait three + * clock tick intervals. Enable interrupts. + * + * - Check that exactly three clock ticks happened once interrupts are + * enabled again. + * + * @{ + */ + +/** + * @brief Synchronize with the clock tick. Disable interrupts. Busy wait + * three clock tick intervals. Enable interrupts. + */ +static void DevClockXilTtcValTickCatchUp_Action_0( void ) +{ + uint32_t ns_per_tick; + uint64_t three_ticks_interval; + rtems_interrupt_level level; + rtems_interval t_0; + rtems_interval t_1; + rtems_interval t_2; + uint64_t m_0; + uint64_t m_1; + + ns_per_tick = rtems_configuration_get_nanoseconds_per_tick(); + three_ticks_interval = ( 7 * (uint64_t) nstosbt( ns_per_tick ) ) / 2; + t_0 = rtems_clock_get_ticks_since_boot(); + + /* Synchronize with clock tick */ + do { + t_1 = rtems_clock_get_ticks_since_boot(); + m_0 = (uint64_t) rtems_clock_get_monotonic_sbintime(); + } while ( t_0 == t_1 ); + + rtems_interrupt_local_disable( level ); + + do { + m_1 = (uint64_t) rtems_clock_get_monotonic_sbintime(); + } while ( m_1 - m_0 <= three_ticks_interval ); + + rtems_interrupt_local_enable( level ); + + /* + * Make sure the clock interrupt was serviced after the interrupt enable. + */ + do { + t_2 = rtems_clock_get_ticks_since_boot(); + } while ( t_1 == t_2 ); + + /* + * Check that exactly three clock ticks happened once interrupts are enabled + * again. + */ + T_step_eq_u32( 0, t_2 - t_1, 3 ); +} + +/** + * @fn void T_case_body_DevClockXilTtcValTickCatchUp( void ) + */ +T_TEST_CASE( DevClockXilTtcValTickCatchUp ) +{ + T_plan( 1 ); + + DevClockXilTtcValTickCatchUp_Action_0(); +} + +/** @} */ diff --git a/testsuites/validation/tc-dev-grlib-apbuart-inbyte-nonblocking.c b/testsuites/validation/tc-dev-grlib-apbuart-inbyte-nonblocking.c new file mode 100644 index 0000000000..b33b6f1a25 --- /dev/null +++ b/testsuites/validation/tc-dev-grlib-apbuart-inbyte-nonblocking.c @@ -0,0 +1,348 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup DevGrlibReqApbuartInbyteNonblocking + */ + +/* + * 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 <string.h> +#include <grlib/apbuart.h> + +#include <rtems/test.h> + +/** + * @defgroup DevGrlibReqApbuartInbyteNonblocking \ + * spec:/dev/grlib/req/apbuart-inbyte-nonblocking + * + * @ingroup TestsuitesBspsValidationBsp0 + * + * @{ + */ + +typedef enum { + DevGrlibReqApbuartInbyteNonblocking_Pre_DataReady_Yes, + DevGrlibReqApbuartInbyteNonblocking_Pre_DataReady_No, + DevGrlibReqApbuartInbyteNonblocking_Pre_DataReady_NA +} DevGrlibReqApbuartInbyteNonblocking_Pre_DataReady; + +typedef enum { + DevGrlibReqApbuartInbyteNonblocking_Post_Result_Data, + DevGrlibReqApbuartInbyteNonblocking_Post_Result_MinusOne, + DevGrlibReqApbuartInbyteNonblocking_Post_Result_NA +} DevGrlibReqApbuartInbyteNonblocking_Post_Result; + +typedef enum { + DevGrlibReqApbuartInbyteNonblocking_Post_ErrorFlags_Cleared, + DevGrlibReqApbuartInbyteNonblocking_Post_ErrorFlags_NA +} DevGrlibReqApbuartInbyteNonblocking_Post_ErrorFlags; + +typedef struct { + uint8_t Skip : 1; + uint8_t Pre_DataReady_NA : 1; + uint8_t Post_Result : 2; + uint8_t Post_ErrorFlags : 1; +} DevGrlibReqApbuartInbyteNonblocking_Entry; + +/** + * @brief Test context for spec:/dev/grlib/req/apbuart-inbyte-nonblocking test + * case. + */ +typedef struct { + /** + * @brief This member provides the APBUART register block. + */ + apbuart regs; + + /** + * @brief This member contains the return value of the + * apbuart_inbyte_nonblocking() call. + */ + int result; + + struct { + /** + * @brief This member defines the pre-condition states for the next action. + */ + size_t pcs[ 1 ]; + + /** + * @brief If this member is true, then the test action loop is executed. + */ + bool in_action_loop; + + /** + * @brief This member contains the next transition map index. + */ + size_t index; + + /** + * @brief This member contains the current transition map entry. + */ + DevGrlibReqApbuartInbyteNonblocking_Entry entry; + + /** + * @brief If this member is true, then the current transition variant + * should be skipped. + */ + bool skip; + } Map; +} DevGrlibReqApbuartInbyteNonblocking_Context; + +static DevGrlibReqApbuartInbyteNonblocking_Context + DevGrlibReqApbuartInbyteNonblocking_Instance; + +static const char * const DevGrlibReqApbuartInbyteNonblocking_PreDesc_DataReady[] = { + "Yes", + "No", + "NA" +}; + +static const char * const * const DevGrlibReqApbuartInbyteNonblocking_PreDesc[] = { + DevGrlibReqApbuartInbyteNonblocking_PreDesc_DataReady, + NULL +}; + +static void DevGrlibReqApbuartInbyteNonblocking_Pre_DataReady_Prepare( + DevGrlibReqApbuartInbyteNonblocking_Context *ctx, + DevGrlibReqApbuartInbyteNonblocking_Pre_DataReady state +) +{ + switch ( state ) { + case DevGrlibReqApbuartInbyteNonblocking_Pre_DataReady_Yes: { + /* + * While the data ready flag is set in the status register of the + * register block specified by ``regs`` parameter. + */ + ctx->regs.status |= APBUART_STATUS_DR; + break; + } + + case DevGrlibReqApbuartInbyteNonblocking_Pre_DataReady_No: { + /* + * While the data ready flag is cleared in the status register of the + * register block specified by ``regs`` parameter. + */ + ctx->regs.status &= ~APBUART_STATUS_DR; + break; + } + + case DevGrlibReqApbuartInbyteNonblocking_Pre_DataReady_NA: + break; + } +} + +static void DevGrlibReqApbuartInbyteNonblocking_Post_Result_Check( + DevGrlibReqApbuartInbyteNonblocking_Context *ctx, + DevGrlibReqApbuartInbyteNonblocking_Post_Result state +) +{ + switch ( state ) { + case DevGrlibReqApbuartInbyteNonblocking_Post_Result_Data: { + /* + * The return value of apbuart_inbyte_nonblocking() shall be the data + * read from the data register of the register block specified by + * ``regs``. + */ + T_eq_int( ctx->result, 0xff ); + break; + } + + case DevGrlibReqApbuartInbyteNonblocking_Post_Result_MinusOne: { + /* + * The return value of apbuart_inbyte_nonblocking() shall be minus one. + */ + T_eq_int( ctx->result, -1 ); + break; + } + + case DevGrlibReqApbuartInbyteNonblocking_Post_Result_NA: + break; + } +} + +static void DevGrlibReqApbuartInbyteNonblocking_Post_ErrorFlags_Check( + DevGrlibReqApbuartInbyteNonblocking_Context *ctx, + DevGrlibReqApbuartInbyteNonblocking_Post_ErrorFlags state +) +{ + switch ( state ) { + case DevGrlibReqApbuartInbyteNonblocking_Post_ErrorFlags_Cleared: { + /* + * The framing error, parity error, overrun, and break received flags in + * the status register of the register block specified by ``regs`` shall + * be cleared. + */ + T_eq_u32( ctx->regs.status & 0x78, 0 ); + break; + } + + case DevGrlibReqApbuartInbyteNonblocking_Post_ErrorFlags_NA: + break; + } +} + +static void DevGrlibReqApbuartInbyteNonblocking_Prepare( + DevGrlibReqApbuartInbyteNonblocking_Context *ctx +) +{ + memset( &ctx->regs, 0, sizeof( ctx->regs ) ); + ctx->regs.status = 0x78; + ctx->regs.data = 0xff; +} + +static void DevGrlibReqApbuartInbyteNonblocking_Action( + DevGrlibReqApbuartInbyteNonblocking_Context *ctx +) +{ + ctx->result = apbuart_inbyte_nonblocking( &ctx->regs ); +} + +static const DevGrlibReqApbuartInbyteNonblocking_Entry +DevGrlibReqApbuartInbyteNonblocking_Entries[] = { + { 0, 0, DevGrlibReqApbuartInbyteNonblocking_Post_Result_Data, + DevGrlibReqApbuartInbyteNonblocking_Post_ErrorFlags_Cleared }, + { 0, 0, DevGrlibReqApbuartInbyteNonblocking_Post_Result_MinusOne, + DevGrlibReqApbuartInbyteNonblocking_Post_ErrorFlags_Cleared } +}; + +static const uint8_t +DevGrlibReqApbuartInbyteNonblocking_Map[] = { + 0, 1 +}; + +static size_t DevGrlibReqApbuartInbyteNonblocking_Scope( + void *arg, + char *buf, + size_t n +) +{ + DevGrlibReqApbuartInbyteNonblocking_Context *ctx; + + ctx = arg; + + if ( ctx->Map.in_action_loop ) { + return T_get_scope( + DevGrlibReqApbuartInbyteNonblocking_PreDesc, + buf, + n, + ctx->Map.pcs + ); + } + + return 0; +} + +static T_fixture DevGrlibReqApbuartInbyteNonblocking_Fixture = { + .setup = NULL, + .stop = NULL, + .teardown = NULL, + .scope = DevGrlibReqApbuartInbyteNonblocking_Scope, + .initial_context = &DevGrlibReqApbuartInbyteNonblocking_Instance +}; + +static inline DevGrlibReqApbuartInbyteNonblocking_Entry +DevGrlibReqApbuartInbyteNonblocking_PopEntry( + DevGrlibReqApbuartInbyteNonblocking_Context *ctx +) +{ + size_t index; + + index = ctx->Map.index; + ctx->Map.index = index + 1; + return DevGrlibReqApbuartInbyteNonblocking_Entries[ + DevGrlibReqApbuartInbyteNonblocking_Map[ index ] + ]; +} + +static void DevGrlibReqApbuartInbyteNonblocking_TestVariant( + DevGrlibReqApbuartInbyteNonblocking_Context *ctx +) +{ + DevGrlibReqApbuartInbyteNonblocking_Pre_DataReady_Prepare( + ctx, + ctx->Map.pcs[ 0 ] + ); + DevGrlibReqApbuartInbyteNonblocking_Action( ctx ); + DevGrlibReqApbuartInbyteNonblocking_Post_Result_Check( + ctx, + ctx->Map.entry.Post_Result + ); + DevGrlibReqApbuartInbyteNonblocking_Post_ErrorFlags_Check( + ctx, + ctx->Map.entry.Post_ErrorFlags + ); +} + +/** + * @fn void T_case_body_DevGrlibReqApbuartInbyteNonblocking( void ) + */ +T_TEST_CASE_FIXTURE( + DevGrlibReqApbuartInbyteNonblocking, + &DevGrlibReqApbuartInbyteNonblocking_Fixture +) +{ + DevGrlibReqApbuartInbyteNonblocking_Context *ctx; + + ctx = T_fixture_context(); + ctx->Map.in_action_loop = true; + ctx->Map.index = 0; + + for ( + ctx->Map.pcs[ 0 ] = DevGrlibReqApbuartInbyteNonblocking_Pre_DataReady_Yes; + ctx->Map.pcs[ 0 ] < DevGrlibReqApbuartInbyteNonblocking_Pre_DataReady_NA; + ++ctx->Map.pcs[ 0 ] + ) { + ctx->Map.entry = DevGrlibReqApbuartInbyteNonblocking_PopEntry( ctx ); + DevGrlibReqApbuartInbyteNonblocking_Prepare( ctx ); + DevGrlibReqApbuartInbyteNonblocking_TestVariant( ctx ); + } +} + +/** @} */ diff --git a/testsuites/validation/tc-dev-grlib-io.c b/testsuites/validation/tc-dev-grlib-io.c new file mode 100644 index 0000000000..5bfc3fcfab --- /dev/null +++ b/testsuites/validation/tc-dev-grlib-io.c @@ -0,0 +1,295 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup DevGrlibValIo + */ + +/* + * 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 <string.h> +#include <grlib/apbuart.h> +#include <grlib/io.h> + +#include "tx-support.h" + +#include <rtems/test.h> + +/** + * @defgroup DevGrlibValIo spec:/dev/grlib/val/io + * + * @ingroup TestsuitesBspsValidationBsp0 + * + * @brief Tests some @ref RTEMSDeviceGRLIB directives. + * + * This test case performs the following actions: + * + * - Call grlib_load_8() to load a prepared value. + * + * - Check that the returned value is equal to the prepared value. + * + * - Call grlib_load_16() to load a prepared value. + * + * - Check that the returned value is equal to the prepared value. + * + * - Call grlib_load_32() to load a prepared value. + * + * - Check that the returned value is equal to the prepared value. + * + * - Call grlib_load_64() to load a prepared value. + * + * - Check that the returned value is equal to the prepared value. + * + * - Call grlib_store_8() to store a value to an object. + * + * - Check that the value of the object is equal to the stored value. + * + * - Call grlib_store_16() to store a value to an object. + * + * - Check that the value of the object is equal to the stored value. + * + * - Call grlib_store_32() to store a value to an object. + * + * - Check that the value of the object is equal to the stored value. + * + * - Call grlib_store_64() to store a value to an object. + * + * - Check that the value of the object is equal to the stored value. + * + * - Call apbuart_outbyte_polled() to store a character to the data register. + * The transmitter FIFO shall be initially non-empty. The status is checked + * by apbuart_outbyte_wait(). + * + * - Check that the transmitter FIFO empty flag was set by ApbuartIORelax(). + * + * - Check that the data register was written by apbuart_outbyte_polled(). + * + * @{ + */ + +static void ApbuartIORelax( void *arg ) +{ + apbuart *regs; + + regs = arg; + regs->status = 0x4; + T_quiet_eq_u32( regs->data, 0 ); +} + +/** + * @brief Call grlib_load_8() to load a prepared value. + */ +static void DevGrlibValIo_Action_0( void ) +{ + uint8_t reg_8; + uint8_t val_8; + + reg_8 = 0x81; + val_8 = grlib_load_8( ®_8 ); + + /* + * Check that the returned value is equal to the prepared value. + */ + T_step_eq_u8( 0, val_8, 0x81 ); +} + +/** + * @brief Call grlib_load_16() to load a prepared value. + */ +static void DevGrlibValIo_Action_1( void ) +{ + uint16_t reg_16; + uint16_t val_16; + + reg_16 = 0x8001; + val_16 = grlib_load_16( ®_16 ); + + /* + * Check that the returned value is equal to the prepared value. + */ + T_step_eq_u16( 1, val_16, 0x8001 ); +} + +/** + * @brief Call grlib_load_32() to load a prepared value. + */ +static void DevGrlibValIo_Action_2( void ) +{ + uint32_t reg_32; + uint32_t val_32; + + reg_32 = 0x80000001; + val_32 = grlib_load_32( ®_32 ); + + /* + * Check that the returned value is equal to the prepared value. + */ + T_step_eq_u32( 2, val_32, 0x80000001 ); +} + +/** + * @brief Call grlib_load_64() to load a prepared value. + */ +static void DevGrlibValIo_Action_3( void ) +{ + uint64_t reg_64; + uint64_t val_64; + + reg_64 = 0x8000000000000001; + val_64 = grlib_load_64( ®_64 ); + + /* + * Check that the returned value is equal to the prepared value. + */ + T_step_eq_u64( 3, val_64, 0x8000000000000001 ); +} + +/** + * @brief Call grlib_store_8() to store a value to an object. + */ +static void DevGrlibValIo_Action_4( void ) +{ + uint8_t reg_8; + + grlib_store_8( ®_8, 0x81 ); + + /* + * Check that the value of the object is equal to the stored value. + */ + T_step_eq_u8( 4, reg_8, 0x81 ); +} + +/** + * @brief Call grlib_store_16() to store a value to an object. + */ +static void DevGrlibValIo_Action_5( void ) +{ + uint16_t reg_16; + + grlib_store_16( ®_16, 0x8001 ); + + /* + * Check that the value of the object is equal to the stored value. + */ + T_step_eq_u16( 5, reg_16, 0x8001 ); +} + +/** + * @brief Call grlib_store_32() to store a value to an object. + */ +static void DevGrlibValIo_Action_6( void ) +{ + uint32_t reg_32; + + grlib_store_32( ®_32, 0x80000001 ); + + /* + * Check that the value of the object is equal to the stored value. + */ + T_step_eq_u32( 6, reg_32, 0x80000001 ); +} + +/** + * @brief Call grlib_store_64() to store a value to an object. + */ +static void DevGrlibValIo_Action_7( void ) +{ + uint64_t reg_64; + + grlib_store_64( ®_64, 0x8000000000000001 ); + + /* + * Check that the value of the object is equal to the stored value. + */ + T_step_eq_u64( 7, reg_64, 0x8000000000000001 ); +} + +/** + * @brief Call apbuart_outbyte_polled() to store a character to the data + * register. The transmitter FIFO shall be initially non-empty. The status + * is checked by apbuart_outbyte_wait(). + */ +static void DevGrlibValIo_Action_8( void ) +{ + apbuart regs; + + memset( ®s, 0, sizeof( regs ) ); + SetIORelaxHandler( ApbuartIORelax, ®s ); + apbuart_outbyte_polled( ®s, (char) 0xff ); + SetIORelaxHandler( NULL, NULL ); + + /* + * Check that the transmitter FIFO empty flag was set by ApbuartIORelax(). + */ + T_step_eq_u32( 8, regs.status, APBUART_STATUS_TE ); + + /* + * Check that the data register was written by apbuart_outbyte_polled(). + */ + T_step_eq_u32( 9, regs.data, 0xff ); +} + +/** + * @fn void T_case_body_DevGrlibValIo( void ) + */ +T_TEST_CASE( DevGrlibValIo ) +{ + T_plan( 10 ); + + DevGrlibValIo_Action_0(); + DevGrlibValIo_Action_1(); + DevGrlibValIo_Action_2(); + DevGrlibValIo_Action_3(); + DevGrlibValIo_Action_4(); + DevGrlibValIo_Action_5(); + DevGrlibValIo_Action_6(); + DevGrlibValIo_Action_7(); + DevGrlibValIo_Action_8(); +} + +/** @} */ diff --git a/testsuites/validation/tc-dev-grlib-irqamp-get-timestamp.c b/testsuites/validation/tc-dev-grlib-irqamp-get-timestamp.c new file mode 100644 index 0000000000..a064c479b9 --- /dev/null +++ b/testsuites/validation/tc-dev-grlib-irqamp-get-timestamp.c @@ -0,0 +1,304 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup DevGrlibReqIrqampGetTimestamp + */ + +/* + * 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 <grlib/irqamp.h> + +#include <rtems/test.h> + +/** + * @defgroup DevGrlibReqIrqampGetTimestamp \ + * spec:/dev/grlib/req/irqamp-get-timestamp + * + * @ingroup TestsuitesBspsValidationBsp0 + * + * @{ + */ + +typedef enum { + DevGrlibReqIrqampGetTimestamp_Pre_NumberOfTimestampRegisterSets_Zero, + DevGrlibReqIrqampGetTimestamp_Pre_NumberOfTimestampRegisterSets_Positive, + DevGrlibReqIrqampGetTimestamp_Pre_NumberOfTimestampRegisterSets_NA +} DevGrlibReqIrqampGetTimestamp_Pre_NumberOfTimestampRegisterSets; + +typedef enum { + DevGrlibReqIrqampGetTimestamp_Post_Result_Registers, + DevGrlibReqIrqampGetTimestamp_Post_Result_Null, + DevGrlibReqIrqampGetTimestamp_Post_Result_NA +} DevGrlibReqIrqampGetTimestamp_Post_Result; + +typedef struct { + uint8_t Skip : 1; + uint8_t Pre_NumberOfTimestampRegisterSets_NA : 1; + uint8_t Post_Result : 2; +} DevGrlibReqIrqampGetTimestamp_Entry; + +/** + * @brief Test context for spec:/dev/grlib/req/irqamp-get-timestamp test case. + */ +typedef struct { + /** + * @brief This member contains the return value of the + * irqamp_get_timestamp_registers() call. + */ + irqamp_timestamp *result; + + /** + * @brief This member contains the IRQ(A)MP register block. + */ + irqamp irqamp_regs; + + struct { + /** + * @brief This member defines the pre-condition states for the next action. + */ + size_t pcs[ 1 ]; + + /** + * @brief If this member is true, then the test action loop is executed. + */ + bool in_action_loop; + + /** + * @brief This member contains the next transition map index. + */ + size_t index; + + /** + * @brief This member contains the current transition map entry. + */ + DevGrlibReqIrqampGetTimestamp_Entry entry; + + /** + * @brief If this member is true, then the current transition variant + * should be skipped. + */ + bool skip; + } Map; +} DevGrlibReqIrqampGetTimestamp_Context; + +static DevGrlibReqIrqampGetTimestamp_Context + DevGrlibReqIrqampGetTimestamp_Instance; + +static const char * const DevGrlibReqIrqampGetTimestamp_PreDesc_NumberOfTimestampRegisterSets[] = { + "Zero", + "Positive", + "NA" +}; + +static const char * const * const DevGrlibReqIrqampGetTimestamp_PreDesc[] = { + DevGrlibReqIrqampGetTimestamp_PreDesc_NumberOfTimestampRegisterSets, + NULL +}; + +static void +DevGrlibReqIrqampGetTimestamp_Pre_NumberOfTimestampRegisterSets_Prepare( + DevGrlibReqIrqampGetTimestamp_Context *ctx, + DevGrlibReqIrqampGetTimestamp_Pre_NumberOfTimestampRegisterSets state +) +{ + switch ( state ) { + case DevGrlibReqIrqampGetTimestamp_Pre_NumberOfTimestampRegisterSets_Zero: { + /* + * While the number of timestamp register sets indicated by the IRQ(A)MP + * register block specified by the ``irqamp_regs`` parameter is zero. + */ + ctx->irqamp_regs.itstmp[ 0 ].itstmpc = 0; + break; + } + + case DevGrlibReqIrqampGetTimestamp_Pre_NumberOfTimestampRegisterSets_Positive: { + /* + * While the number of timestamp register sets indicated by the IRQ(A)MP + * register block specified by the ``irqamp_regs`` parameter is positive. + */ + ctx->irqamp_regs.itstmp[ 0 ].itstmpc = IRQAMP_ITSTMPC_TSTAMP( 1 ); + break; + } + + case DevGrlibReqIrqampGetTimestamp_Pre_NumberOfTimestampRegisterSets_NA: + break; + } +} + +static void DevGrlibReqIrqampGetTimestamp_Post_Result_Check( + DevGrlibReqIrqampGetTimestamp_Context *ctx, + DevGrlibReqIrqampGetTimestamp_Post_Result state +) +{ + switch ( state ) { + case DevGrlibReqIrqampGetTimestamp_Post_Result_Registers: { + /* + * The return value of irqamp_get_timestamp_registers() shall be address + * of the timestamping register block contained in the IRQ(A)MP register + * block specified by the ``irqamp_regs`` parameter. + */ + T_not_null( ctx->result ); + break; + } + + case DevGrlibReqIrqampGetTimestamp_Post_Result_Null: { + /* + * The return value of irqamp_get_timestamp_registers() shall be false. + */ + T_null( ctx->result ); + break; + } + + case DevGrlibReqIrqampGetTimestamp_Post_Result_NA: + break; + } +} + +static void DevGrlibReqIrqampGetTimestamp_Action( + DevGrlibReqIrqampGetTimestamp_Context *ctx +) +{ + ctx->result = irqamp_get_timestamp_registers( &ctx->irqamp_regs ); +} + +static const DevGrlibReqIrqampGetTimestamp_Entry +DevGrlibReqIrqampGetTimestamp_Entries[] = { + { 0, 0, DevGrlibReqIrqampGetTimestamp_Post_Result_Null }, + { 0, 0, DevGrlibReqIrqampGetTimestamp_Post_Result_Registers } +}; + +static const uint8_t +DevGrlibReqIrqampGetTimestamp_Map[] = { + 0, 1 +}; + +static size_t DevGrlibReqIrqampGetTimestamp_Scope( + void *arg, + char *buf, + size_t n +) +{ + DevGrlibReqIrqampGetTimestamp_Context *ctx; + + ctx = arg; + + if ( ctx->Map.in_action_loop ) { + return T_get_scope( + DevGrlibReqIrqampGetTimestamp_PreDesc, + buf, + n, + ctx->Map.pcs + ); + } + + return 0; +} + +static T_fixture DevGrlibReqIrqampGetTimestamp_Fixture = { + .setup = NULL, + .stop = NULL, + .teardown = NULL, + .scope = DevGrlibReqIrqampGetTimestamp_Scope, + .initial_context = &DevGrlibReqIrqampGetTimestamp_Instance +}; + +static inline DevGrlibReqIrqampGetTimestamp_Entry +DevGrlibReqIrqampGetTimestamp_PopEntry( + DevGrlibReqIrqampGetTimestamp_Context *ctx +) +{ + size_t index; + + index = ctx->Map.index; + ctx->Map.index = index + 1; + return DevGrlibReqIrqampGetTimestamp_Entries[ + DevGrlibReqIrqampGetTimestamp_Map[ index ] + ]; +} + +static void DevGrlibReqIrqampGetTimestamp_TestVariant( + DevGrlibReqIrqampGetTimestamp_Context *ctx +) +{ + DevGrlibReqIrqampGetTimestamp_Pre_NumberOfTimestampRegisterSets_Prepare( + ctx, + ctx->Map.pcs[ 0 ] + ); + DevGrlibReqIrqampGetTimestamp_Action( ctx ); + DevGrlibReqIrqampGetTimestamp_Post_Result_Check( + ctx, + ctx->Map.entry.Post_Result + ); +} + +/** + * @fn void T_case_body_DevGrlibReqIrqampGetTimestamp( void ) + */ +T_TEST_CASE_FIXTURE( + DevGrlibReqIrqampGetTimestamp, + &DevGrlibReqIrqampGetTimestamp_Fixture +) +{ + DevGrlibReqIrqampGetTimestamp_Context *ctx; + + ctx = T_fixture_context(); + ctx->Map.in_action_loop = true; + ctx->Map.index = 0; + + for ( + ctx->Map.pcs[ 0 ] = DevGrlibReqIrqampGetTimestamp_Pre_NumberOfTimestampRegisterSets_Zero; + ctx->Map.pcs[ 0 ] < DevGrlibReqIrqampGetTimestamp_Pre_NumberOfTimestampRegisterSets_NA; + ++ctx->Map.pcs[ 0 ] + ) { + ctx->Map.entry = DevGrlibReqIrqampGetTimestamp_PopEntry( ctx ); + DevGrlibReqIrqampGetTimestamp_TestVariant( ctx ); + } +} + +/** @} */ diff --git a/testsuites/validation/tc-futex-wait.c b/testsuites/validation/tc-futex-wait.c index 700ee74636..3730df2a40 100644 --- a/testsuites/validation/tc-futex-wait.c +++ b/testsuites/validation/tc-futex-wait.c @@ -101,7 +101,7 @@ typedef struct { /** * @brief This member contains the thread queue test context. */ - TQContext tq_ctx;; + TQContext tq_ctx; /** * @brief This member specifies the expected futex state value. diff --git a/testsuites/validation/tc-futex-wake.c b/testsuites/validation/tc-futex-wake.c index 67d5f8a4f0..baaa0daa6b 100644 --- a/testsuites/validation/tc-futex-wake.c +++ b/testsuites/validation/tc-futex-wake.c @@ -100,7 +100,7 @@ typedef struct { /** * @brief This member contains the thread queue test context. */ - TQContext tq_ctx;; + TQContext tq_ctx; /** * @brief This member provides the futex object. diff --git a/testsuites/validation/tc-intr-entry-install.c b/testsuites/validation/tc-intr-entry-install.c index 2a78681346..58c7989dbe 100644 --- a/testsuites/validation/tc-intr-entry-install.c +++ b/testsuites/validation/tc-intr-entry-install.c @@ -180,7 +180,7 @@ typedef struct { /** * @brief This member provides a counter snapshot for each entry. */ - uint32_t counter_by_entry[ 3 ];; + uint32_t counter_by_entry[ 3 ]; /** * @brief This member provides the vector number of a testable interrupt @@ -272,7 +272,7 @@ typedef struct { /** * @brief This member specifies if the ``entry`` parameter value. */ - rtems_interrupt_entry *entry;; + rtems_interrupt_entry *entry; /** * @brief This member contains the return value of the @@ -431,11 +431,8 @@ static void Routine( Context *ctx, uint32_t counter ) ctx->handler_counter = counter; - if ( - ctx->attributes.can_clear && - !ctx->attributes.cleared_by_acknowledge - ) { - sc = rtems_interrupt_clear( ctx->test_vector ); + if ( !ctx->attributes.cleared_by_acknowledge ) { + sc = ClearSoftwareInterrupt( ctx->test_vector ); T_rsc_success( sc ); } @@ -544,7 +541,7 @@ static void Action( void *arg ) T_rsc_success( sc ); if ( ctx->status == RTEMS_SUCCESSFUL ) { - sc = rtems_interrupt_raise( ctx->test_vector ); + sc = RaiseSoftwareInterrupt( ctx->test_vector ); T_rsc_success( sc ); } } diff --git a/testsuites/validation/tc-intr-entry-remove.c b/testsuites/validation/tc-intr-entry-remove.c index b6e0207ad3..01a72410e1 100644 --- a/testsuites/validation/tc-intr-entry-remove.c +++ b/testsuites/validation/tc-intr-entry-remove.c @@ -181,7 +181,7 @@ typedef struct { /** * @brief This member provides a counter incremented by EntryRoutine(). */ - uint32_t entry_counter;; + uint32_t entry_counter; /** * @brief This member provides another rtems_interrupt_entry object. @@ -285,7 +285,7 @@ typedef struct { /** * @brief This member specifies if the ``entry`` parameter value. */ - rtems_interrupt_entry *entry;; + rtems_interrupt_entry *entry; /** * @brief This member contains the return value of the diff --git a/testsuites/validation/tc-intr-get-affinity.c b/testsuites/validation/tc-intr-get-affinity.c index 713a5b483f..60509203b4 100644 --- a/testsuites/validation/tc-intr-get-affinity.c +++ b/testsuites/validation/tc-intr-get-affinity.c @@ -138,7 +138,7 @@ typedef struct { * @brief This member provides the object referenced by the ``affinity`` * parameter. */ - cpu_set_t cpuset_obj[ 2 ];; + cpu_set_t cpuset_obj[ 2 ]; /** * @brief This member contains the return value of the diff --git a/testsuites/validation/tc-intr-get-attributes.c b/testsuites/validation/tc-intr-get-attributes.c index 5b8c3fbcac..4594c78a2e 100644 --- a/testsuites/validation/tc-intr-get-attributes.c +++ b/testsuites/validation/tc-intr-get-attributes.c @@ -118,7 +118,7 @@ typedef struct { /** * @brief This member specifies if the ``attributes`` parameter value. */ - rtems_interrupt_attributes *attributes;; + rtems_interrupt_attributes *attributes; /** * @brief This member contains the return value of the diff --git a/testsuites/validation/tc-intr-is-pending.c b/testsuites/validation/tc-intr-is-pending.c index d1b8f73d78..097e3d7a17 100644 --- a/testsuites/validation/tc-intr-is-pending.c +++ b/testsuites/validation/tc-intr-is-pending.c @@ -142,7 +142,7 @@ typedef struct { /** * @brief This member specifies if the ``pending`` parameter value. */ - bool *pending;; + bool *pending; /** * @brief This member contains the return value of the diff --git a/testsuites/validation/tc-intr-vector-is-enabled.c b/testsuites/validation/tc-intr-vector-is-enabled.c index bf7be7ac2c..d24ad3f602 100644 --- a/testsuites/validation/tc-intr-vector-is-enabled.c +++ b/testsuites/validation/tc-intr-vector-is-enabled.c @@ -143,7 +143,7 @@ typedef struct { /** * @brief This member specifies if the ``enabled`` parameter value. */ - bool *enabled;; + bool *enabled; /** * @brief This member contains the return value of the diff --git a/testsuites/validation/tc-message-receive.c b/testsuites/validation/tc-message-receive.c index 1ca7afd221..944512eaa8 100644 --- a/testsuites/validation/tc-message-receive.c +++ b/testsuites/validation/tc-message-receive.c @@ -207,7 +207,7 @@ typedef struct { * * It is used for run-time type checking. */ - uint32_t magic;; + uint32_t magic; /** * @brief This member contains a number which is sent as next message. diff --git a/testsuites/validation/tc-message-urgent-send.c b/testsuites/validation/tc-message-urgent-send.c index 7640137ebb..e7364f108d 100644 --- a/testsuites/validation/tc-message-urgent-send.c +++ b/testsuites/validation/tc-message-urgent-send.c @@ -172,7 +172,7 @@ typedef struct { * * It is used for run-time type checking. */ - uint32_t magic;; + uint32_t magic; /** * @brief This member contains a number which is sent as next message. diff --git a/testsuites/validation/tc-part-performance.c b/testsuites/validation/tc-part-performance.c index 5a5c4841db..858dbc0b4b 100644 --- a/testsuites/validation/tc-part-performance.c +++ b/testsuites/validation/tc-part-performance.c @@ -53,7 +53,6 @@ #endif #include <rtems.h> -#include <rtems/chain.h> #include <rtems/test.h> @@ -143,7 +142,7 @@ static void RtemsPartValPerf_Setup( RtemsPartValPerf_Context *ctx ) void *area; uintptr_t length; - size = sizeof( rtems_chain_node ); + size = 2 * sizeof( uintptr_t ); area = T_malloc( size ); sc = rtems_partition_create( diff --git a/testsuites/validation/tc-sched-smp.c b/testsuites/validation/tc-sched-smp.c index 930ebb048c..3e8e3fe1a2 100644 --- a/testsuites/validation/tc-sched-smp.c +++ b/testsuites/validation/tc-sched-smp.c @@ -284,7 +284,7 @@ typedef struct { /** * @brief If this member is true, then the worker shall be in the busy loop. */ - volatile bool is_busy[ WORKER_COUNT ];; + volatile bool is_busy[ WORKER_COUNT ]; /** * @brief This member contains the per-CPU jobs. @@ -299,7 +299,7 @@ typedef struct { /** * @brief This member contains the call within ISR request. */ - CallWithinISRRequest request;; + CallWithinISRRequest request; } ScoreSchedSmpValSmp_Context; static ScoreSchedSmpValSmp_Context @@ -685,6 +685,7 @@ static void PrepareOwnerScheduled( Context *ctx ) SetScheduler( ctx->worker_id[ WORKER_C ], SCHEDULER_B_ID, PRIO_HIGH ); SetPriority( ctx->worker_id[ WORKER_A ], PRIO_NORMAL ); MakeBusy( ctx, WORKER_C ); + WaitForBusy( ctx, WORKER_C ); MakeBusy( ctx, WORKER_A ); } diff --git a/testsuites/validation/tc-scheduler-add-processor.c b/testsuites/validation/tc-scheduler-add-processor.c index ca86eb4d32..a26132aea0 100644 --- a/testsuites/validation/tc-scheduler-add-processor.c +++ b/testsuites/validation/tc-scheduler-add-processor.c @@ -155,18 +155,18 @@ typedef struct { * @brief This member contains the online status of the processor to add * before the rtems_scheduler_add_processor() call is prepared. */ - bool online;; + bool online; /** * @brief If this member is true, then the processor should be added to the * scheduler B during cleanup. */ - bool add_cpu_to_scheduler_b;; + bool add_cpu_to_scheduler_b; /** * @brief This member provides the scheduler operation records. */ - T_scheduler_log_2 scheduler_log;; + T_scheduler_log_2 scheduler_log; /** * @brief This member contains the return value of the diff --git a/testsuites/validation/tc-scheduler-ident-by-processor.c b/testsuites/validation/tc-scheduler-ident-by-processor.c index 1685725576..8cfe25a70e 100644 --- a/testsuites/validation/tc-scheduler-ident-by-processor.c +++ b/testsuites/validation/tc-scheduler-ident-by-processor.c @@ -246,7 +246,7 @@ static void RtemsSchedulerReqIdentByProcessor_Pre_CPUIndex_Prepare( switch ( state ) { case RtemsSchedulerReqIdentByProcessor_Pre_CPUIndex_Invalid: { /* - * While the ``cpu_index`` parameter greater than or equal to the + * While the ``cpu_index`` parameter is greater than or equal to the * processor maximum. */ ctx->cpu_index = rtems_scheduler_get_processor_maximum(); @@ -255,7 +255,7 @@ static void RtemsSchedulerReqIdentByProcessor_Pre_CPUIndex_Prepare( case RtemsSchedulerReqIdentByProcessor_Pre_CPUIndex_Valid: { /* - * While the ``cpu_index`` parameter less than the processor maximum. + * While the ``cpu_index`` parameter is less than the processor maximum. */ if ( ctx->cpu_has_scheduler ) { ctx->cpu_index = 0; diff --git a/testsuites/validation/tc-scheduler-remove-processor.c b/testsuites/validation/tc-scheduler-remove-processor.c index 8af90a99d9..f199389a33 100644 --- a/testsuites/validation/tc-scheduler-remove-processor.c +++ b/testsuites/validation/tc-scheduler-remove-processor.c @@ -177,12 +177,12 @@ typedef struct { /** * @brief This member contains the worker busy status. */ - volatile bool busy[ WORKER_COUNT ];; + volatile bool busy[ WORKER_COUNT ]; /** * @brief This member contains the worker busy status. */ - volatile uint32_t busy_counter[ WORKER_COUNT ];; + volatile uint32_t busy_counter[ WORKER_COUNT ]; /** * @brief This member contains the barrier to synchronize the runner and the @@ -193,7 +193,7 @@ typedef struct { /** * @brief This member contains the call within ISR request. */ - CallWithinISRRequest request;; + CallWithinISRRequest request; /** * @brief This member provides the context to wrap thread queue operations. @@ -246,7 +246,7 @@ typedef struct { /** * @brief This member provides the scheduler operation records. */ - T_scheduler_log_4 scheduler_log;; + T_scheduler_log_4 scheduler_log; /** * @brief This member contains the return value of the diff --git a/testsuites/validation/tc-score-fatal.c b/testsuites/validation/tc-score-fatal.c index dd61a87d80..b0a55f4664 100644 --- a/testsuites/validation/tc-score-fatal.c +++ b/testsuites/validation/tc-score-fatal.c @@ -7,7 +7,7 @@ */ /* - * Copyright (C) 2021 embedded brains GmbH & Co. KG + * Copyright (C) 2021, 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 @@ -74,14 +74,21 @@ * This test case performs the following actions: * * - Construct a task with a task body which returns. Check that the right - * fatal error occurs. + * fatal error occurred. * - * - 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 maskable + * interrupts disabled. Where robust thread dispatching is required, check + * that the right fatal error occurred, otherwise check that no fatal error + * occurred. + * + * - Construct a task which performs an on demand thread dispatch with maskable + * interrupts disabled. Where robust thread dispatching is required, check + * that the right fatal error occurred, otherwise check that no fatal error + * occurred. * * - 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. + * dispatch level not equal to one. Check that the right fatal error + * occurred. * * - Create a mutex and construct a task which produces a deadlock which * involves the allocator mutex. @@ -164,10 +171,11 @@ static void FatalBadThreadDispatchEnvironment( { Fatal( source, code, arg ); _ISR_Set_level( 0 ); - _Thread_Dispatch_direct_no_return( _Per_CPU_Get() ); + _Thread_Dispatch_unnest( _Per_CPU_Get() ); + rtems_task_exit(); } -static void ISRDisabledThreadDispatchTask( rtems_task_argument arg ) +static void ISRDisabledDirectThreadDispatchTask( rtems_task_argument arg ) { rtems_interrupt_level level; @@ -177,6 +185,16 @@ static void ISRDisabledThreadDispatchTask( rtems_task_argument arg ) rtems_task_exit(); } +static void ISRDisabledOnDemandThreadDispatchTask( rtems_task_argument arg ) +{ + rtems_interrupt_level level; + + (void) arg; + rtems_interrupt_local_disable( level ); + (void) level; + SetSelfPriority( PRIO_VERY_HIGH ); +} + static void FatalBadThreadDispatchDisableLevel( rtems_fatal_source source, rtems_fatal_code code, @@ -245,7 +263,7 @@ static T_fixture ScoreValFatal_Fixture = { /** * @brief Construct a task with a task body which returns. Check that the - * right fatal error occurs. + * right fatal error occurred. */ static void ScoreValFatal_Action_0( ScoreValFatal_Context *ctx ) { @@ -265,9 +283,10 @@ static void ScoreValFatal_Action_0( ScoreValFatal_Context *ctx ) } /** - * @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. + * @brief Construct a task which performs a direct thread dispatch with + * maskable interrupts disabled. Where robust thread dispatching is + * required, check that the right fatal error occurred, otherwise check that + * no fatal error occurred. */ static void ScoreValFatal_Action_1( ScoreValFatal_Context *ctx ) { @@ -278,7 +297,40 @@ static void ScoreValFatal_Action_1( ScoreValFatal_Context *ctx ) SetSelfPriority( PRIO_NORMAL ); counter = ResetFatalInfo( ctx ); id = CreateTask( "BENV", PRIO_HIGH ); - StartTask( id, ISRDisabledThreadDispatchTask, NULL ); + StartTask( id, ISRDisabledDirectThreadDispatchTask, NULL ); + + #if CPU_ENABLE_ROBUST_THREAD_DISPATCH == FALSE + if ( rtems_configuration_get_maximum_processors() > 1 ) { + #endif + T_eq_uint( GetFatalCounter( ctx ), counter + 1 ); + T_eq_int( ctx->source, INTERNAL_ERROR_CORE ); + T_eq_ulong( ctx->code, INTERNAL_ERROR_BAD_THREAD_DISPATCH_ENVIRONMENT ); + #if CPU_ENABLE_ROBUST_THREAD_DISPATCH == FALSE + } else { + T_eq_uint( GetFatalCounter( ctx ), counter ); + } + #endif + + RestoreRunnerPriority(); + SetFatalHandler( NULL, NULL ); +} + +/** + * @brief Construct a task which performs an on demand thread dispatch with + * maskable interrupts disabled. Where robust thread dispatching is + * required, check that the right fatal error occurred, otherwise check that + * no fatal error occurred. + */ +static void ScoreValFatal_Action_2( ScoreValFatal_Context *ctx ) +{ + rtems_id id; + unsigned int counter; + + SetFatalHandler( FatalBadThreadDispatchEnvironment, ctx ); + SetSelfPriority( PRIO_NORMAL ); + counter = ResetFatalInfo( ctx ); + id = CreateTask( "BENV", PRIO_HIGH ); + StartTask( id, ISRDisabledOnDemandThreadDispatchTask, NULL ); #if CPU_ENABLE_ROBUST_THREAD_DISPATCH == FALSE if ( rtems_configuration_get_maximum_processors() > 1 ) { @@ -299,9 +351,9 @@ static void ScoreValFatal_Action_1( ScoreValFatal_Context *ctx ) /** * @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. + * occurred. */ -static void ScoreValFatal_Action_2( ScoreValFatal_Context *ctx ) +static void ScoreValFatal_Action_3( ScoreValFatal_Context *ctx ) { rtems_id id; unsigned int counter; @@ -322,7 +374,7 @@ static void ScoreValFatal_Action_2( ScoreValFatal_Context *ctx ) * @brief Create a mutex and construct a task which produces a deadlock which * involves the allocator mutex. */ -static void ScoreValFatal_Action_3( ScoreValFatal_Context *ctx ) +static void ScoreValFatal_Action_4( ScoreValFatal_Context *ctx ) { rtems_extensions_table extensions; rtems_status_code sc; @@ -374,7 +426,7 @@ static void ScoreValFatal_Action_3( ScoreValFatal_Context *ctx ) * SetFatalHandler() requires an initial extension this validates * CONFIGURE_INITIAL_EXTENSIONS. */ -static void ScoreValFatal_Action_4( ScoreValFatal_Context *ctx ) +static void ScoreValFatal_Action_5( ScoreValFatal_Context *ctx ) { unsigned int counter; @@ -404,6 +456,7 @@ T_TEST_CASE_FIXTURE( ScoreValFatal, &ScoreValFatal_Fixture ) ScoreValFatal_Action_2( ctx ); ScoreValFatal_Action_3( ctx ); ScoreValFatal_Action_4( ctx ); + ScoreValFatal_Action_5( ctx ); } /** @} */ diff --git a/testsuites/validation/tc-score-isr.c b/testsuites/validation/tc-score-isr.c new file mode 100644 index 0000000000..b178541e72 --- /dev/null +++ b/testsuites/validation/tc-score-isr.c @@ -0,0 +1,285 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup ScoreIsrValIsr + */ + +/* + * Copyright (C) 2023 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/sysinit.h> +#include <rtems/score/percpu.h> +#include <rtems/score/thread.h> + +#include "tx-support.h" + +#include <rtems/test.h> + +/** + * @defgroup ScoreIsrValIsr spec:/score/isr/val/isr + * + * @ingroup TestsuitesValidationIntr + * + * @brief Tests general interrupt support behaviour. + * + * This test case performs the following actions: + * + * - Submit an ISR request during system initialization. Check the stack of + * the interrupted context while the ISR request is serviced. Store the + * result of the check in interrupted_stack_at_multitasking_start_is_valid. + * + * - Check that stack of the interrupted context was valid when an interrupt + * was serviced during the multitasking start. + * + * @{ + */ + +static uintptr_t interrupted_stack_at_multitasking_start; + +static bool interrupted_stack_at_multitasking_start_is_valid; + +#if defined(__aarch64__) +void __real_bsp_interrupt_dispatch( void ); + +void __wrap_bsp_interrupt_dispatch( void ); + +void __wrap_bsp_interrupt_dispatch( void ) +{ + if ( interrupted_stack_at_multitasking_start == 0 ) { + uintptr_t sp; + rtems_interrupt_level level; + + rtems_interrupt_local_disable( level ); + __asm__ volatile ( + "msr spsel, #1\n" + "mov %0, sp\n" + "msr spsel, #0" + : "=r" ( sp ) + ); + rtems_interrupt_local_enable( level ); + + interrupted_stack_at_multitasking_start = sp; + } + + __real_bsp_interrupt_dispatch(); +} +#endif + +#if defined(ARM_MULTILIB_ARCH_V4) +void __real_bsp_interrupt_dispatch( void ); + +void __wrap_bsp_interrupt_dispatch( void ); + +void __wrap_bsp_interrupt_dispatch( void ) +{ + register uintptr_t sp __asm__( "9" ); + + if ( interrupted_stack_at_multitasking_start == 0 ) { + interrupted_stack_at_multitasking_start = sp; + } + + __real_bsp_interrupt_dispatch(); +} +#endif + +#if defined(__microblaze__) +void __real_bsp_interrupt_dispatch( uint32_t source ); + +void __wrap_bsp_interrupt_dispatch( uint32_t source ); + +void __wrap_bsp_interrupt_dispatch( uint32_t source ) +{ + register uintptr_t sp __asm__( "1" ); + + if ( interrupted_stack_at_multitasking_start == 0 ) { + interrupted_stack_at_multitasking_start = sp; + } + + __real_bsp_interrupt_dispatch( source ); +} +#endif + +#if defined(__PPC__) || defined(__powerpc64__) +void __real_bsp_interrupt_dispatch( void ); + +void __wrap_bsp_interrupt_dispatch( void ); + +void __wrap_bsp_interrupt_dispatch( void ) +{ + register uintptr_t sp __asm__( "14" ); + + if ( interrupted_stack_at_multitasking_start == 0 ) { + interrupted_stack_at_multitasking_start = sp; + } + + __real_bsp_interrupt_dispatch(); +} +#endif + +#if defined(__riscv) +void __real__RISCV_Interrupt_dispatch( + uintptr_t mcause, + Per_CPU_Control *cpu_self +); + +void __wrap__RISCV_Interrupt_dispatch( + uintptr_t mcause, + Per_CPU_Control *cpu_self +); + +void __wrap__RISCV_Interrupt_dispatch( + uintptr_t mcause, + Per_CPU_Control *cpu_self +) +{ + register uintptr_t sp __asm__( "s1" ); + + if ( interrupted_stack_at_multitasking_start == 0 ) { + interrupted_stack_at_multitasking_start = sp; + } + + __real__RISCV_Interrupt_dispatch( mcause, cpu_self ); +} +#endif + +#if defined(__sparc__) +void __real__SPARC_Interrupt_dispatch( uint32_t irq ); + +static RTEMS_USED void InterruptDispatch( uint32_t irq, uintptr_t sp ) +{ + if ( interrupted_stack_at_multitasking_start == 0 ) { + interrupted_stack_at_multitasking_start = sp; + } + + __real__SPARC_Interrupt_dispatch( irq ); +} + +__asm__ ( + "\t.section\t\".text\"\n" + "\t.align\t4\n" + "\t.globl\t__wrap__SPARC_Interrupt_dispatch\n" + "\t.type\t__wrap__SPARC_Interrupt_dispatch, #function\n" + "__wrap__SPARC_Interrupt_dispatch:\n" + "\tmov\t%fp, %o1\n" + "\tor\t%o7, %g0, %g1\n" + "\tcall\tInterruptDispatch, 0\n" + "\t or\t%g1, %g0, %o7\n" + "\t.previous\n" +); +#endif + +static void ISRHandler( void *arg ) +{ + uintptr_t begin; + uintptr_t end; + + (void) arg; + +#if defined(RTEMS_SMP) && !(defined(__PPC__) || (__powerpc64__)) + Per_CPU_Control *cpu_self; + + cpu_self = _Per_CPU_Get(); + begin = (uintptr_t) &cpu_self->Interrupt_frame; + end = begin + sizeof( cpu_self->Interrupt_frame ); +#else + Thread_Control *executing; + + executing = GetExecuting(); + begin = (uintptr_t) executing->Start.Initial_stack.area; + end = begin + executing->Start.Initial_stack.size; +#endif + + interrupted_stack_at_multitasking_start_is_valid = + ( begin <= interrupted_stack_at_multitasking_start && + interrupted_stack_at_multitasking_start < end ); +} + +static CallWithinISRRequest isr_request = { + .handler = ISRHandler +}; + +static void SubmitISRRequest( void ) +{ + CallWithinISRSubmit( &isr_request ); +} + +RTEMS_SYSINIT_ITEM( + SubmitISRRequest, + RTEMS_SYSINIT_DEVICE_DRIVERS, + RTEMS_SYSINIT_ORDER_LAST +); + +/** + * @brief Submit an ISR request during system initialization. Check the stack + * of the interrupted context while the ISR request is serviced. Store the + * result of the check in interrupted_stack_at_multitasking_start_is_valid. + */ +static void ScoreIsrValIsr_Action_0( void ) +{ + /* + * The actions are performed during system initialization and the + * multitasking start. + */ + + /* + * Check that stack of the interrupted context was valid when an interrupt + * was serviced during the multitasking start. + */ + T_true( interrupted_stack_at_multitasking_start_is_valid ); +} + +/** + * @fn void T_case_body_ScoreIsrValIsr( void ) + */ +T_TEST_CASE( ScoreIsrValIsr ) +{ + ScoreIsrValIsr_Action_0(); +} + +/** @} */ diff --git a/testsuites/validation/tc-score-thread.c b/testsuites/validation/tc-score-thread.c index 764a04cd4b..e065905641 100644 --- a/testsuites/validation/tc-score-thread.c +++ b/testsuites/validation/tc-score-thread.c @@ -7,7 +7,7 @@ */ /* - * Copyright (C) 2021 embedded brains GmbH & Co. KG + * Copyright (C) 2021, 2023 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -104,6 +104,13 @@ * * - Check that the global constructor was called before the task entry. * + * - Validate that thread dispatching does not recurse. Issue a couple of + * thread context switches during a thread dispatch. Record the stack + * pointers of the heir threads. + * + * - Check that the thread dispatching did not recurse through the recorded + * stack pointers. + * * @{ */ @@ -125,6 +132,21 @@ typedef struct { * @brief This member contains a floating-point object. */ volatile double fp_obj; + + /** + * @brief This member indicates the thread switch state. + */ + int thread_switch_state; + + /** + * @brief This member contain the runner stack pointer at the context switch. + */ + uintptr_t runner_stack[ 2 ]; + + /** + * @brief This member contain the worker stack pointer at the context switch. + */ + uintptr_t worker_stack[ 2 ]; } ScoreThreadValThread_Context; static ScoreThreadValThread_Context @@ -195,6 +217,44 @@ static void KillerTask( rtems_task_argument arg ) DeleteTask( ctx->worker_id ); } +static void TaskSwitch( rtems_tcb *executing, rtems_tcb *heir ) +{ + Context *ctx; + rtems_id worker_id; + int state; + uintptr_t heir_stack; + + ctx = T_fixture_context(); + worker_id = ctx->worker_id; + state = ctx->thread_switch_state; + ctx->thread_switch_state = state + 1; + heir_stack = _CPU_Context_Get_SP( &heir->Registers ); + + switch ( state ) { + case 0: + T_eq_u32( heir->Object.id, worker_id ); + SuspendTask( worker_id ); + ctx->worker_stack[ 0 ] = heir_stack; + break; + case 1: + T_eq_u32( executing->Object.id, worker_id ); + ResumeTask( worker_id ); + ctx->runner_stack[ 0 ] = heir_stack; + break; + case 2: + T_eq_u32( heir->Object.id, worker_id ); + SuspendTask( worker_id ); + ctx->worker_stack[ 1 ] = heir_stack; + break; + case 3: + T_eq_u32( executing->Object.id, worker_id ); + ctx->runner_stack[ 1 ] = heir_stack; + break; + default: + T_unreachable(); + } +} + static T_fixture ScoreThreadValThread_Fixture = { .setup = NULL, .stop = NULL, @@ -338,6 +398,37 @@ static void ScoreThreadValThread_Action_2( ScoreThreadValThread_Context *ctx ) } /** + * @brief Validate that thread dispatching does not recurse. Issue a couple of + * thread context switches during a thread dispatch. Record the stack + * pointers of the heir threads. + */ +static void ScoreThreadValThread_Action_3( ScoreThreadValThread_Context *ctx ) +{ + SetSelfPriority( PRIO_NORMAL ); + ctx->worker_id = CreateTask( "WORK", PRIO_HIGH ); + StartTask( ctx->worker_id, WorkerTask, NULL ); + + ctx->thread_switch_state = 0; + ctx->runner_stack[ 0 ] = 0; + ctx->runner_stack[ 1 ] = 1; + ctx->worker_stack[ 0 ] = 0; + ctx->worker_stack[ 1 ] = 1; + SetTaskSwitchExtension( TaskSwitch ); + ResumeTask( ctx->worker_id ); + + SetTaskSwitchExtension( NULL ); + DeleteTask( ctx->worker_id ); + RestoreRunnerPriority(); + + /* + * Check that the thread dispatching did not recurse through the recorded + * stack pointers. + */ + T_eq_uptr( ctx->runner_stack[ 0 ], ctx->runner_stack[ 1 ] ); + T_eq_uptr( ctx->worker_stack[ 0 ], ctx->worker_stack[ 1 ] ); +} + +/** * @fn void T_case_body_ScoreThreadValThread( void ) */ T_TEST_CASE_FIXTURE( ScoreThreadValThread, &ScoreThreadValThread_Fixture ) @@ -349,6 +440,7 @@ T_TEST_CASE_FIXTURE( ScoreThreadValThread, &ScoreThreadValThread_Fixture ) ScoreThreadValThread_Action_0( ctx ); ScoreThreadValThread_Action_1( ctx ); ScoreThreadValThread_Action_2( ctx ); + ScoreThreadValThread_Action_3( ctx ); } /** @} */ diff --git a/testsuites/validation/tc-sem-create.c b/testsuites/validation/tc-sem-create.c index 3d57fefcc0..9975cb0778 100644 --- a/testsuites/validation/tc-sem-create.c +++ b/testsuites/validation/tc-sem-create.c @@ -224,15 +224,15 @@ typedef struct { rtems_status_code status; - Semaphore_Variant variant;; + Semaphore_Variant variant; - Semaphore_Discipline discipline;; + Semaphore_Discipline discipline; - uint32_t sem_count;; + uint32_t sem_count; - Thread_Control *executing;; + Thread_Control *executing; - Thread_Control *owner;; + Thread_Control *owner; rtems_name name; diff --git a/testsuites/validation/tc-sem-flush.c b/testsuites/validation/tc-sem-flush.c index da4ffb2940..4fb2027354 100644 --- a/testsuites/validation/tc-sem-flush.c +++ b/testsuites/validation/tc-sem-flush.c @@ -118,7 +118,7 @@ typedef struct { /** * @brief This member contains the thread queue test context. */ - TQContext tq_ctx;; + TQContext tq_ctx; /** * @brief This member specifies if the attribute set of the semaphore. @@ -498,7 +498,9 @@ static void RtemsSemReqFlush_Action( RtemsSemReqFlush_Context *ctx ) static void RtemsSemReqFlush_Cleanup( RtemsSemReqFlush_Context *ctx ) { rtems_status_code sc; - sc = rtems_semaphore_delete( ctx->tq_ctx.thread_queue_id ); T_rsc_success( sc ); + + sc = rtems_semaphore_delete( ctx->tq_ctx.thread_queue_id ); + T_rsc_success( sc ); } static const RtemsSemReqFlush_Entry diff --git a/testsuites/validation/tc-sem-obtain.c b/testsuites/validation/tc-sem-obtain.c index 3370a57604..10c4475d8c 100644 --- a/testsuites/validation/tc-sem-obtain.c +++ b/testsuites/validation/tc-sem-obtain.c @@ -499,11 +499,15 @@ static void RtemsSemReqObtain_Post_Action_Check( * spec:/score/mtx/req/seize-try where an enqueue is sticky, a recursive * seize returns an error status, and a priority ceiling is used. */ + #if defined(RTEMS_SMP) ctx->tq_mtx_ctx.base.enqueue_variant = TQ_ENQUEUE_STICKY; ctx->tq_mtx_ctx.protocol = TQ_MTX_MRSP; ctx->tq_mtx_ctx.recursive = TQ_MTX_RECURSIVE_DEADLOCK; ctx->tq_mtx_ctx.priority_ceiling = PRIO_VERY_HIGH; ScoreMtxReqSeizeTry_Run( &ctx->tq_mtx_ctx ); + #else + T_unreachable(); + #endif break; } @@ -513,11 +517,15 @@ static void RtemsSemReqObtain_Post_Action_Check( * spec:/score/mtx/req/seize-wait where an enqueue is sticky, a recursive * seize returns an error status, and a priority ceiling is used. */ + #if defined(RTEMS_SMP) ctx->tq_mtx_ctx.base.enqueue_variant = TQ_ENQUEUE_STICKY; ctx->tq_mtx_ctx.protocol = TQ_MTX_MRSP; ctx->tq_mtx_ctx.recursive = TQ_MTX_RECURSIVE_DEADLOCK; ctx->tq_mtx_ctx.priority_ceiling = PRIO_VERY_HIGH; ScoreMtxReqSeizeWait_Run( &ctx->tq_mtx_ctx ); + #else + T_unreachable(); + #endif break; } @@ -580,6 +588,7 @@ static void RtemsSemReqObtain_Action( RtemsSemReqObtain_Context *ctx ) ); T_rsc_success( sc ); + #if defined(RTEMS_SMP) if ( ( ctx->attribute_set & RTEMS_MULTIPROCESSOR_RESOURCE_SHARING ) != 0 ) { rtems_task_priority prio; @@ -591,6 +600,7 @@ static void RtemsSemReqObtain_Action( RtemsSemReqObtain_Context *ctx ) ); T_rsc_success( sc ); } + #endif } static void RtemsSemReqObtain_Cleanup( RtemsSemReqObtain_Context *ctx ) @@ -606,33 +616,28 @@ RtemsSemReqObtain_Entries[] = { { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_SemSeizeWait }, { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_SemSeizeTry }, { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_MtxSeizeWait }, -#if defined(RTEMS_SMP) - { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_InvId }, -#else - { 1, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_NA }, -#endif { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_MtxSeizeTry }, { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_CeilingMtxSeizeWait }, { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_InheritMtxSeizeWait }, #if defined(RTEMS_SMP) { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_MrsPMtxSeizeWait }, #else - { 1, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_NA }, + { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_CeilingMtxSeizeWait }, #endif { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_CeilingMtxSeizeTry }, { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_InheritMtxSeizeTry }, #if defined(RTEMS_SMP) { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_MrsPMtxSeizeTry } #else - { 1, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_NA } + { 0, 0, 0, 0, 0, RtemsSemReqObtain_Post_Action_CeilingMtxSeizeTry } #endif }; static const uint8_t RtemsSemReqObtain_Map[] = { - 3, 2, 2, 0, 0, 0, 3, 2, 2, 0, 0, 0, 3, 2, 2, 0, 0, 0, 3, 2, 2, 0, 0, 0, 6, 4, - 4, 0, 0, 0, 6, 4, 4, 0, 0, 0, 1, 1, 1, 1, 1, 1, 10, 7, 7, 0, 0, 0, 1, 1, 1, - 1, 1, 1, 11, 8, 8, 0, 0, 0, 1, 1, 1, 1, 1, 1, 12, 9, 9, 5, 5, 5 + 3, 2, 2, 0, 0, 0, 3, 2, 2, 0, 0, 0, 3, 2, 2, 0, 0, 0, 3, 2, 2, 0, 0, 0, 5, 4, + 4, 0, 0, 0, 5, 4, 4, 0, 0, 0, 1, 1, 1, 1, 1, 1, 9, 6, 6, 0, 0, 0, 1, 1, 1, 1, + 1, 1, 10, 7, 7, 0, 0, 0, 1, 1, 1, 1, 1, 1, 11, 8, 8, 0, 0, 0 }; static size_t RtemsSemReqObtain_Scope( void *arg, char *buf, size_t n ) diff --git a/testsuites/validation/tc-sem-performance.c b/testsuites/validation/tc-sem-performance.c index 0014306ddb..5861e3ee8e 100644 --- a/testsuites/validation/tc-sem-performance.c +++ b/testsuites/validation/tc-sem-performance.c @@ -382,9 +382,10 @@ static void RtemsSemReqPerfMtxPiReleaseOne_Setup( RtemsSemValPerf_Context *ctx ) { + SetSelfPriority( PRIO_HIGH ); ObtainMutex( ctx->mutex_id ); Send( ctx, EVENT_OBTAIN ); - SetPriority( ctx->worker_id, PRIO_LOW ); + Yield(); Send( ctx, EVENT_RELEASE ); } @@ -401,6 +402,11 @@ static void RtemsSemReqPerfMtxPiReleaseOne_Setup_Wrap( void *arg ) */ static void RtemsSemReqPerfMtxPiReleaseOne_Body( RtemsSemValPerf_Context *ctx ) { + /* + * The release will unblock the worker task which has our priority. The + * scheduler ensures FIFO ordering for ready threads of the same priority, so + * the release will not preempt us. + */ ctx->status = rtems_semaphore_release( ctx->mutex_id ); } @@ -426,7 +432,7 @@ static bool RtemsSemReqPerfMtxPiReleaseOne_Teardown( { T_quiet_rsc( ctx->status, RTEMS_SUCCESSFUL ); - SetPriority( ctx->worker_id, PRIO_HIGH ); + SetSelfPriority( PRIO_NORMAL ); return tic == toc; } @@ -734,7 +740,7 @@ static void RtemsSemReqPerfMtxPiWaitForever_Setup( ) { Send( ctx, EVENT_OBTAIN ); - SetPriority( ctx->worker_id, PRIO_LOW ); + SetSelfPriority( PRIO_VERY_HIGH ); Send( ctx, EVENT_END | EVENT_RELEASE ); } @@ -784,8 +790,8 @@ static bool RtemsSemReqPerfMtxPiWaitForever_Teardown( T_quiet_rsc( ctx->status, RTEMS_SUCCESSFUL ); *delta = ctx->end - ctx->begin; - SetPriority( ctx->worker_id, PRIO_HIGH ); ReleaseMutex( ctx->mutex_id ); + SetSelfPriority( PRIO_NORMAL ); return tic == toc; } @@ -825,7 +831,7 @@ static bool RtemsSemReqPerfMtxPiWaitForever_Teardown_Wrap( static void RtemsSemReqPerfMtxPiWaitTimed_Setup( RtemsSemValPerf_Context *ctx ) { Send( ctx, EVENT_OBTAIN ); - SetPriority( ctx->worker_id, PRIO_LOW ); + SetSelfPriority( PRIO_VERY_HIGH ); Send( ctx, EVENT_END | EVENT_RELEASE ); } @@ -873,8 +879,8 @@ static bool RtemsSemReqPerfMtxPiWaitTimed_Teardown( T_quiet_rsc( ctx->status, RTEMS_SUCCESSFUL ); *delta = ctx->end - ctx->begin; - SetPriority( ctx->worker_id, PRIO_HIGH ); ReleaseMutex( ctx->mutex_id ); + SetSelfPriority( PRIO_NORMAL ); return tic == toc; } diff --git a/testsuites/validation/tc-sem-smp.c b/testsuites/validation/tc-sem-smp.c index aa0c7dda0d..5dc3f437a1 100644 --- a/testsuites/validation/tc-sem-smp.c +++ b/testsuites/validation/tc-sem-smp.c @@ -123,12 +123,12 @@ typedef struct { /** * @brief This member contains the mutex identifier. */ - rtems_id mutex_id;; + rtems_id mutex_id; /** * @brief This member contains the second mutex identifier. */ - rtems_id mutex_2_id;; + rtems_id mutex_2_id; /** * @brief If this member is true, then the worker is done. diff --git a/testsuites/validation/tc-sem-timeout.c b/testsuites/validation/tc-sem-timeout.c index bdf46fe6de..a150d067d2 100644 --- a/testsuites/validation/tc-sem-timeout.c +++ b/testsuites/validation/tc-sem-timeout.c @@ -55,7 +55,6 @@ #include <rtems.h> #include <string.h> -#include "tr-tq-timeout-mrsp.h" #include "tr-tq-timeout-priority-inherit.h" #include "tr-tq-timeout.h" #include "tx-support.h" @@ -108,7 +107,7 @@ typedef struct { /** * @brief This member contains the thread queue test context. */ - TQContext tq_ctx;; + TQContext tq_ctx; /** * @brief This member specifies if the attribute set of the semaphore. @@ -169,6 +168,10 @@ static const char * const * const RtemsSemReqTimeout_PreDesc[] = { NULL }; +#if defined(RTEMS_SMP) +#include "tr-tq-timeout-mrsp.h" +#endif + static void RtemsSemReqTimeout_Pre_Class_Prepare( RtemsSemReqTimeout_Context *ctx, RtemsSemReqTimeout_Pre_Class state @@ -226,7 +229,11 @@ static void RtemsSemReqTimeout_Pre_Class_Prepare( */ ctx->attribute_set |= RTEMS_BINARY_SEMAPHORE | RTEMS_MULTIPROCESSOR_RESOURCE_SHARING; + #if defined(RTEMS_SMP) ctx->tq_ctx.enqueue_variant = TQ_ENQUEUE_STICKY; + #else + ctx->tq_ctx.enqueue_variant = TQ_ENQUEUE_BLOCKS; + #endif break; } @@ -285,8 +292,12 @@ static void RtemsSemReqTimeout_Post_Action_Check( * The semaphore obtain timeout actions shall be done as specified by * spec:/score/tq/req/timeout-mrsp. */ + #if defined(RTEMS_SMP) ctx->tq_ctx.wait = TQ_WAIT_TIMED; ScoreTqReqTimeoutMrsp_Run( &ctx->tq_ctx ); + #else + T_unreachable(); + #endif break; } @@ -361,8 +372,12 @@ static void RtemsSemReqTimeout_Action( RtemsSemReqTimeout_Context *ctx ) static void RtemsSemReqTimeout_Cleanup( RtemsSemReqTimeout_Context *ctx ) { - if ( ctx->tq_ctx.thread_queue_id != 0 ) { rtems_status_code sc; - sc = rtems_semaphore_delete( ctx->tq_ctx.thread_queue_id ); T_rsc_success( sc ); } + if ( ctx->tq_ctx.thread_queue_id != 0 ) { + rtems_status_code sc; + + sc = rtems_semaphore_delete( ctx->tq_ctx.thread_queue_id ); + T_rsc_success( sc ); + } } static const RtemsSemReqTimeout_Entry @@ -370,10 +385,10 @@ RtemsSemReqTimeout_Entries[] = { { 0, 0, 0, RtemsSemReqTimeout_Post_Action_Timeout }, { 1, 0, 0, RtemsSemReqTimeout_Post_Action_NA }, { 0, 0, 0, RtemsSemReqTimeout_Post_Action_TimeoutPriorityInherit }, -#if !defined(RTEMS_SMP) - { 1, 0, 0, RtemsSemReqTimeout_Post_Action_NA } -#else +#if defined(RTEMS_SMP) { 0, 0, 0, RtemsSemReqTimeout_Post_Action_TimeoutMrsP } +#else + { 0, 0, 0, RtemsSemReqTimeout_Post_Action_Timeout } #endif }; diff --git a/testsuites/validation/tc-signal-send.c b/testsuites/validation/tc-signal-send.c index 82cde6c5cc..aedcec5e47 100644 --- a/testsuites/validation/tc-signal-send.c +++ b/testsuites/validation/tc-signal-send.c @@ -154,9 +154,9 @@ typedef struct { rtems_signal_set processed_signal_sets[ 2 ]; - uintptr_t stack_pointers[ 2 ];; + uintptr_t stack_pointers[ 2 ]; - rtems_mode mode;; + rtems_mode mode; rtems_status_code status; diff --git a/testsuites/validation/tc-task-construct.c b/testsuites/validation/tc-task-construct.c index 8f82db8b54..5a7ca4f497 100644 --- a/testsuites/validation/tc-task-construct.c +++ b/testsuites/validation/tc-task-construct.c @@ -291,7 +291,7 @@ typedef struct { * @brief If this member is true, then the zombie thread is ready to get * killed. */ - volatile bool zombie_ready;; + volatile bool zombie_ready; /** * @brief This member contains the actual modes of the constructed task. diff --git a/testsuites/validation/tc-task-delete.c b/testsuites/validation/tc-task-delete.c index d8d708171b..d917062d0d 100644 --- a/testsuites/validation/tc-task-delete.c +++ b/testsuites/validation/tc-task-delete.c @@ -57,7 +57,6 @@ #include <setjmp.h> #include <rtems/bspIo.h> #include <rtems/test-scheduler.h> -#include <rtems/score/io.h> #include <rtems/score/statesimpl.h> #include <rtems/score/threaddispatch.h> #include <rtems/score/threadimpl.h> @@ -262,7 +261,7 @@ typedef struct { /** * @brief This member provides a jump context to resume a thread dispatch. */ - jmp_buf thread_dispatch_context;; + jmp_buf thread_dispatch_context; /** * @brief This member contains the identifier of the runner scheduler. @@ -310,13 +309,13 @@ typedef struct { * @brief This member contains the worker timer info at the end of the * rtems_task_delete() call. */ - TaskTimerInfo worker_timer_info;; + TaskTimerInfo worker_timer_info; /** * @brief This member contains the worker thread queue at the end of the * rtems_task_delete() call. */ - const Thread_queue_Queue *worker_wait_queue;; + const Thread_queue_Queue *worker_wait_queue; /** * @brief This member contains the worker thread life state at the end of the @@ -358,13 +357,13 @@ typedef struct { /** * @brief This member contains extension calls. */ - ExtensionCalls calls;; + ExtensionCalls calls; /** * @brief This member contains extension calls after the rtems_task_delete() * call. */ - ExtensionCalls calls_after_restart;; + ExtensionCalls calls_after_restart; /** * @brief This member contains the delete counter. diff --git a/testsuites/validation/tc-task-restart.c b/testsuites/validation/tc-task-restart.c index e62dbbb567..c915f01a49 100644 --- a/testsuites/validation/tc-task-restart.c +++ b/testsuites/validation/tc-task-restart.c @@ -251,7 +251,7 @@ typedef struct { /** * @brief This member provides a jump context to resume a thread dispatch. */ - jmp_buf thread_dispatch_context;; + jmp_buf thread_dispatch_context; /** * @brief This member provides the context to wrap thread queue operations. @@ -319,13 +319,13 @@ typedef struct { /** * @brief This member contains extension calls. */ - ExtensionCalls calls;; + ExtensionCalls calls; /** * @brief This member contains extension calls after the rtems_task_restart() * call. */ - ExtensionCalls calls_after_restart;; + ExtensionCalls calls_after_restart; /** * @brief This member contains the actual argument passed to the entry point. diff --git a/testsuites/validation/tc-task-set-affinity.c b/testsuites/validation/tc-task-set-affinity.c index 5f11b0250c..9502d009e1 100644 --- a/testsuites/validation/tc-task-set-affinity.c +++ b/testsuites/validation/tc-task-set-affinity.c @@ -131,7 +131,7 @@ typedef struct { /** * @brief This member provides the scheduler operation records. */ - T_scheduler_log_2 scheduler_log;; + T_scheduler_log_2 scheduler_log; /** * @brief This member provides the object referenced by the ``cpuset`` diff --git a/testsuites/validation/tc-task-set-scheduler.c b/testsuites/validation/tc-task-set-scheduler.c index eef4295a73..174aa55736 100644 --- a/testsuites/validation/tc-task-set-scheduler.c +++ b/testsuites/validation/tc-task-set-scheduler.c @@ -266,7 +266,7 @@ typedef struct { /** * @brief This member contains the identifier of the new scheduler. */ - rtems_id new_scheduler;; + rtems_id new_scheduler; /** * @brief This member contains the new priorities of the task. diff --git a/testsuites/validation/tc-task-wake-after.c b/testsuites/validation/tc-task-wake-after.c index b600644efe..ba12d21c85 100644 --- a/testsuites/validation/tc-task-wake-after.c +++ b/testsuites/validation/tc-task-wake-after.c @@ -122,29 +122,29 @@ typedef struct { /** * @brief This member provides the scheduler operation records. */ - T_scheduler_log_4 scheduler_log;; + T_scheduler_log_4 scheduler_log; /** * @brief This member contains the clock tick value before the * rtems_task_wake_after() call. */ - uint64_t now;; + uint64_t now; /** * @brief This member contains the worker task identifier. */ - rtems_id worker_id;; + rtems_id worker_id; /** * @brief If this member is true, then the worker shall be suspended during * the rtems_task_wake_after() call. */ - bool suspended;; + bool suspended; /** * @brief This member contains the timer information of the worker task. */ - TaskTimerInfo timer_info;; + TaskTimerInfo timer_info; /** * @brief This member contains the return value of the diff --git a/testsuites/validation/tc-task-wake-when.c b/testsuites/validation/tc-task-wake-when.c index cd95555adc..bb31fded26 100644 --- a/testsuites/validation/tc-task-wake-when.c +++ b/testsuites/validation/tc-task-wake-when.c @@ -131,23 +131,23 @@ typedef struct { /** * @brief This member provides the scheduler operation records. */ - T_scheduler_log_4 scheduler_log;; + T_scheduler_log_4 scheduler_log; /** * @brief This member contains the CLOCK_REALTIME value before the * rtems_task_wake_when() call. */ - struct timespec now;; + struct timespec now; /** * @brief This member contains the worker task identifier. */ - rtems_id worker_id;; + rtems_id worker_id; /** * @brief This member contains the timer information of the worker task. */ - TaskTimerInfo timer_info;; + TaskTimerInfo timer_info; /** * @brief This member provides the object referenced by the ``time_buffer`` diff --git a/testsuites/validation/tc-task.c b/testsuites/validation/tc-task.c index ce1c5ffd8b..5ab96445ed 100644 --- a/testsuites/validation/tc-task.c +++ b/testsuites/validation/tc-task.c @@ -303,7 +303,7 @@ static void RtemsTaskValTask_Action_8( void ) static void RtemsTaskValTask_Action_9( void ) { rtems_status_code sc; - rtems_status_code id; + rtems_id id; /* * Create a task. Check that the home scheduler of the created task is diff --git a/testsuites/validation/tc-terminate.c b/testsuites/validation/tc-terminate.c index 3ea314efc3..b533092c19 100644 --- a/testsuites/validation/tc-terminate.c +++ b/testsuites/validation/tc-terminate.c @@ -58,7 +58,6 @@ #include <rtems/bspIo.h> #include <rtems/test-info.h> #include <rtems/score/atomic.h> -#include <rtems/score/io.h> #include <rtems/score/percpu.h> #include <rtems/score/sysstate.h> diff --git a/testsuites/validation/tc-thread-idle-body-no-return.c b/testsuites/validation/tc-thread-idle-body-no-return.c index 303f80faf9..19c86dad99 100644 --- a/testsuites/validation/tc-thread-idle-body-no-return.c +++ b/testsuites/validation/tc-thread-idle-body-no-return.c @@ -90,7 +90,7 @@ typedef struct { /** * @brief This member contains a counter. */ - uint32_t counter;; + uint32_t counter; } ScoreThreadValIdleBodyNoReturn_Context; static ScoreThreadValIdleBodyNoReturn_Context @@ -100,19 +100,30 @@ typedef ScoreThreadValIdleBodyNoReturn_Context Context; static void CheckIdleBody( Context *ctx, rtems_task_entry entry ) { - rtems_id id; + rtems_id id; + rtems_interval interval; + rtems_status_code sc; ctx->counter = 0; id = CreateTask( "WORK", PRIO_LOW ); StartTask( id, entry, ctx ); - while ( ctx->counter == 0 ) { - rtems_status_code sc; + /* + * With optimization disabled, coverage enabled, SMP enabled and a slow + * target, things may take some time. + */ + interval = 1; + while ( ctx->counter == 0 && interval <= 1024 ) { - sc = rtems_task_wake_after( 1 ); + sc = rtems_task_wake_after( interval ); T_rsc_success( sc ); + + interval *= 2; } + sc = rtems_task_wake_after( interval ); + T_rsc_success( sc ); + T_eq_u32( ctx->counter, 1 ); DeleteTask( id ); } diff --git a/testsuites/validation/tc-timer-reset.c b/testsuites/validation/tc-timer-reset.c index d720b83073..709b9fe8a5 100644 --- a/testsuites/validation/tc-timer-reset.c +++ b/testsuites/validation/tc-timer-reset.c @@ -225,7 +225,7 @@ typedef struct { * @brief This member contains a reference to the user data to be used in the * next call to the Timer Service Routine. */ - void **scheduled_user_data;; + void **scheduled_user_data; /** * @brief This member contains 1 if the Timer Service Routine "A" has been diff --git a/testsuites/validation/tc-userext-create.c b/testsuites/validation/tc-userext-create.c index 9a23523190..a15ccf6c1a 100644 --- a/testsuites/validation/tc-userext-create.c +++ b/testsuites/validation/tc-userext-create.c @@ -129,13 +129,13 @@ typedef struct { typedef struct { void *seized_objects; - rtems_extensions_table table_variable;; + rtems_extensions_table table_variable; rtems_id id_value; rtems_name name; - rtems_extensions_table *table;; + rtems_extensions_table *table; rtems_id *id; diff --git a/testsuites/validation/tc-userext.c b/testsuites/validation/tc-userext.c index bb5e064974..192be30669 100644 --- a/testsuites/validation/tc-userext.c +++ b/testsuites/validation/tc-userext.c @@ -159,6 +159,18 @@ * - Check that the thread terminate extension of the extension set deleted * before its turn in the invocation was not invoked. * + * - Create five dynamic extensions. Let an idle thread return from its entry. + * Delete three dynamic extension during the thread exitted invocation. + * Clean up the used resources. + * + * - Check that the thread exitted extensions were invoked in the right + * order. + * + * - Check that the other extensions were not invoked. + * + * - Check that the thread exitted extension of the extension set deleted + * before its turn in the invocation was not invoked. + * * @{ */ @@ -293,7 +305,13 @@ static void Extension( if ( index == 6 && ( kind == THREAD_EXITTED || kind == THREAD_RESTART ) ) { StopTestCase(); - rtems_task_exit(); + + if ( GetExecuting()->is_idle ) { + SetSelfPriority( RTEMS_MAXIMUM_PRIORITY ); + _CPU_Thread_Idle_body( 0 ); + } else { + rtems_task_exit(); + } } if ( index == 0 && kind == THREAD_TERMINATE ) { @@ -516,6 +534,18 @@ static void TerminateWorker( rtems_task_argument arg ) rtems_task_exit(); } +void *IdleBody( uintptr_t arg ) +{ + rtems_event_set events; + + do { + events = PollAnyEvents(); + } while ( events == 0 ); + + (void) StartTestCase( THREAD_EXITTED ); + return (void *) arg; +} + static void RtemsUserextValUserext_Setup( void *ctx ) { SetSelfPriority( PRIO_NORMAL ); @@ -832,6 +862,45 @@ static void RtemsUserextValUserext_Action_6( void ) } /** + * @brief Create five dynamic extensions. Let an idle thread return from its + * entry. Delete three dynamic extension during the thread exitted + * invocation. Clean up the used resources. + */ +static void RtemsUserextValUserext_Action_7( void ) +{ + rtems_tcb *thread; + rtems_id id; + + /* ID of idle thread of processor 0 */ + id = 0x09010001; + thread = GetThread( id ); + SendEvents( id, RTEMS_EVENT_0 ); + SetPriority( id, PRIO_HIGH ); + + /* + * Check that the thread exitted extensions were invoked in the right order. + */ + CheckForward( THREAD_EXITTED, 1, 1, thread, NULL ); + + /* + * Check that the other extensions were not invoked. + */ + CheckForward( THREAD_BEGIN, 0, 0, NULL, NULL ); + CheckForward( THREAD_CREATE, 0, 0, NULL, NULL ); + CheckReverse( THREAD_DELETE, 0, 0, NULL, NULL ); + CheckForward( THREAD_RESTART, 0, 0, NULL, NULL ); + CheckForward( THREAD_START, 0, 0, NULL, NULL ); + CheckForward( THREAD_SWITCH, 0, 0, NULL, NULL ); + CheckReverse( THREAD_TERMINATE, 0, 0, NULL, NULL ); + + /* + * Check that the thread exitted extension of the extension set deleted + * before its turn in the invocation was not invoked. + */ + CheckDeletedNotInvoked( THREAD_EXITTED ); +} + +/** * @fn void T_case_body_RtemsUserextValUserext( void ) */ T_TEST_CASE_FIXTURE( RtemsUserextValUserext, &RtemsUserextValUserext_Fixture ) @@ -843,6 +912,7 @@ T_TEST_CASE_FIXTURE( RtemsUserextValUserext, &RtemsUserextValUserext_Fixture ) RtemsUserextValUserext_Action_4(); RtemsUserextValUserext_Action_5(); RtemsUserextValUserext_Action_6(); + RtemsUserextValUserext_Action_7(); } /** @} */ diff --git a/testsuites/validation/tr-event-constant.c b/testsuites/validation/tr-event-constant.c index 82b3129fde..a0327973de 100644 --- a/testsuites/validation/tr-event-constant.c +++ b/testsuites/validation/tr-event-constant.c @@ -681,6 +681,11 @@ static void RtemsEventValEventConstant_Action_16( static T_fixture_node RtemsEventValEventConstant_Node; +static T_remark RtemsEventValEventConstant_Remark = { + .next = NULL, + .remark = "RtemsEventValEventConstant" +}; + void RtemsEventValEventConstant_Run( rtems_event_set event, int number ) { RtemsEventValEventConstant_Context *ctx; @@ -714,6 +719,7 @@ void RtemsEventValEventConstant_Run( rtems_event_set event, int number ) RtemsEventValEventConstant_Action_15( ctx ); RtemsEventValEventConstant_Action_16( ctx ); + T_add_remark( &RtemsEventValEventConstant_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-event-send-receive.c b/testsuites/validation/tr-event-send-receive.c index 1437223c41..85d0040615 100644 --- a/testsuites/validation/tr-event-send-receive.c +++ b/testsuites/validation/tr-event-send-receive.c @@ -1250,6 +1250,11 @@ static void RtemsEventReqSendReceive_TestVariant( static T_fixture_node RtemsEventReqSendReceive_Node; +static T_remark RtemsEventReqSendReceive_Remark = { + .next = NULL, + .remark = "RtemsEventReqSendReceive" +}; + void RtemsEventReqSendReceive_Run( rtems_status_code ( *send )( rtems_id, rtems_event_set ), rtems_status_code ( *receive )( rtems_event_set, rtems_option, rtems_interval, rtems_event_set * ), @@ -1309,6 +1314,7 @@ void RtemsEventReqSendReceive_Run( } } + T_add_remark( &RtemsEventReqSendReceive_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-mtx-seize-try.c b/testsuites/validation/tr-mtx-seize-try.c index 23f90629c9..ddc995c2e1 100644 --- a/testsuites/validation/tr-mtx-seize-try.c +++ b/testsuites/validation/tr-mtx-seize-try.c @@ -53,10 +53,6 @@ #endif #include "tr-mtx-seize-try.h" -#include "tr-tq-enqueue-ceiling.h" -#include "tr-tq-enqueue-fifo.h" -#include "tr-tq-enqueue-mrsp.h" -#include "tr-tq-enqueue-priority.h" #include <rtems/test.h> @@ -88,19 +84,19 @@ typedef struct { * @brief If this member is true, then the calling thread shall be the owner * of the mutex. */ - bool owner_caller;; + bool owner_caller; /** * @brief If this member is true, then a thread other than the calling thread * shall be the owner of the mutex. */ - bool owner_other;; + bool owner_other; /** * @brief This member contains the current priority of the calling thread * before the directive call. */ - rtems_task_priority priority_before;; + rtems_task_priority priority_before; /** * @brief This member contains the owner of the mutex after the directive @@ -112,7 +108,7 @@ typedef struct { * @brief This member contains the current priority of the calling thread * after the directive call. */ - rtems_task_priority priority_after;; + rtems_task_priority priority_after; /** * @brief This member contains a copy of the corresponding @@ -805,6 +801,11 @@ static void ScoreMtxReqSeizeTry_TestVariant( ScoreMtxReqSeizeTry_Context *ctx ) static T_fixture_node ScoreMtxReqSeizeTry_Node; +static T_remark ScoreMtxReqSeizeTry_Remark = { + .next = NULL, + .remark = "ScoreMtxReqSeizeTry" +}; + void ScoreMtxReqSeizeTry_Run( TQMtxContext *tq_ctx ) { ScoreMtxReqSeizeTry_Context *ctx; @@ -860,6 +861,7 @@ void ScoreMtxReqSeizeTry_Run( TQMtxContext *tq_ctx ) } } + T_add_remark( &ScoreMtxReqSeizeTry_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-mtx-seize-wait.c b/testsuites/validation/tr-mtx-seize-wait.c index 5a8747b5d6..2e2fe9d1ec 100644 --- a/testsuites/validation/tr-mtx-seize-wait.c +++ b/testsuites/validation/tr-mtx-seize-wait.c @@ -56,7 +56,6 @@ #include "tr-tq-enqueue-ceiling.h" #include "tr-tq-enqueue-deadlock.h" #include "tr-tq-enqueue-fifo.h" -#include "tr-tq-enqueue-mrsp.h" #include "tr-tq-enqueue-priority-inherit.h" #include "tr-tq-enqueue-priority.h" @@ -92,24 +91,24 @@ typedef struct { * @brief If this member is true, then the calling thread shall be the owner * of the mutex. */ - bool owner_caller;; + bool owner_caller; /** * @brief If this member is true, then a thread other than the calling thread * shall be the owner of the mutex. */ - bool owner_other;; + bool owner_other; /** * @brief If this member is true, then a deadlock shall occur. */ - bool deadlock;; + bool deadlock; /** * @brief This member contains the current priority of the calling thread * before the directive call. */ - rtems_task_priority priority_before;; + rtems_task_priority priority_before; /** * @brief This member contains the owner of the mutex after the directive @@ -121,7 +120,7 @@ typedef struct { * @brief This member contains the current priority of the calling thread * after the directive call. */ - rtems_task_priority priority_after;; + rtems_task_priority priority_after; /** * @brief This member contains a copy of the corresponding @@ -218,6 +217,10 @@ static const char * const * const ScoreMtxReqSeizeWait_PreDesc[] = { NULL }; +#if defined(RTEMS_SMP) +#include "tr-tq-enqueue-mrsp.h" +#endif + typedef ScoreMtxReqSeizeWait_Context Context; static Status_Control Status( const Context *ctx, Status_Control status ) @@ -707,7 +710,7 @@ static void ScoreMtxReqSeizeWait_Post_Enqueued_Check( case ScoreMtxReqSeizeWait_Post_Enqueued_PriorityInherit: { /* - * The calling thread shall be enqueued in priority order with priorit + * The calling thread shall be enqueued in priority order with priority * inheritance. */ ScoreTqReqEnqueuePriorityInherit_Run( &ctx->tq_ctx->base ); @@ -728,7 +731,11 @@ static void ScoreMtxReqSeizeWait_Post_Enqueued_Check( * The calling thread shall be enqueued in priority order according to * the MrsP locking protocol. */ + #if defined(RTEMS_SMP) ScoreTqReqEnqueueMrsp_Run( &ctx->tq_ctx->base ); + #else + T_unreachable(); + #endif break; } @@ -1072,6 +1079,11 @@ static void ScoreMtxReqSeizeWait_TestVariant( static T_fixture_node ScoreMtxReqSeizeWait_Node; +static T_remark ScoreMtxReqSeizeWait_Remark = { + .next = NULL, + .remark = "ScoreMtxReqSeizeWait" +}; + void ScoreMtxReqSeizeWait_Run( TQMtxContext *tq_ctx ) { ScoreMtxReqSeizeWait_Context *ctx; @@ -1133,6 +1145,7 @@ void ScoreMtxReqSeizeWait_Run( TQMtxContext *tq_ctx ) } } + T_add_remark( &ScoreMtxReqSeizeWait_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-mtx-surrender.c b/testsuites/validation/tr-mtx-surrender.c index e02b7282bd..3c60726803 100644 --- a/testsuites/validation/tr-mtx-surrender.c +++ b/testsuites/validation/tr-mtx-surrender.c @@ -53,7 +53,6 @@ #endif #include "tr-mtx-surrender.h" -#include "tr-tq-surrender-mrsp.h" #include "tr-tq-surrender-priority-inherit.h" #include "tr-tq-surrender.h" @@ -252,6 +251,10 @@ static const char * const * const ScoreMtxReqSurrender_PreDesc[] = { NULL }; +#if defined(RTEMS_SMP) +#include "tr-tq-surrender-mrsp.h" +#endif + typedef ScoreMtxReqSurrender_Context Context; static Status_Control Status( const Context *ctx, Status_Control status ) @@ -810,8 +813,12 @@ static void ScoreMtxReqSurrender_Post_Surrender_Check( * The thread queue of the mutex shall be surrendered in priority order * with MrsP. */ + #if defined(RTEMS_SMP) T_eq_u32( ctx->counter, 1 ); ScoreTqReqSurrenderMrsp_Run( &ctx->tq_ctx->base ); + #else + T_unreachable(); + #endif break; } @@ -1154,6 +1161,11 @@ static void ScoreMtxReqSurrender_TestVariant( static T_fixture_node ScoreMtxReqSurrender_Node; +static T_remark ScoreMtxReqSurrender_Remark = { + .next = NULL, + .remark = "ScoreMtxReqSurrender" +}; + void ScoreMtxReqSurrender_Run( TQMtxContext *tq_ctx ) { ScoreMtxReqSurrender_Context *ctx; @@ -1227,6 +1239,7 @@ void ScoreMtxReqSurrender_Run( TQMtxContext *tq_ctx ) } } + T_add_remark( &ScoreMtxReqSurrender_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-object-ident-local.c b/testsuites/validation/tr-object-ident-local.c index 6339bd50b5..5cf521fbd6 100644 --- a/testsuites/validation/tr-object-ident-local.c +++ b/testsuites/validation/tr-object-ident-local.c @@ -350,6 +350,11 @@ static void RtemsReqIdentLocal_TestVariant( RtemsReqIdentLocal_Context *ctx ) static T_fixture_node RtemsReqIdentLocal_Node; +static T_remark RtemsReqIdentLocal_Remark = { + .next = NULL, + .remark = "RtemsReqIdentLocal" +}; + void RtemsReqIdentLocal_Run( rtems_id id_local_object, rtems_name name_local_object, @@ -382,6 +387,7 @@ void RtemsReqIdentLocal_Run( } } + T_add_remark( &RtemsReqIdentLocal_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-object-ident.c b/testsuites/validation/tr-object-ident.c index a2b8ecbb67..df66d51437 100644 --- a/testsuites/validation/tr-object-ident.c +++ b/testsuites/validation/tr-object-ident.c @@ -454,6 +454,11 @@ static void RtemsReqIdent_TestVariant( RtemsReqIdent_Context *ctx ) static T_fixture_node RtemsReqIdent_Node; +static T_remark RtemsReqIdent_Remark = { + .next = NULL, + .remark = "RtemsReqIdent" +}; + void RtemsReqIdent_Run( rtems_id id_local_object, rtems_name name_local_object, @@ -492,6 +497,7 @@ void RtemsReqIdent_Run( } } + T_add_remark( &RtemsReqIdent_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-sem-seize-try.c b/testsuites/validation/tr-sem-seize-try.c index c1a6f84e1d..3470f832fd 100644 --- a/testsuites/validation/tr-sem-seize-try.c +++ b/testsuites/validation/tr-sem-seize-try.c @@ -294,6 +294,11 @@ static void ScoreSemReqSeizeTry_TestVariant( ScoreSemReqSeizeTry_Context *ctx ) static T_fixture_node ScoreSemReqSeizeTry_Node; +static T_remark ScoreSemReqSeizeTry_Remark = { + .next = NULL, + .remark = "ScoreSemReqSeizeTry" +}; + void ScoreSemReqSeizeTry_Run( TQSemContext *tq_ctx ) { ScoreSemReqSeizeTry_Context *ctx; @@ -317,6 +322,7 @@ void ScoreSemReqSeizeTry_Run( TQSemContext *tq_ctx ) ScoreSemReqSeizeTry_TestVariant( ctx ); } + T_add_remark( &ScoreSemReqSeizeTry_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-sem-seize-wait.c b/testsuites/validation/tr-sem-seize-wait.c index ef312eb587..bbc1cfd252 100644 --- a/testsuites/validation/tr-sem-seize-wait.c +++ b/testsuites/validation/tr-sem-seize-wait.c @@ -368,6 +368,11 @@ static void ScoreSemReqSeizeWait_TestVariant( static T_fixture_node ScoreSemReqSeizeWait_Node; +static T_remark ScoreSemReqSeizeWait_Remark = { + .next = NULL, + .remark = "ScoreSemReqSeizeWait" +}; + void ScoreSemReqSeizeWait_Run( TQSemContext *tq_ctx ) { ScoreSemReqSeizeWait_Context *ctx; @@ -392,6 +397,7 @@ void ScoreSemReqSeizeWait_Run( TQSemContext *tq_ctx ) ScoreSemReqSeizeWait_TestVariant( ctx ); } + T_add_remark( &ScoreSemReqSeizeWait_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-sem-surrender.c b/testsuites/validation/tr-sem-surrender.c index 6b4f26cf05..d554a33dd2 100644 --- a/testsuites/validation/tr-sem-surrender.c +++ b/testsuites/validation/tr-sem-surrender.c @@ -528,6 +528,11 @@ static void ScoreSemReqSurrender_TestVariant( static T_fixture_node ScoreSemReqSurrender_Node; +static T_remark ScoreSemReqSurrender_Remark = { + .next = NULL, + .remark = "ScoreSemReqSurrender" +}; + void ScoreSemReqSurrender_Run( TQSemContext *tq_ctx ) { ScoreSemReqSurrender_Context *ctx; @@ -564,6 +569,7 @@ void ScoreSemReqSurrender_Run( TQSemContext *tq_ctx ) } } + T_add_remark( &ScoreSemReqSurrender_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-signal-constant.c b/testsuites/validation/tr-signal-constant.c index 00c2f132e8..c8aeb463fd 100644 --- a/testsuites/validation/tr-signal-constant.c +++ b/testsuites/validation/tr-signal-constant.c @@ -176,6 +176,11 @@ static void RtemsSignalValSignalConstant_Action_1( static T_fixture_node RtemsSignalValSignalConstant_Node; +static T_remark RtemsSignalValSignalConstant_Remark = { + .next = NULL, + .remark = "RtemsSignalValSignalConstant" +}; + void RtemsSignalValSignalConstant_Run( rtems_signal_set signal, int number ) { RtemsSignalValSignalConstant_Context *ctx; @@ -194,6 +199,7 @@ void RtemsSignalValSignalConstant_Run( rtems_signal_set signal, int number ) RtemsSignalValSignalConstant_Action_0( ctx ); RtemsSignalValSignalConstant_Action_1( ctx ); + T_add_remark( &RtemsSignalValSignalConstant_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-tq-enqueue-ceiling.c b/testsuites/validation/tr-tq-enqueue-ceiling.c index 107f32984c..a0b4077689 100644 --- a/testsuites/validation/tr-tq-enqueue-ceiling.c +++ b/testsuites/validation/tr-tq-enqueue-ceiling.c @@ -86,7 +86,7 @@ typedef struct { * @brief This member specifies the priority of a thread with an eligible * scheduler equal to an eligible scheduler of the enqueueing thread. */ - rtems_task_priority priority;; + rtems_task_priority priority; /** * @brief If this member is true, then a thread those eligible schedulers are @@ -94,7 +94,7 @@ typedef struct { * thread with an eligible scheduler equal to an eligible scheduler of the * enqueueing thread. */ - size_t other_before;; + size_t other_before; /** * @brief If this member is true, then a thread those eligible schedulers are @@ -102,7 +102,7 @@ typedef struct { * thread with an eligible scheduler equal to an eligible scheduler of the * enqueueing thread. */ - size_t other_after;; + size_t other_after; /** * @brief This member contains a copy of the corresponding @@ -454,7 +454,9 @@ static void ScoreTqReqEnqueueCeiling_Prepare( ScoreTqReqEnqueueCeiling_Context *ctx ) { - ctx->priority = PRIO_PSEUDO_ISR; ctx->other_before = false; ctx->other_after = false; + ctx->priority = PRIO_PSEUDO_ISR; + ctx->other_before = false; + ctx->other_after = false; } static void ScoreTqReqEnqueueCeiling_Action( @@ -643,6 +645,11 @@ static void ScoreTqReqEnqueueCeiling_TestVariant( static T_fixture_node ScoreTqReqEnqueueCeiling_Node; +static T_remark ScoreTqReqEnqueueCeiling_Remark = { + .next = NULL, + .remark = "ScoreTqReqEnqueueCeiling" +}; + void ScoreTqReqEnqueueCeiling_Run( TQContext *tq_ctx ) { ScoreTqReqEnqueueCeiling_Context *ctx; @@ -679,6 +686,7 @@ void ScoreTqReqEnqueueCeiling_Run( TQContext *tq_ctx ) } } + T_add_remark( &ScoreTqReqEnqueueCeiling_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-tq-enqueue-deadlock.c b/testsuites/validation/tr-tq-enqueue-deadlock.c index afbe07f6d0..7f61cbc444 100644 --- a/testsuites/validation/tr-tq-enqueue-deadlock.c +++ b/testsuites/validation/tr-tq-enqueue-deadlock.c @@ -405,6 +405,11 @@ static void ScoreTqReqEnqueueDeadlock_TestVariant( static T_fixture_node ScoreTqReqEnqueueDeadlock_Node; +static T_remark ScoreTqReqEnqueueDeadlock_Remark = { + .next = NULL, + .remark = "ScoreTqReqEnqueueDeadlock" +}; + void ScoreTqReqEnqueueDeadlock_Run( TQContext *tq_ctx ) { ScoreTqReqEnqueueDeadlock_Context *ctx; @@ -435,6 +440,7 @@ void ScoreTqReqEnqueueDeadlock_Run( TQContext *tq_ctx ) } } + T_add_remark( &ScoreTqReqEnqueueDeadlock_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-tq-enqueue-fifo.c b/testsuites/validation/tr-tq-enqueue-fifo.c index 85d3d0d338..27ac064797 100644 --- a/testsuites/validation/tr-tq-enqueue-fifo.c +++ b/testsuites/validation/tr-tq-enqueue-fifo.c @@ -305,6 +305,11 @@ static void ScoreTqReqEnqueueFifo_TestVariant( static T_fixture_node ScoreTqReqEnqueueFifo_Node; +static T_remark ScoreTqReqEnqueueFifo_Remark = { + .next = NULL, + .remark = "ScoreTqReqEnqueueFifo" +}; + void ScoreTqReqEnqueueFifo_Run( TQContext *tq_ctx ) { ScoreTqReqEnqueueFifo_Context *ctx; @@ -328,6 +333,7 @@ void ScoreTqReqEnqueueFifo_Run( TQContext *tq_ctx ) ScoreTqReqEnqueueFifo_TestVariant( ctx ); } + T_add_remark( &ScoreTqReqEnqueueFifo_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-tq-enqueue-mrsp.c b/testsuites/validation/tr-tq-enqueue-mrsp.c index dbf5a6aa4b..14f1f17713 100644 --- a/testsuites/validation/tr-tq-enqueue-mrsp.c +++ b/testsuites/validation/tr-tq-enqueue-mrsp.c @@ -88,7 +88,7 @@ typedef struct { * with an eligible scheduler equal to an eligible scheduler of the * enqueueing thread. */ - rtems_task_priority priority;; + rtems_task_priority priority; /** * @brief If this member is true, then a thread those eligible schedulers are @@ -96,7 +96,7 @@ typedef struct { * thread with an eligible scheduler equal to an eligible scheduler of the * enqueueing thread. */ - size_t other_before;; + size_t other_before; /** * @brief If this member is true, then a thread those eligible schedulers are @@ -104,7 +104,7 @@ typedef struct { * thread with an eligible scheduler equal to an eligible scheduler of the * enqueueing thread. */ - size_t other_after;; + size_t other_after; /** * @brief This member contains a copy of the corresponding @@ -611,6 +611,11 @@ static void ScoreTqReqEnqueueMrsp_TestVariant( static T_fixture_node ScoreTqReqEnqueueMrsp_Node; +static T_remark ScoreTqReqEnqueueMrsp_Remark = { + .next = NULL, + .remark = "ScoreTqReqEnqueueMrsp" +}; + void ScoreTqReqEnqueueMrsp_Run( TQContext *tq_ctx ) { ScoreTqReqEnqueueMrsp_Context *ctx; @@ -646,6 +651,7 @@ void ScoreTqReqEnqueueMrsp_Run( TQContext *tq_ctx ) } } + T_add_remark( &ScoreTqReqEnqueueMrsp_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-tq-enqueue-priority-inherit.c b/testsuites/validation/tr-tq-enqueue-priority-inherit.c index 734e14395c..160e2d7825 100644 --- a/testsuites/validation/tr-tq-enqueue-priority-inherit.c +++ b/testsuites/validation/tr-tq-enqueue-priority-inherit.c @@ -1668,6 +1668,11 @@ static void ScoreTqReqEnqueuePriorityInherit_TestVariant( static T_fixture_node ScoreTqReqEnqueuePriorityInherit_Node; +static T_remark ScoreTqReqEnqueuePriorityInherit_Remark = { + .next = NULL, + .remark = "ScoreTqReqEnqueuePriorityInherit" +}; + void ScoreTqReqEnqueuePriorityInherit_Run( TQContext *tq_ctx ) { ScoreTqReqEnqueuePriorityInherit_Context *ctx; @@ -1730,6 +1735,7 @@ void ScoreTqReqEnqueuePriorityInherit_Run( TQContext *tq_ctx ) } } + T_add_remark( &ScoreTqReqEnqueuePriorityInherit_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-tq-enqueue-priority.c b/testsuites/validation/tr-tq-enqueue-priority.c index ff0c4493e7..18818e34cd 100644 --- a/testsuites/validation/tr-tq-enqueue-priority.c +++ b/testsuites/validation/tr-tq-enqueue-priority.c @@ -86,7 +86,7 @@ typedef struct { * @brief This member specifies the priority of a thread with an eligible * scheduler equal to an eligible scheduler of the enqueueing thread. */ - rtems_task_priority priority;; + rtems_task_priority priority; /** * @brief If this member is true, then a thread those eligible schedulers are @@ -94,7 +94,7 @@ typedef struct { * thread with an eligible scheduler equal to an eligible scheduler of the * enqueueing thread. */ - size_t other_before;; + size_t other_before; /** * @brief If this member is true, then a thread those eligible schedulers are @@ -102,7 +102,7 @@ typedef struct { * thread with an eligible scheduler equal to an eligible scheduler of the * enqueueing thread. */ - size_t other_after;; + size_t other_after; /** * @brief This member contains a copy of the corresponding @@ -703,6 +703,11 @@ static void ScoreTqReqEnqueuePriority_TestVariant( static T_fixture_node ScoreTqReqEnqueuePriority_Node; +static T_remark ScoreTqReqEnqueuePriority_Remark = { + .next = NULL, + .remark = "ScoreTqReqEnqueuePriority" +}; + void ScoreTqReqEnqueuePriority_Run( TQContext *tq_ctx ) { ScoreTqReqEnqueuePriority_Context *ctx; @@ -739,6 +744,7 @@ void ScoreTqReqEnqueuePriority_Run( TQContext *tq_ctx ) } } + T_add_remark( &ScoreTqReqEnqueuePriority_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-tq-flush-fifo.c b/testsuites/validation/tr-tq-flush-fifo.c index 4bd0573979..785d7b37a1 100644 --- a/testsuites/validation/tr-tq-flush-fifo.c +++ b/testsuites/validation/tr-tq-flush-fifo.c @@ -633,6 +633,11 @@ static void ScoreTqReqFlushFifo_TestVariant( ScoreTqReqFlushFifo_Context *ctx ) static T_fixture_node ScoreTqReqFlushFifo_Node; +static T_remark ScoreTqReqFlushFifo_Remark = { + .next = NULL, + .remark = "ScoreTqReqFlushFifo" +}; + void ScoreTqReqFlushFifo_Run( TQContext *tq_ctx, bool may_stop ) { ScoreTqReqFlushFifo_Context *ctx; @@ -682,6 +687,7 @@ void ScoreTqReqFlushFifo_Run( TQContext *tq_ctx, bool may_stop ) } } + T_add_remark( &ScoreTqReqFlushFifo_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-tq-flush-priority-inherit.c b/testsuites/validation/tr-tq-flush-priority-inherit.c index 19198e6eae..903dc20cf2 100644 --- a/testsuites/validation/tr-tq-flush-priority-inherit.c +++ b/testsuites/validation/tr-tq-flush-priority-inherit.c @@ -81,7 +81,7 @@ typedef struct { /** * @brief This member contains the call within ISR request. */ - CallWithinISRRequest request;; + CallWithinISRRequest request; /** * @brief If this member is true, then a minimum priority of the owner of the @@ -535,6 +535,11 @@ static void ScoreTqReqFlushPriorityInherit_TestVariant( static T_fixture_node ScoreTqReqFlushPriorityInherit_Node; +static T_remark ScoreTqReqFlushPriorityInherit_Remark = { + .next = NULL, + .remark = "ScoreTqReqFlushPriorityInherit" +}; + void ScoreTqReqFlushPriorityInherit_Run( TQContext *tq_ctx ) { ScoreTqReqFlushPriorityInherit_Context *ctx; @@ -565,6 +570,7 @@ void ScoreTqReqFlushPriorityInherit_Run( TQContext *tq_ctx ) } } + T_add_remark( &ScoreTqReqFlushPriorityInherit_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-tq-flush-priority.c b/testsuites/validation/tr-tq-flush-priority.c index 3f1c1f3ca8..b8a06c2340 100644 --- a/testsuites/validation/tr-tq-flush-priority.c +++ b/testsuites/validation/tr-tq-flush-priority.c @@ -78,7 +78,7 @@ typedef struct { /** * @brief This member contains the call within ISR request. */ - CallWithinISRRequest request;; + CallWithinISRRequest request; /** * @brief This member contains a copy of the corresponding @@ -385,6 +385,11 @@ static void ScoreTqReqFlushPriority_TestVariant( static T_fixture_node ScoreTqReqFlushPriority_Node; +static T_remark ScoreTqReqFlushPriority_Remark = { + .next = NULL, + .remark = "ScoreTqReqFlushPriority" +}; + void ScoreTqReqFlushPriority_Run( TQContext *tq_ctx, bool supports_multiple_priority_queues @@ -412,6 +417,7 @@ void ScoreTqReqFlushPriority_Run( ScoreTqReqFlushPriority_TestVariant( ctx ); } + T_add_remark( &ScoreTqReqFlushPriority_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-tq-surrender-mrsp.c b/testsuites/validation/tr-tq-surrender-mrsp.c index 6eca2e0174..903146ccbe 100644 --- a/testsuites/validation/tr-tq-surrender-mrsp.c +++ b/testsuites/validation/tr-tq-surrender-mrsp.c @@ -353,7 +353,7 @@ static void ScoreTqReqSurrenderMrsp_Pre_Suspended_Prepare( switch ( state ) { case ScoreTqReqSurrenderMrsp_Pre_Suspended_Yes: { /* - * Whiel the new owner is suspended. + * While the new owner is suspended. */ ctx->suspended = true; break; @@ -361,7 +361,7 @@ static void ScoreTqReqSurrenderMrsp_Pre_Suspended_Prepare( case ScoreTqReqSurrenderMrsp_Pre_Suspended_No: { /* - * Whiel the new owner is not suspended. + * While the new owner is not suspended. */ ctx->suspended = false; break; @@ -974,6 +974,11 @@ static void ScoreTqReqSurrenderMrsp_TestVariant( static T_fixture_node ScoreTqReqSurrenderMrsp_Node; +static T_remark ScoreTqReqSurrenderMrsp_Remark = { + .next = NULL, + .remark = "ScoreTqReqSurrenderMrsp" +}; + void ScoreTqReqSurrenderMrsp_Run( TQContext *tq_ctx ) { ScoreTqReqSurrenderMrsp_Context *ctx; @@ -1029,6 +1034,7 @@ void ScoreTqReqSurrenderMrsp_Run( TQContext *tq_ctx ) } } + T_add_remark( &ScoreTqReqSurrenderMrsp_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-tq-surrender-priority-inherit.c b/testsuites/validation/tr-tq-surrender-priority-inherit.c index 1e6349a765..d0a580f988 100644 --- a/testsuites/validation/tr-tq-surrender-priority-inherit.c +++ b/testsuites/validation/tr-tq-surrender-priority-inherit.c @@ -96,7 +96,7 @@ typedef struct { /** * @brief This member contains the call within ISR request. */ - CallWithinISRRequest request;; + CallWithinISRRequest request; /** * @brief This member contains the barrier to synchronize the runner and the @@ -921,7 +921,7 @@ static void ScoreTqReqSurrenderPriorityInherit_Pre_Suspended_Prepare( switch ( state ) { case ScoreTqReqSurrenderPriorityInherit_Pre_Suspended_Yes: { /* - * Whiel the new owner is suspended. + * While the new owner is suspended. */ ctx->suspended = true; break; @@ -929,7 +929,7 @@ static void ScoreTqReqSurrenderPriorityInherit_Pre_Suspended_Prepare( case ScoreTqReqSurrenderPriorityInherit_Pre_Suspended_No: { /* - * Whiel the new owner is not suspended. + * While the new owner is not suspended. */ ctx->suspended = false; break; @@ -2435,6 +2435,11 @@ static void ScoreTqReqSurrenderPriorityInherit_TestVariant( static T_fixture_node ScoreTqReqSurrenderPriorityInherit_Node; +static T_remark ScoreTqReqSurrenderPriorityInherit_Remark = { + .next = NULL, + .remark = "ScoreTqReqSurrenderPriorityInherit" +}; + void ScoreTqReqSurrenderPriorityInherit_Run( TQContext *tq_ctx ) { ScoreTqReqSurrenderPriorityInherit_Context *ctx; @@ -2510,6 +2515,7 @@ void ScoreTqReqSurrenderPriorityInherit_Run( TQContext *tq_ctx ) } } + T_add_remark( &ScoreTqReqSurrenderPriorityInherit_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-tq-surrender.c b/testsuites/validation/tr-tq-surrender.c index f2c60c5f3d..ce680d71d2 100644 --- a/testsuites/validation/tr-tq-surrender.c +++ b/testsuites/validation/tr-tq-surrender.c @@ -84,7 +84,7 @@ typedef struct { /** * @brief This member contains the call within ISR request. */ - CallWithinISRRequest request;; + CallWithinISRRequest request; /** * @brief This member contains the barrier to synchronize the runner and the @@ -637,6 +637,11 @@ static void ScoreTqReqSurrender_TestVariant( ScoreTqReqSurrender_Context *ctx ) static T_fixture_node ScoreTqReqSurrender_Node; +static T_remark ScoreTqReqSurrender_Remark = { + .next = NULL, + .remark = "ScoreTqReqSurrender" +}; + void ScoreTqReqSurrender_Run( TQContext *tq_ctx ) { ScoreTqReqSurrender_Context *ctx; @@ -678,6 +683,7 @@ void ScoreTqReqSurrender_Run( TQContext *tq_ctx ) } } + T_add_remark( &ScoreTqReqSurrender_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-tq-timeout-mrsp.c b/testsuites/validation/tr-tq-timeout-mrsp.c index f143f9b3ab..7362e1943b 100644 --- a/testsuites/validation/tr-tq-timeout-mrsp.c +++ b/testsuites/validation/tr-tq-timeout-mrsp.c @@ -439,6 +439,11 @@ static void ScoreTqReqTimeoutMrsp_TestVariant( static T_fixture_node ScoreTqReqTimeoutMrsp_Node; +static T_remark ScoreTqReqTimeoutMrsp_Remark = { + .next = NULL, + .remark = "ScoreTqReqTimeoutMrsp" +}; + void ScoreTqReqTimeoutMrsp_Run( TQContext *tq_ctx ) { ScoreTqReqTimeoutMrsp_Context *ctx; @@ -470,6 +475,7 @@ void ScoreTqReqTimeoutMrsp_Run( TQContext *tq_ctx ) } } + T_add_remark( &ScoreTqReqTimeoutMrsp_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-tq-timeout-priority-inherit.c b/testsuites/validation/tr-tq-timeout-priority-inherit.c index c794ddc085..12ac70df90 100644 --- a/testsuites/validation/tr-tq-timeout-priority-inherit.c +++ b/testsuites/validation/tr-tq-timeout-priority-inherit.c @@ -93,7 +93,7 @@ typedef struct { /** * @brief This member contains the call within ISR request. */ - CallWithinISRRequest request;; + CallWithinISRRequest request; /** * @brief This member specifies the scheduler of the thread. @@ -2071,6 +2071,11 @@ static void ScoreTqReqTimeoutPriorityInherit_TestVariant( static T_fixture_node ScoreTqReqTimeoutPriorityInherit_Node; +static T_remark ScoreTqReqTimeoutPriorityInherit_Remark = { + .next = NULL, + .remark = "ScoreTqReqTimeoutPriorityInherit" +}; + void ScoreTqReqTimeoutPriorityInherit_Run( TQContext *tq_ctx ) { ScoreTqReqTimeoutPriorityInherit_Context *ctx; @@ -2148,6 +2153,7 @@ void ScoreTqReqTimeoutPriorityInherit_Run( TQContext *tq_ctx ) } } + T_add_remark( &ScoreTqReqTimeoutPriorityInherit_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/tr-tq-timeout.c b/testsuites/validation/tr-tq-timeout.c index b2f1436411..c9bc13a937 100644 --- a/testsuites/validation/tr-tq-timeout.c +++ b/testsuites/validation/tr-tq-timeout.c @@ -81,7 +81,7 @@ typedef struct { /** * @brief This member contains the call within ISR request. */ - CallWithinISRRequest request;; + CallWithinISRRequest request; /** * @brief This member contains a copy of the corresponding @@ -427,6 +427,11 @@ static void ScoreTqReqTimeout_TestVariant( ScoreTqReqTimeout_Context *ctx ) static T_fixture_node ScoreTqReqTimeout_Node; +static T_remark ScoreTqReqTimeout_Remark = { + .next = NULL, + .remark = "ScoreTqReqTimeout" +}; + void ScoreTqReqTimeout_Run( TQContext *tq_ctx ) { ScoreTqReqTimeout_Context *ctx; @@ -447,6 +452,7 @@ void ScoreTqReqTimeout_Run( TQContext *tq_ctx ) ScoreTqReqTimeout_TestVariant( ctx ); } + T_add_remark( &ScoreTqReqTimeout_Remark ); T_pop_fixture(); } diff --git a/testsuites/validation/ts-userext.c b/testsuites/validation/ts-userext.c index b4531b579b..461a1ddc0e 100644 --- a/testsuites/validation/ts-userext.c +++ b/testsuites/validation/ts-userext.c @@ -92,6 +92,8 @@ const char rtems_test_name[] = "TestsuitesUserext"; .thread_terminate = ThreadTerminateExtension1 \ } +#define CONFIGURE_IDLE_TASK_BODY IdleBody + #include "ts-default.h" /** @} */ diff --git a/testsuites/validation/tx-call-within-isr.c b/testsuites/validation/tx-call-within-isr.c index 63a9a6dc26..8bbe0e7c29 100644 --- a/testsuites/validation/tx-call-within-isr.c +++ b/testsuites/validation/tx-call-within-isr.c @@ -140,6 +140,7 @@ void CallWithinISRWait( const CallWithinISRRequest *request ) } } +#if !defined( TM27_INTERRUPT_VECTOR_DEFAULT ) static void CallWithinISRIsHandlerInstalled( void *arg, const char *info, @@ -152,13 +153,17 @@ static void CallWithinISRIsHandlerInstalled( (void) option; (void) handler_arg; - if ( handler == CallWithinISRHandler ) { + if ( handler == CallWithinISRHandler && handler_arg == NULL ) { *(bool *) arg = true; } } +#endif rtems_vector_number CallWithinISRGetVector( void ) { +#if defined( TM27_INTERRUPT_VECTOR_DEFAULT ) + return TM27_INTERRUPT_VECTOR_DEFAULT; +#else rtems_vector_number vector; for ( vector = 0; vector < BSP_INTERRUPT_VECTOR_COUNT; ++vector ) { @@ -177,6 +182,38 @@ rtems_vector_number CallWithinISRGetVector( void ) } return UINT32_MAX; +#endif +} + +rtems_vector_number GetSoftwareInterruptVector( void ) +{ +#if defined( TM27_INTERRUPT_VECTOR_ALTERNATIVE ) + return TM27_INTERRUPT_VECTOR_ALTERNATIVE; +#else + return UINT32_MAX; +#endif +} + +rtems_status_code RaiseSoftwareInterrupt( rtems_vector_number vector ) +{ +#if defined( TM27_INTERRUPT_VECTOR_ALTERNATIVE ) + if ( vector == TM27_INTERRUPT_VECTOR_ALTERNATIVE ) { + return _TM27_Raise_alternative(); + } +#endif + + return rtems_interrupt_raise( vector ); +} + +rtems_status_code ClearSoftwareInterrupt( rtems_vector_number vector ) +{ +#if defined( TM27_INTERRUPT_VECTOR_ALTERNATIVE ) + if ( vector == TM27_INTERRUPT_VECTOR_ALTERNATIVE ) { + return _TM27_Clear_alternative(); + } +#endif + + return rtems_interrupt_clear( vector ); } static void CallWithinISRInitialize( void ) diff --git a/testsuites/validation/tx-interrupt.c b/testsuites/validation/tx-interrupt.c index 400ccdf070..c5ea4142c2 100644 --- a/testsuites/validation/tx-interrupt.c +++ b/testsuites/validation/tx-interrupt.c @@ -139,6 +139,10 @@ rtems_vector_number GetTestableInterruptVector( } } + if ( vector == BSP_INTERRUPT_VECTOR_COUNT ) { + vector = GetSoftwareInterruptVector(); + } + return vector; } diff --git a/testsuites/validation/tx-support.h b/testsuites/validation/tx-support.h index e83b461e2b..378bc4c466 100644 --- a/testsuites/validation/tx-support.h +++ b/testsuites/validation/tx-support.h @@ -396,6 +396,8 @@ void CallWithinISRClear( void ); rtems_vector_number CallWithinISRGetVector( void ); +rtems_vector_number GetSoftwareInterruptVector( void ); + typedef struct { Thread_queue_Operations tq_ops; const Thread_queue_Operations *wrapped_ops; @@ -437,6 +439,10 @@ rtems_vector_number GetTestableInterruptVector( const rtems_interrupt_attributes *required ); +rtems_status_code RaiseSoftwareInterrupt( rtems_vector_number vector ); + +rtems_status_code ClearSoftwareInterrupt( rtems_vector_number vector ); + bool HasInterruptVectorEntriesInstalled( rtems_vector_number vector ); /** |