From 1815193066327eddbef402ec76e8b527bdc043a8 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 28 Sep 2021 08:24:34 +0200 Subject: validation: Test application configuration options --- spec/build/testsuites/validation/validation-0.yml | 1 + testsuites/validation/tc-acfg.c | 275 ++++++++++++++++++++++ 2 files changed, 276 insertions(+) create mode 100644 testsuites/validation/tc-acfg.c diff --git a/spec/build/testsuites/validation/validation-0.yml b/spec/build/testsuites/validation/validation-0.yml index c09934af3e..9f4e32efe9 100644 --- a/spec/build/testsuites/validation/validation-0.yml +++ b/spec/build/testsuites/validation/validation-0.yml @@ -12,6 +12,7 @@ ldflags: - -Wl,--wrap=rtems_malloc links: [] source: +- testsuites/validation/tc-acfg.c - testsuites/validation/tc-attr.c - testsuites/validation/tc-barrier-create.c - testsuites/validation/tc-barrier-delete.c diff --git a/testsuites/validation/tc-acfg.c b/testsuites/validation/tc-acfg.c new file mode 100644 index 0000000000..fb8723a24c --- /dev/null +++ b/testsuites/validation/tc-acfg.c @@ -0,0 +1,275 @@ +/* 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 "ts-config.h" +#include "tx-support.h" + +#include + +/** + * @defgroup RTEMSTestCaseAcfgValAcfg spec:/acfg/val/acfg + * + * @ingroup RTEMSTestSuiteTestsuitesValidation0 + * + * @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 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 configured CONFIGURE_MAXIMUM_PROCESSORS 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. + * + * - Check the configured CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE + * value. + * + * - Check the configured CONFIGURE_TASK_STACK_DEALLOCATOR hook. + * + * - Check the configured CONFIGURE_TICKS_PER_TIMESLICE value. + * + * @{ + */ + +/** + * @brief Check the effect of application configuration options. + */ +static void AcfgValAcfg_Action_0( void ) +{ + /* Nothing to do */ + + /* + * 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 configured CONFIGURE_MAXIMUM_PROCESSORS value. + */ + T_eq_u32( + rtems_configuration_get_maximum_processors(), + #if defined(RTEMS_SMP) + 5 + #else + 1 + #endif + ); + + /* + * 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. + */ + 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_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(); +} + +/** @} */ -- cgit v1.2.3