From ca4d9ea23b3137da49aa500ffb54c9c52af61bd5 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 9 Dec 2021 16:08:42 +0100 Subject: validation: Test application configuration The test source code is generated from specification items by the "./spec2modules.py" script contained in the git://git.rtems.org/rtems-central.git Git repository. Please read the "How-To" section in the "Software Requirements Engineering" chapter of the RTEMS Software Engineering manual to get more information about the process. Update #3716. --- spec/build/testsuites/validation/grp.yml | 4 + spec/build/testsuites/validation/validation-0.yml | 1 + .../testsuites/validation/validation-acfg-0.yml | 21 ++ .../testsuites/validation/validation-acfg-1.yml | 20 + .../validation/validation-no-clock-0.yml | 1 + .../testsuites/validation/validation-one-cpu-0.yml | 4 +- .../validation/validation-smp-only-0.yml | 4 +- .../tc-acfg-appl-does-not-need-clock-driver.c | 130 +++++++ .../validation/tc-acfg-appl-needs-clock-driver.c | 129 +++++++ testsuites/validation/tc-acfg-default.c | 398 ++++++++++++++++++++ .../validation/tc-acfg-disabled-bsp-settings.c | 141 +++++++ testsuites/validation/tc-acfg-one-cpu.c | 156 ++++++++ testsuites/validation/tc-acfg-scheduler-edf-smp.c | 133 +++++++ testsuites/validation/tc-acfg.c | 414 +++++++++++++++++++++ testsuites/validation/ts-validation-acfg-0.c | 89 +++++ testsuites/validation/ts-validation-acfg-1.c | 111 ++++++ 16 files changed, 1754 insertions(+), 2 deletions(-) create mode 100644 spec/build/testsuites/validation/validation-acfg-0.yml create mode 100644 spec/build/testsuites/validation/validation-acfg-1.yml create mode 100644 testsuites/validation/tc-acfg-appl-does-not-need-clock-driver.c create mode 100644 testsuites/validation/tc-acfg-appl-needs-clock-driver.c create mode 100644 testsuites/validation/tc-acfg-default.c create mode 100644 testsuites/validation/tc-acfg-disabled-bsp-settings.c create mode 100644 testsuites/validation/tc-acfg-one-cpu.c create mode 100644 testsuites/validation/tc-acfg-scheduler-edf-smp.c create mode 100644 testsuites/validation/tc-acfg.c create mode 100644 testsuites/validation/ts-validation-acfg-0.c create mode 100644 testsuites/validation/ts-validation-acfg-1.c diff --git a/spec/build/testsuites/validation/grp.yml b/spec/build/testsuites/validation/grp.yml index 19b447f216..9a327865d2 100644 --- a/spec/build/testsuites/validation/grp.yml +++ b/spec/build/testsuites/validation/grp.yml @@ -34,6 +34,10 @@ links: uid: validation-0 - role: build-dependency uid: validation-1 +- role: build-dependency + uid: validation-acfg-0 +- role: build-dependency + uid: validation-acfg-1 - role: build-dependency uid: validation-no-clock-0 - role: build-dependency diff --git a/spec/build/testsuites/validation/validation-0.yml b/spec/build/testsuites/validation/validation-0.yml index c53f2c2164..bd286b960b 100644 --- a/spec/build/testsuites/validation/validation-0.yml +++ b/spec/build/testsuites/validation/validation-0.yml @@ -11,6 +11,7 @@ includes: [] ldflags: [] links: [] source: +- testsuites/validation/tc-acfg-appl-needs-clock-driver.c - testsuites/validation/tc-barrier-create.c - testsuites/validation/tc-barrier-delete.c - testsuites/validation/tc-barrier-release.c diff --git a/spec/build/testsuites/validation/validation-acfg-0.yml b/spec/build/testsuites/validation/validation-acfg-0.yml new file mode 100644 index 0000000000..68bcf3cf7f --- /dev/null +++ b/spec/build/testsuites/validation/validation-acfg-0.yml @@ -0,0 +1,21 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +build-type: test-program +cflags: [] +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +cppflags: [] +cxxflags: [] +enabled-by: true +features: c cprogram +includes: [] +ldflags: [] +links: [] +source: +- testsuites/validation/tc-acfg-appl-does-not-need-clock-driver.c +- testsuites/validation/tc-acfg-default.c +- testsuites/validation/ts-validation-acfg-0.c +stlib: [] +target: testsuites/validation/ts-validation-acfg-0.exe +type: build +use-after: [] +use-before: [] diff --git a/spec/build/testsuites/validation/validation-acfg-1.yml b/spec/build/testsuites/validation/validation-acfg-1.yml new file mode 100644 index 0000000000..76b8ee28af --- /dev/null +++ b/spec/build/testsuites/validation/validation-acfg-1.yml @@ -0,0 +1,20 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +build-type: test-program +cflags: [] +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +cppflags: [] +cxxflags: [] +enabled-by: true +features: c cprogram +includes: [] +ldflags: [] +links: [] +source: +- testsuites/validation/tc-acfg-disabled-bsp-settings.c +- testsuites/validation/ts-validation-acfg-1.c +stlib: [] +target: testsuites/validation/ts-validation-acfg-1.exe +type: build +use-after: [] +use-before: [] diff --git a/spec/build/testsuites/validation/validation-no-clock-0.yml b/spec/build/testsuites/validation/validation-no-clock-0.yml index 70b2d67d5e..2bf2bef1fd 100644 --- a/spec/build/testsuites/validation/validation-no-clock-0.yml +++ b/spec/build/testsuites/validation/validation-no-clock-0.yml @@ -11,6 +11,7 @@ includes: [] ldflags: [] links: [] source: +- testsuites/validation/tc-acfg.c - testsuites/validation/tc-score-fatal.c - testsuites/validation/tr-mtx-seize-try.c - testsuites/validation/tr-mtx-seize-wait.c diff --git a/spec/build/testsuites/validation/validation-one-cpu-0.yml b/spec/build/testsuites/validation/validation-one-cpu-0.yml index f59464f65a..d3a59309b7 100644 --- a/spec/build/testsuites/validation/validation-one-cpu-0.yml +++ b/spec/build/testsuites/validation/validation-one-cpu-0.yml @@ -8,9 +8,11 @@ cxxflags: [] enabled-by: true features: c cprogram includes: [] -ldflags: [] +ldflags: +- -Wl,--wrap=_Scheduler_priority_Yield links: [] source: +- testsuites/validation/tc-acfg-one-cpu.c - testsuites/validation/tc-score-fatal.c - testsuites/validation/ts-validation-one-cpu-0.c stlib: [] diff --git a/spec/build/testsuites/validation/validation-smp-only-0.yml b/spec/build/testsuites/validation/validation-smp-only-0.yml index 429646c9a8..3de2054053 100644 --- a/spec/build/testsuites/validation/validation-smp-only-0.yml +++ b/spec/build/testsuites/validation/validation-smp-only-0.yml @@ -8,9 +8,11 @@ cxxflags: [] enabled-by: RTEMS_SMP features: c cprogram includes: [] -ldflags: [] +ldflags: +- -Wl,--wrap=_Scheduler_EDF_SMP_Yield links: [] source: +- testsuites/validation/tc-acfg-scheduler-edf-smp.c - testsuites/validation/tc-score-tq-smp.c - testsuites/validation/ts-validation-smp-only-0.c stlib: [] diff --git a/testsuites/validation/tc-acfg-appl-does-not-need-clock-driver.c b/testsuites/validation/tc-acfg-appl-does-not-need-clock-driver.c new file mode 100644 index 0000000000..3aef1497be --- /dev/null +++ b/testsuites/validation/tc-acfg-appl-does-not-need-clock-driver.c @@ -0,0 +1,130 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseAcfgValApplDoesNotNeedClockDriver + */ + +/* + * Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include + +/** + * @defgroup RTEMSTestCaseAcfgValApplDoesNotNeedClockDriver \ + * spec:/acfg/val/appl-does-not-need-clock-driver + * + * @ingroup RTEMSTestSuiteTestsuitesValidationAcfg0 + * + * @brief Tests the effect of the + * CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER application configuration + * option. + * + * This test case performs the following actions: + * + * - Get the current clock ticks since boot value. Busy wait for at least one + * clock tick interval. + * + * - Check that the clock ticks since boot count did not change while busy + * waiting for more than one clock tick interval. + * + * @{ + */ + +/** + * @brief Get the current clock ticks since boot value. Busy wait for at least + * one clock tick interval. + */ +static void AcfgValApplDoesNotNeedClockDriver_Action_0( void ) +{ + T_time time_per_clock_tick; + T_ticks duration; + T_ticks elapsed; + T_ticks t0; + T_ticks t1; + rtems_interval ticks_since_boot; + + ticks_since_boot = rtems_clock_get_ticks_since_boot(); + + time_per_clock_tick = T_seconds_and_nanoseconds_to_time( + 0, + rtems_configuration_get_nanoseconds_per_tick() + ); + duration = 2 * T_time_to_ticks( time_per_clock_tick ); + elapsed = 0; + t0 = T_tick(); + + while ( elapsed < duration ) { + t1 = T_tick(); + elapsed += t1 - t0; + t0 = t1; + } + + /* + * Check that the clock ticks since boot count did not change while busy + * waiting for more than one clock tick interval. + */ + T_step_eq_u32( + 0, + rtems_clock_get_ticks_since_boot(), + ticks_since_boot + ); +} + +/** + * @fn void T_case_body_AcfgValApplDoesNotNeedClockDriver( void ) + */ +T_TEST_CASE( AcfgValApplDoesNotNeedClockDriver ) +{ + T_plan( 1 ); + + AcfgValApplDoesNotNeedClockDriver_Action_0(); +} + +/** @} */ diff --git a/testsuites/validation/tc-acfg-appl-needs-clock-driver.c b/testsuites/validation/tc-acfg-appl-needs-clock-driver.c new file mode 100644 index 0000000000..5da259977f --- /dev/null +++ b/testsuites/validation/tc-acfg-appl-needs-clock-driver.c @@ -0,0 +1,129 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseAcfgValApplNeedsClockDriver + */ + +/* + * Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include + +/** + * @defgroup RTEMSTestCaseAcfgValApplNeedsClockDriver \ + * spec:/acfg/val/appl-needs-clock-driver + * + * @ingroup RTEMSTestSuiteTestsuitesValidation0 + * + * @brief Tests the effect of the CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + * application configuration option. + * + * This test case performs the following actions: + * + * - Get the current clock ticks since boot value. Busy wait for at least one + * clock tick interval. + * + * - Check that the clock ticks since boot count changed while busy waiting + * for more than one clock tick interval. + * + * @{ + */ + +/** + * @brief Get the current clock ticks since boot value. Busy wait for at least + * one clock tick interval. + */ +static void AcfgValApplNeedsClockDriver_Action_0( void ) +{ + T_time time_per_clock_tick; + T_ticks duration; + T_ticks elapsed; + T_ticks t0; + T_ticks t1; + rtems_interval ticks_since_boot; + + ticks_since_boot = rtems_clock_get_ticks_since_boot(); + + time_per_clock_tick = T_seconds_and_nanoseconds_to_time( + 0, + rtems_configuration_get_nanoseconds_per_tick() + ); + duration = 2 * T_time_to_ticks( time_per_clock_tick ); + elapsed = 0; + t0 = T_tick(); + + while ( elapsed < duration ) { + t1 = T_tick(); + elapsed += t1 - t0; + t0 = t1; + } + + /* + * Check that the clock ticks since boot count changed while busy waiting for + * more than one clock tick interval. + */ + T_step_gt_u32( + 0, + rtems_clock_get_ticks_since_boot() - ticks_since_boot, + 0 + ); +} + +/** + * @fn void T_case_body_AcfgValApplNeedsClockDriver( void ) + */ +T_TEST_CASE( AcfgValApplNeedsClockDriver ) +{ + T_plan( 1 ); + + AcfgValApplNeedsClockDriver_Action_0(); +} + +/** @} */ diff --git a/testsuites/validation/tc-acfg-default.c b/testsuites/validation/tc-acfg-default.c new file mode 100644 index 0000000000..95fa497cf1 --- /dev/null +++ b/testsuites/validation/tc-acfg-default.c @@ -0,0 +1,398 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseAcfgValDefault + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include "tx-support.h" + +#include + +/** + * @defgroup RTEMSTestCaseAcfgValDefault spec:/acfg/val/default + * + * @ingroup RTEMSTestSuiteTestsuitesValidationAcfg0 + * + * @brief Tests the default values of application configuration options. + * + * This test case performs the following actions: + * + * - Check the effect of application configuration options with optional + * BSP-provided settings. + * + * - Check the configured CONFIGURE_IDLE_TASK_BODY. + * + * - Check the default value CONFIGURE_IDLE_TASK_STACK_SIZE where the + * optional BSP-provided default value is enabled. + * + * - Check the default value CONFIGURE_INTERRUPT_STACK_SIZE where the + * optional BSP-provided default value is enabled. + * + * - Check the BSP-provided initial extension is registered. + * + * - Try to create a barrier. + * + * - Check that the returned status code is RTEMS_TOO_MANY. + * + * - Try to construct a message queue. + * + * - Check that the returned status code is RTEMS_TOO_MANY. + * + * - Try to create a partition. + * + * - Check that the returned status code is RTEMS_TOO_MANY. + * + * - Try to create a period. + * + * - Check that the returned status code is RTEMS_TOO_MANY. + * + * - Check that the processor maximum is one. + * + * - Try to create a semaphore. + * + * - Check that the returned status code is RTEMS_TOO_MANY. + * + * - Try to construct a task. + * + * - Check that the returned status code is RTEMS_TOO_MANY. + * + * - Check the default CONFIGURE_MAXIMUM_TASKS value. A maximum Classic API + * task value of zero is only configurable if + * CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION is defined or + * CONFIGURE_MAXIMUM_POSIX_THREADS is set to a positive value. The default + * value of zero for CONFIGURE_MAXIMUM_POSIX_THREADS is used by the test + * suite containing the test case. The test suite defines + * CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION. + * + * - Try to create a timer. + * + * - Check that the returned status code is RTEMS_TOO_MANY. + * + * - Try to create a user extension set. + * + * - Check that the returned status code is RTEMS_TOO_MANY. + * + * @{ + */ + +#define NAME rtems_build_name( 'N', 'A', 'M', 'E' ) + +RTEMS_ALIGNED(RTEMS_TASK_STORAGE_ALIGNMENT) static char task_storage[ + RTEMS_TASK_STORAGE_SIZE( + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_ATTRIBUTES + ) +]; + +static const rtems_task_config task_config = { + .name = NAME, + .initial_priority = 1, + .storage_area = task_storage, + .storage_size = sizeof( task_storage ), + .maximum_thread_local_storage_size = 0, + .initial_modes = RTEMS_DEFAULT_MODES, + .attributes = RTEMS_DEFAULT_ATTRIBUTES +}; + +/** + * @brief Check the effect of application configuration options with optional + * BSP-provided settings. + */ +static void AcfgValDefault_Action_0( void ) +{ + rtems_extensions_table bsp = BSP_INITIAL_EXTENSION; + + /* + * Check the configured CONFIGURE_IDLE_TASK_BODY. + */ + T_step_eq_ptr( 0, rtems_configuration_get_idle_task(), IdleBody ); + + /* + * Check the default value CONFIGURE_IDLE_TASK_STACK_SIZE where the optional + * BSP-provided default value is enabled. + */ + T_step_eq_sz( + 1, + rtems_configuration_get_idle_task_stack_size(), + #if defined(BSP_IDLE_TASK_STACK_SIZE) + BSP_IDLE_TASK_STACK_SIZE + #else + CPU_STACK_MINIMUM_SIZE + #endif + ); + + /* + * Check the default value CONFIGURE_INTERRUPT_STACK_SIZE where the optional + * BSP-provided default value is enabled. + */ + T_step_eq_sz( + 2, + rtems_configuration_get_interrupt_stack_size(), + #if defined(BSP_INTERRUPT_STACK_SIZE) + BSP_INTERRUPT_STACK_SIZE + #else + CPU_STACK_MINIMUM_SIZE + #endif + ); + + /* + * Check the BSP-provided initial extension is registered. + */ + T_step_eq_sz( 3, _User_extensions_Initial_count, 1 ); + T_step_eq_ptr( + 4, + _User_extensions_Initial_extensions[ 0 ].fatal, + bsp.fatal + ); +} + +/** + * @brief Try to create a barrier. + */ +static void AcfgValDefault_Action_1( void ) +{ + rtems_status_code sc; + rtems_id id; + + sc = rtems_barrier_create( + NAME, + RTEMS_DEFAULT_ATTRIBUTES, + 1, + &id + ); + + /* + * Check that the returned status code is RTEMS_TOO_MANY. + */ + T_step_rsc( 5, sc, RTEMS_TOO_MANY ); +} + +/** + * @brief Try to construct a message queue. + */ +static void AcfgValDefault_Action_2( void ) +{ + rtems_message_queue_config config; + RTEMS_MESSAGE_QUEUE_BUFFER( 1 ) buffers[ 1 ]; + rtems_status_code sc; + rtems_id id; + + memset( &config, 0, sizeof( config ) ); + config.name = NAME; + config.maximum_pending_messages = 1; + config.maximum_message_size = 1; + config.storage_size = sizeof( buffers ); + config.storage_area = buffers; + config.attributes = RTEMS_DEFAULT_ATTRIBUTES; + + sc = rtems_message_queue_construct( &config, &id ); + + /* + * Check that the returned status code is RTEMS_TOO_MANY. + */ + T_step_rsc( 6, sc, RTEMS_TOO_MANY ); +} + +/** + * @brief Try to create a partition. + */ +static void AcfgValDefault_Action_3( void ) +{ + RTEMS_ALIGNED( RTEMS_PARTITION_ALIGNMENT ) uint8_t buffers[ 1 ][ 32 ]; + rtems_status_code sc; + rtems_id id; + + sc = rtems_partition_create( + NAME, + buffers, + sizeof( buffers ), + sizeof( buffers[ 0 ] ), + RTEMS_DEFAULT_ATTRIBUTES, + &id + ); + + /* + * Check that the returned status code is RTEMS_TOO_MANY. + */ + T_step_rsc( 7, sc, RTEMS_TOO_MANY ); +} + +/** + * @brief Try to create a period. + */ +static void AcfgValDefault_Action_4( void ) +{ + rtems_status_code sc; + rtems_id id; + + sc = rtems_rate_monotonic_create( NAME, &id ); + + /* + * Check that the returned status code is RTEMS_TOO_MANY. + */ + T_step_rsc( 8, sc, RTEMS_TOO_MANY ); +} + +/** + * @brief Check that the processor maximum is one. + */ +static void AcfgValDefault_Action_5( void ) +{ + T_step_eq_u32( 9, rtems_scheduler_get_processor_maximum(), 1 ); +} + +/** + * @brief Try to create a semaphore. + */ +static void AcfgValDefault_Action_6( void ) +{ + rtems_status_code sc; + rtems_id id; + + sc = rtems_semaphore_create( + NAME, + 0, + RTEMS_DEFAULT_ATTRIBUTES, + 0, + &id + ); + + /* + * Check that the returned status code is RTEMS_TOO_MANY. + */ + T_step_rsc( 10, sc, RTEMS_TOO_MANY ); +} + +/** + * @brief Try to construct a task. + */ +static void AcfgValDefault_Action_7( void ) +{ + rtems_status_code sc; + rtems_id id; + + sc = rtems_task_construct( &task_config, &id ); + + /* + * Check that the returned status code is RTEMS_TOO_MANY. + */ + T_step_rsc( 11, sc, RTEMS_TOO_MANY ); + + /* + * Check the default CONFIGURE_MAXIMUM_TASKS value. A maximum Classic API + * task value of zero is only configurable if + * CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION is defined or + * CONFIGURE_MAXIMUM_POSIX_THREADS is set to a positive value. The default + * value of zero for CONFIGURE_MAXIMUM_POSIX_THREADS is used by the test + * suite containing the test case. The test suite defines + * CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION. + */ + T_step_eq_u32( 12, rtems_configuration_get_maximum_tasks(), 0 ); +} + +/** + * @brief Try to create a timer. + */ +static void AcfgValDefault_Action_8( void ) +{ + rtems_status_code sc; + rtems_id id; + + sc = rtems_timer_create( NAME, &id ); + + /* + * Check that the returned status code is RTEMS_TOO_MANY. + */ + T_step_rsc( 13, sc, RTEMS_TOO_MANY ); +} + +/** + * @brief Try to create a user extension set. + */ +static void AcfgValDefault_Action_9( void ) +{ + rtems_extensions_table table; + rtems_status_code sc; + rtems_id id; + + memset( &table, 0, sizeof( table ) ); + sc = rtems_extension_create( NAME, &table, &id ); + + /* + * Check that the returned status code is RTEMS_TOO_MANY. + */ + T_step_rsc( 14, sc, RTEMS_TOO_MANY ); +} + +/** + * @fn void T_case_body_AcfgValDefault( void ) + */ +T_TEST_CASE( AcfgValDefault ) +{ + T_plan( 15 ); + + AcfgValDefault_Action_0(); + AcfgValDefault_Action_1(); + AcfgValDefault_Action_2(); + AcfgValDefault_Action_3(); + AcfgValDefault_Action_4(); + AcfgValDefault_Action_5(); + AcfgValDefault_Action_6(); + AcfgValDefault_Action_7(); + AcfgValDefault_Action_8(); + AcfgValDefault_Action_9(); +} + +/** @} */ diff --git a/testsuites/validation/tc-acfg-disabled-bsp-settings.c b/testsuites/validation/tc-acfg-disabled-bsp-settings.c new file mode 100644 index 0000000000..0dbae670f3 --- /dev/null +++ b/testsuites/validation/tc-acfg-disabled-bsp-settings.c @@ -0,0 +1,141 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseAcfgValDisabledBspSettings + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include + +/** + * @defgroup RTEMSTestCaseAcfgValDisabledBspSettings \ + * spec:/acfg/val/disabled-bsp-settings + * + * @ingroup RTEMSTestSuiteTestsuitesValidationAcfg1 + * + * @brief Tests the default values of application configuration options where + * all optional BSP provided settings are disabled. + * + * This test case performs the following actions: + * + * - Check the effect of application configuration options with optional + * BSP-provided settings. + * + * - Check the default value CONFIGURE_IDLE_TASK_BODY where the optional + * BSP-provided default value is disabled. + * + * - Check the default value CONFIGURE_IDLE_TASK_STACK_SIZE where the + * optional BSP-provided default value is disabled. + * + * - Check the default value CONFIGURE_INTERRUPT_STACK_SIZE where the + * optional BSP-provided default value is disabled. + * + * - Check the BSP-provided initial extension is not registered. + * + * @{ + */ + +/** + * @brief Check the effect of application configuration options with optional + * BSP-provided settings. + */ +static void AcfgValDisabledBspSettings_Action_0( void ) +{ + rtems_extensions_table bsp = BSP_INITIAL_EXTENSION; + + /* + * Check the default value CONFIGURE_IDLE_TASK_BODY where the optional + * BSP-provided default value is disabled. + */ + T_eq_ptr( + rtems_configuration_get_idle_task(), + _CPU_Thread_Idle_body + ); + + /* + * Check the default value CONFIGURE_IDLE_TASK_STACK_SIZE where the optional + * BSP-provided default value is disabled. + */ + T_eq_sz( + rtems_configuration_get_idle_task_stack_size(), + CPU_STACK_MINIMUM_SIZE + ); + + /* + * Check the default value CONFIGURE_INTERRUPT_STACK_SIZE where the optional + * BSP-provided default value is disabled. + */ + T_eq_sz( + rtems_configuration_get_interrupt_stack_size(), + CPU_STACK_MINIMUM_SIZE + ); + + /* + * Check the BSP-provided initial extension is not registered. + */ + T_eq_sz( _User_extensions_Initial_count, 1 ); + T_ne_ptr( + _User_extensions_Initial_extensions[ 0 ].fatal, + bsp.fatal + ); +} + +/** + * @fn void T_case_body_AcfgValDisabledBspSettings( void ) + */ +T_TEST_CASE( AcfgValDisabledBspSettings ) +{ + AcfgValDisabledBspSettings_Action_0(); +} + +/** @} */ diff --git a/testsuites/validation/tc-acfg-one-cpu.c b/testsuites/validation/tc-acfg-one-cpu.c new file mode 100644 index 0000000000..5175829d55 --- /dev/null +++ b/testsuites/validation/tc-acfg-one-cpu.c @@ -0,0 +1,156 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseAcfgValOneCpu + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "ts-config.h" +#include "tx-support.h" + +#include + +/** + * @defgroup RTEMSTestCaseAcfgValOneCpu spec:/acfg/val/one-cpu + * + * @ingroup RTEMSTestSuiteTestsuitesValidationOneCpu0 + * + * @brief Tests the effect of application configuration options. + * + * This test case performs the following actions: + * + * - Check the effect of application configuration options. + * + * - Check that the CONFIGURE_MAXIMUM_PRIORITY application configuration + * option resulted in the expected system setting using + * /rtems/task/if/maximum-priority. + * + * - Check that the Deterministic Priority Scheduler which was configured by + * the CONFIGURE_SCHEDULER_PRIORITY application configuration in the test + * suite. + * + * - Check that we are able to identify the scheduler by the name configured + * by the CONFIGURE_SCHEDULER_PRIORITY application configuration option in + * the test suite. + * + * @{ + */ + +static uint32_t yield_count; + +void __real__Scheduler_priority_Yield( + const Scheduler_Control *scheduler, + Thread_Control *thread, + Scheduler_Node *node +); + +void __wrap__Scheduler_priority_Yield( + const Scheduler_Control *scheduler, + Thread_Control *thread, + Scheduler_Node *node +); + +void __wrap__Scheduler_priority_Yield( + const Scheduler_Control *scheduler, + Thread_Control *thread, + Scheduler_Node *node +) +{ + ++yield_count; + __real__Scheduler_priority_Yield( scheduler, thread, node ); +} + +/** + * @brief Check the effect of application configuration options. + */ +static void AcfgValOneCpu_Action_0( void ) +{ + rtems_status_code sc; + rtems_id id; + uint32_t yield_count_before; + + /* + * Check that the CONFIGURE_MAXIMUM_PRIORITY application configuration option + * resulted in the expected system setting using + * /rtems/task/if/maximum-priority. + */ + T_eq_u32( RTEMS_MAXIMUM_PRIORITY, 127 ); + + /* + * Check that the Deterministic Priority Scheduler which was configured by + * the CONFIGURE_SCHEDULER_PRIORITY application configuration in the test + * suite. + */ + yield_count_before = yield_count; + sc = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + T_rsc_success( sc ); + T_eq_u32( yield_count, yield_count_before + 1 ); + + /* + * Check that we are able to identify the scheduler by the name configured by + * the CONFIGURE_SCHEDULER_PRIORITY application configuration option in the + * test suite. + */ + sc = rtems_scheduler_ident( TEST_SCHEDULER_A_NAME, &id ); + T_rsc_success( sc ); +} + +/** + * @fn void T_case_body_AcfgValOneCpu( void ) + */ +T_TEST_CASE( AcfgValOneCpu ) +{ + AcfgValOneCpu_Action_0(); +} + +/** @} */ diff --git a/testsuites/validation/tc-acfg-scheduler-edf-smp.c b/testsuites/validation/tc-acfg-scheduler-edf-smp.c new file mode 100644 index 0000000000..75b24b97d3 --- /dev/null +++ b/testsuites/validation/tc-acfg-scheduler-edf-smp.c @@ -0,0 +1,133 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseAcfgValSchedulerEdfSmp + */ + +/* + * Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "ts-config.h" +#include "tx-support.h" + +#include + +/** + * @defgroup RTEMSTestCaseAcfgValSchedulerEdfSmp \ + * spec:/acfg/val/scheduler-edf-smp + * + * @ingroup RTEMSTestSuiteTestsuitesValidationSmpOnly0 + * + * @brief Tests the effect of application configuration options. + * + * This test case performs the following actions: + * + * - Check the effect of application configuration options. + * + * - Check that the Earliest Deadline First SMP Scheduler which was + * configured by the CONFIGURE_SCHEDULER_EDF_SMP application configuration + * in the test suite. + * + * @{ + */ + +static uint32_t yield_count; + +void __real__Scheduler_EDF_SMP_Yield( + const Scheduler_Control *scheduler, + Thread_Control *thread, + Scheduler_Node *node +); + +void __wrap__Scheduler_EDF_SMP_Yield( + const Scheduler_Control *scheduler, + Thread_Control *thread, + Scheduler_Node *node +); + +void __wrap__Scheduler_EDF_SMP_Yield( + const Scheduler_Control *scheduler, + Thread_Control *thread, + Scheduler_Node *node +) +{ + ++yield_count; + __real__Scheduler_EDF_SMP_Yield( scheduler, thread, node ); +} + +/** + * @brief Check the effect of application configuration options. + */ +static void AcfgValSchedulerEdfSmp_Action_0( void ) +{ + rtems_status_code sc; + uint32_t yield_count_before; + + /* + * Check that the Earliest Deadline First SMP Scheduler which was configured + * by the CONFIGURE_SCHEDULER_EDF_SMP application configuration in the test + * suite. + */ + yield_count_before = yield_count; + sc = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + T_rsc_success( sc ); + T_eq_u32( yield_count, yield_count_before + 1 ); +} + +/** + * @fn void T_case_body_AcfgValSchedulerEdfSmp( void ) + */ +T_TEST_CASE( AcfgValSchedulerEdfSmp ) +{ + AcfgValSchedulerEdfSmp_Action_0(); +} + +/** @} */ diff --git a/testsuites/validation/tc-acfg.c b/testsuites/validation/tc-acfg.c new file mode 100644 index 0000000000..fb16536737 --- /dev/null +++ b/testsuites/validation/tc-acfg.c @@ -0,0 +1,414 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestCaseAcfgValAcfg + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include "ts-config.h" +#include "tx-support.h" + +#include + +/** + * @defgroup RTEMSTestCaseAcfgValAcfg spec:/acfg/val/acfg + * + * @ingroup RTEMSTestSuiteTestsuitesValidationNoClock0 + * + * @brief Tests the effect of application configuration options. + * + * This test case performs the following actions: + * + * - Check the effect of application configuration options. In addition, this + * test case validates the effect of CONFIGURE_INIT. The test case includes + * rtems/confdefs.h without defining CONFIGURE_INIT before the include. If + * this header would define configuration data structures, then linking the + * test suite executable would result in multiple definition errors. This + * header is included in the test suite runner translation unit while + * CONFIGURE_INIT is defined before the include. If this would not result in + * the definition of application defined configuration data structures, then + * the checks below for non-default settings would fail. + * + * - Check the default value CONFIGURE_IDLE_TASK_BODY where the optional + * BSP-provided default value is enabled. + * + * - Check the configured CONFIGURE_INIT_TASK_ARGUMENTS. This validates also + * the effect of CONFIGURE_INIT_TASK_ENTRY_POINT and + * CONFIGURE_RTEMS_INIT_TASKS_TABLE. + * + * - Check the configured CONFIGURE_INIT_TASK_INITIAL_MODES. + * + * - Check the configured CONFIGURE_INIT_TASK_NAME. + * + * - Check the configured CONFIGURE_INIT_TASK_PRIORITY. A priority of zero + * can only be set for system tasks. This validates also + * CONFIGURE_INIT_TASK_ATTRIBUTES. + * + * - Check that the configured + * CONFIGURE_MINIMUM_TASKS_WITH_USER_PROVIDED_STORAGE value reduced the + * stack space size. + * + * - Check the configured CONFIGURE_MAXIMUM_BARRIERS value. + * + * - Check the configured CONFIGURE_MAXIMUM_USER_EXTENSIONS value. + * + * - Check the configured CONFIGURE_MAXIMUM_MESSAGE_QUEUES value. + * + * - Check the configured CONFIGURE_MAXIMUM_PARTITIONS value. + * + * - Check the configured CONFIGURE_MAXIMUM_PERIODS value. + * + * - Check the default CONFIGURE_MAXIMUM_PORTS value. + * + * - Check the configured CONFIGURE_MAXIMUM_PROCESSORS value. + * + * - Check the default CONFIGURE_MAXIMUM_REGIONS value. + * + * - Check the configured CONFIGURE_MAXIMUM_SEMAPHORES value. + * + * - Check the configured CONFIGURE_MAXIMUM_TASKS value. + * + * - Check the configured CONFIGURE_MAXIMUM_TIMERS value. + * + * - Check the configured CONFIGURE_MICROSECONDS_PER_TICK value in + * microseconds. + * + * - Check the configured CONFIGURE_MICROSECONDS_PER_TICK value in + * milliseconds. + * + * - Check the configured CONFIGURE_MICROSECONDS_PER_TICK value in + * nanoseconds. + * + * - Check the configured CONFIGURE_TASK_STACK_ALLOCATOR hook. Using the + * test stack allocator validates also + * /acfg/if/init-task-construct-storage-size, since the + * test_task_stack_allocate() allocate handler only supports + * CONFIGURE_MAXIMUM_TASKS minus one stacks and the validation test for + * /rtems/task/req/create-errors creates for some pre-condition variants + * all tasks until RTEMS_TOO_MANY is returned. In addition, + * test_task_stack_allocate() checks that the allocation size is greater + * than or equal to TEST_MINIMUM_STACK_SIZE which validates + * CONFIGURE_MINIMUM_TASK_STACK_SIZE. + * + * - Check the configured CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE + * value. + * + * - Check the configured CONFIGURE_TASK_STACK_DEALLOCATOR hook. + * + * - Check the configured CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE hook. + * + * - Check the configured CONFIGURE_IDLE_TASK_STACK_SIZE value. + * + * - Check the configured CONFIGURE_INTERRUPT_STACK_SIZE value. + * + * - Check the configured CONFIGURE_TICKS_PER_TIMESLICE value. + * + * @{ + */ + +/** + * @brief Check the effect of application configuration options. In addition, + * this test case validates the effect of CONFIGURE_INIT. The test case + * includes rtems/confdefs.h without defining CONFIGURE_INIT before the + * include. If this header would define configuration data structures, then + * linking the test suite executable would result in multiple definition + * errors. This header is included in the test suite runner translation unit + * while CONFIGURE_INIT is defined before the include. If this would not + * result in the definition of application defined configuration data + * structures, then the checks below for non-default settings would fail. + */ +static void AcfgValAcfg_Action_0( void ) +{ + rtems_status_code sc; + rtems_id id; + + /* + * Check the default value CONFIGURE_IDLE_TASK_BODY where the optional + * BSP-provided default value is enabled. + */ + T_eq_ptr( + rtems_configuration_get_idle_task(), + #if defined(BSP_IDLE_TASK_BODY) + BSP_IDLE_TASK_BODY + #else + _CPU_Thread_Idle_body + #endif + ); + + /* + * Check the configured CONFIGURE_INIT_TASK_ARGUMENTS. This validates also + * the effect of CONFIGURE_INIT_TASK_ENTRY_POINT and + * CONFIGURE_RTEMS_INIT_TASKS_TABLE. + */ + T_eq_ulong( test_runner_argument, TEST_RUNNER_ARGUMENT ); + + /* + * Check the configured CONFIGURE_INIT_TASK_INITIAL_MODES. + */ + T_eq_u32( test_runner_initial_modes, TEST_RUNNER_INITIAL_MODES ); + + /* + * Check the configured CONFIGURE_INIT_TASK_NAME. + */ + sc = rtems_task_ident( TEST_RUNNER_NAME, RTEMS_SEARCH_LOCAL_NODE, &id ); + T_rsc_success( sc ); + T_eq_u32( id, rtems_task_self() ); + + /* + * Check the configured CONFIGURE_INIT_TASK_PRIORITY. A priority of zero can + * only be set for system tasks. This validates also + * CONFIGURE_INIT_TASK_ATTRIBUTES. + */ + T_eq_u32( test_runner_initial_priority, 0 ); + + /* + * Check that the configured + * CONFIGURE_MINIMUM_TASKS_WITH_USER_PROVIDED_STORAGE value reduced the stack + * space size. + */ + T_eq_uptr( + _Stack_Space_size, + RTEMS_ALIGN_UP( HEAP_BLOCK_HEADER_SIZE, CPU_HEAP_ALIGNMENT ) + ); + + /* + * Check the configured CONFIGURE_MAXIMUM_BARRIERS value. + */ + T_eq_u32( + rtems_configuration_get_maximum_barriers(), + TEST_MAXIMUM_BARRIERS + ); + + /* + * Check the configured CONFIGURE_MAXIMUM_USER_EXTENSIONS value. + */ + T_eq_u32( + rtems_configuration_get_maximum_extensions(), + TEST_MAXIMUM_USER_EXTENSIONS + ); + + /* + * Check the configured CONFIGURE_MAXIMUM_MESSAGE_QUEUES value. + */ + T_eq_u32( + rtems_configuration_get_maximum_message_queues(), + TEST_MAXIMUM_MESSAGE_QUEUES + ); + + /* + * Check the configured CONFIGURE_MAXIMUM_PARTITIONS value. + */ + T_eq_u32( + rtems_configuration_get_maximum_partitions(), + TEST_MAXIMUM_PARTITIONS + ); + + /* + * Check the configured CONFIGURE_MAXIMUM_PERIODS value. + */ + T_eq_u32( + rtems_configuration_get_maximum_periods(), + TEST_MAXIMUM_PERIODS + ); + + /* + * Check the default CONFIGURE_MAXIMUM_PORTS value. + */ + T_eq_u32( + rtems_configuration_get_maximum_ports(), + 0 + ); + + /* + * Check the configured CONFIGURE_MAXIMUM_PROCESSORS value. + */ + T_eq_u32( + rtems_configuration_get_maximum_processors(), + #if defined(RTEMS_SMP) + 5 + #else + 1 + #endif + ); + + /* + * Check the default CONFIGURE_MAXIMUM_REGIONS value. + */ + T_eq_u32( + rtems_configuration_get_maximum_regions(), + 0 + ); + + /* + * Check the configured CONFIGURE_MAXIMUM_SEMAPHORES value. + */ + T_eq_u32( + rtems_configuration_get_maximum_semaphores(), + TEST_MAXIMUM_SEMAPHORES + ); + + /* + * Check the configured CONFIGURE_MAXIMUM_TASKS value. + */ + T_eq_u32( + rtems_configuration_get_maximum_tasks(), + TEST_MAXIMUM_TASKS + ); + + /* + * Check the configured CONFIGURE_MAXIMUM_TIMERS value. + */ + T_eq_u32( + rtems_configuration_get_maximum_timers(), + TEST_MAXIMUM_TIMERS + ); + + /* + * Check the configured CONFIGURE_MICROSECONDS_PER_TICK value in + * microseconds. + */ + T_eq_u32( + rtems_configuration_get_microseconds_per_tick(), + TEST_MICROSECONDS_PER_TICK + ); + + /* + * Check the configured CONFIGURE_MICROSECONDS_PER_TICK value in + * milliseconds. + */ + T_eq_u32( + rtems_configuration_get_milliseconds_per_tick(), + TEST_MICROSECONDS_PER_TICK / 1000 + ); + + /* + * Check the configured CONFIGURE_MICROSECONDS_PER_TICK value in nanoseconds. + */ + T_eq_u32( + rtems_configuration_get_nanoseconds_per_tick(), + TEST_MICROSECONDS_PER_TICK * 1000 + ); + + /* + * Check the configured CONFIGURE_TASK_STACK_ALLOCATOR hook. Using the test + * stack allocator validates also /acfg/if/init-task-construct-storage-size, + * since the test_task_stack_allocate() allocate handler only supports + * CONFIGURE_MAXIMUM_TASKS minus one stacks and the validation test for + * /rtems/task/req/create-errors creates for some pre-condition variants all + * tasks until RTEMS_TOO_MANY is returned. In addition, + * test_task_stack_allocate() checks that the allocation size is greater than + * or equal to TEST_MINIMUM_STACK_SIZE which validates + * CONFIGURE_MINIMUM_TASK_STACK_SIZE. + */ + T_eq_ptr( + rtems_configuration_get_stack_allocate_hook(), + test_task_stack_allocate + ); + + /* + * Check the configured CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE + * value. + */ + T_true( rtems_configuration_get_stack_allocator_avoids_work_space() ); + + /* + * Check the configured CONFIGURE_TASK_STACK_DEALLOCATOR hook. + */ + T_eq_ptr( + rtems_configuration_get_stack_free_hook(), + test_task_stack_deallocate + ); + + /* + * Check the configured CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE hook. + */ + T_eq_ptr( + rtems_configuration_get_stack_allocate_for_idle_hook(), + test_idle_task_stack_allocate + ); + + /* + * Check the configured CONFIGURE_IDLE_TASK_STACK_SIZE value. + */ + T_eq_sz( + rtems_configuration_get_idle_task_stack_size(), + TEST_IDLE_STACK_SIZE + ); + + /* + * Check the configured CONFIGURE_INTERRUPT_STACK_SIZE value. + */ + T_eq_sz( + rtems_configuration_get_interrupt_stack_size(), + TEST_INTERRUPT_STACK_SIZE + ); + + /* + * Check the configured CONFIGURE_TICKS_PER_TIMESLICE value. + */ + T_eq_u32( + rtems_configuration_get_ticks_per_timeslice(), + TEST_TICKS_PER_TIMESLICE + ); +} + +/** + * @fn void T_case_body_AcfgValAcfg( void ) + */ +T_TEST_CASE( AcfgValAcfg ) +{ + AcfgValAcfg_Action_0(); +} + +/** @} */ diff --git a/testsuites/validation/ts-validation-acfg-0.c b/testsuites/validation/ts-validation-acfg-0.c new file mode 100644 index 0000000000..e1144dd95d --- /dev/null +++ b/testsuites/validation/ts-validation-acfg-0.c @@ -0,0 +1,89 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestSuiteTestsuitesValidationAcfg0 + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ts-acfg.h" +#include "tx-support.h" + +#include + +/** + * @defgroup RTEMSTestSuiteTestsuitesValidationAcfg0 \ + * spec:/testsuites/validation-acfg-0 + * + * @ingroup RTEMSTestSuites + * + * @brief This validation test suite is used to validate the default value of + * application configuration options taking the optional BSP provided + * settings into account. + * + * @{ + */ + +const char rtems_test_name[] = "ValidationAcfg0"; + +#define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION + +void *IdleBody( uintptr_t ignored ) +{ + (void) ignored; + RunTestSuite(); +} + +#define CONFIGURE_IDLE_TASK_BODY IdleBody + +#define CONFIGURE_INIT + +#include + +/** @} */ diff --git a/testsuites/validation/ts-validation-acfg-1.c b/testsuites/validation/ts-validation-acfg-1.c new file mode 100644 index 0000000000..863a672b23 --- /dev/null +++ b/testsuites/validation/ts-validation-acfg-1.c @@ -0,0 +1,111 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSTestSuiteTestsuitesValidationAcfg1 + */ + +/* + * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file is part of the RTEMS quality process and was automatically + * generated. If you find something that needs to be fixed or + * worded better please post a report or patch to an RTEMS mailing list + * or raise a bug report: + * + * https://www.rtems.org/bugs.html + * + * For information on updating and regenerating please refer to the How-To + * section in the Software Requirements Engineering chapter of the + * RTEMS Software Engineering manual. The manual is provided as a part of + * a release. For development sources please refer to the online + * documentation at: + * + * https://docs.rtems.org + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "ts-acfg.h" + +#include + +/** + * @defgroup RTEMSTestSuiteTestsuitesValidationAcfg1 \ + * spec:/testsuites/validation-acfg-1 + * + * @ingroup RTEMSTestSuites + * + * @brief This validation test suite is used to validate the default value of + * application configuration options where all optional BSP provided settings + * are disabled. + * + * @{ + */ + +const char rtems_test_name[] = "ValidationAcfg1"; + +static void FatalExtension( + rtems_fatal_source source, + bool always_set_to_false, + rtems_fatal_code code +) +{ + rtems_extensions_table bsp = BSP_INITIAL_EXTENSION; + + ( *bsp.fatal )( source, always_set_to_false, code ); +} + +static void Init( rtems_task_argument arg ) +{ + (void) arg; + RunTestSuite(); +} + +#define CONFIGURE_INITIAL_EXTENSIONS { .fatal = FatalExtension } + +#define CONFIGURE_DISABLE_BSP_SETTINGS + +#define CONFIGURE_MAXIMUM_TASKS 1 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE \ + RTEMS_TASK_STORAGE_SIZE( \ + RTEMS_MINIMUM_STACK_SIZE, \ + RTEMS_DEFAULT_ATTRIBUTES \ + ) + +#define CONFIGURE_INIT + +#include + +/** @} */ -- cgit v1.2.3