From 8ee33e32c182eecd3109a3255b393eabb3745da7 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 3 Jan 2025 02:08:42 +0100 Subject: [PATCH] validation: Test no scheduler assignment --- spec/build/testsuites/validation/grp.yml | 2 + .../validation/validation-smp-only-1.yml | 20 +++ .../validation/tc-acfg-assign-no-scheduler.c | 117 ++++++++++++++++++ .../validation/ts-validation-smp-only-1.c | 93 ++++++++++++++ 4 files changed, 232 insertions(+) create mode 100644 spec/build/testsuites/validation/validation-smp-only-1.yml create mode 100644 testsuites/validation/tc-acfg-assign-no-scheduler.c create mode 100644 testsuites/validation/ts-validation-smp-only-1.c diff --git a/spec/build/testsuites/validation/grp.yml b/spec/build/testsuites/validation/grp.yml index acf9bd2a64..f1461228b0 100644 --- a/spec/build/testsuites/validation/grp.yml +++ b/spec/build/testsuites/validation/grp.yml @@ -66,6 +66,8 @@ links: uid: validation-smp-one-cpu-0 - role: build-dependency uid: validation-smp-only-0 +- role: build-dependency + uid: validation-smp-only-1 - role: build-dependency uid: validation-smp-only-2 - role: build-dependency diff --git a/spec/build/testsuites/validation/validation-smp-only-1.yml b/spec/build/testsuites/validation/validation-smp-only-1.yml new file mode 100644 index 0000000000..71b82a4bbe --- /dev/null +++ b/spec/build/testsuites/validation/validation-smp-only-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) 2024 embedded brains GmbH & Co. KG +cppflags: [] +cxxflags: [] +enabled-by: RTEMS_SMP +features: c cprogram +includes: [] +ldflags: [] +links: [] +source: +- testsuites/validation/tc-acfg-assign-no-scheduler.c +- testsuites/validation/ts-validation-smp-only-1.c +stlib: [] +target: testsuites/validation/ts-validation-smp-only-1.exe +type: build +use-after: [] +use-before: [] diff --git a/testsuites/validation/tc-acfg-assign-no-scheduler.c b/testsuites/validation/tc-acfg-assign-no-scheduler.c new file mode 100644 index 0000000000..ad9b304365 --- /dev/null +++ b/testsuites/validation/tc-acfg-assign-no-scheduler.c @@ -0,0 +1,117 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup AcfgValSchedulerAssignNoScheduler + */ + +/* + * 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 + +#include + +/** + * @defgroup AcfgValSchedulerAssignNoScheduler \ + * spec:/acfg/val/scheduler-assign-no-scheduler + * + * @ingroup TestsuitesValidationSmpOnly1 + * + * @brief Tests the effect of RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER. + * + * This test case performs the following actions: + * + * - Check the effect of RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER. + * + * - Check that the two configured processors are present. + * + * - Check that the second processor has no scheduler assigned. + * + * - Check that the second processor cannot be assigned to a scheduler. + * + * @{ + */ + +/** + * @brief Check the effect of RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER. + */ +static void AcfgValSchedulerAssignNoScheduler_Action_0( void ) +{ + rtems_status_code sc; + rtems_id id; + + /* + * Check that the two configured processors are present. + */ + T_eq_u32( rtems_scheduler_get_processor_maximum(), 2 ); + + /* + * Check that the second processor has no scheduler assigned. + */ + sc = rtems_scheduler_ident_by_processor( 1, &id ); + T_rsc( sc, RTEMS_INCORRECT_STATE ); + + /* + * Check that the second processor cannot be assigned to a scheduler. + */ + sc = rtems_scheduler_ident_by_processor( 0, &id ); + T_rsc_success( sc ); + + sc = rtems_scheduler_add_processor( id, 1 ); + T_rsc( sc, RTEMS_NOT_CONFIGURED ); +} + +/** + * @fn void T_case_body_AcfgValSchedulerAssignNoScheduler( void ) + */ +T_TEST_CASE( AcfgValSchedulerAssignNoScheduler ) +{ + AcfgValSchedulerAssignNoScheduler_Action_0(); +} + +/** @} */ diff --git a/testsuites/validation/ts-validation-smp-only-1.c b/testsuites/validation/ts-validation-smp-only-1.c new file mode 100644 index 0000000000..e6b94070e8 --- /dev/null +++ b/testsuites/validation/ts-validation-smp-only-1.c @@ -0,0 +1,93 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup TestsuitesValidationSmpOnly1 + */ + +/* + * 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 "ts-config.h" + +#include + +/** + * @defgroup TestsuitesValidationSmpOnly1 \ + * spec:/testsuites/validation-smp-only-1 + * + * @ingroup RTEMSTestSuitesValidation + * + * @brief This SMP-only test suite validates the clustered scheduler + * configuration through an application configuration with a processor + * maximum of two. The second processor is not assigned to a scheduler. + * + * @{ + */ + +const char rtems_test_name[] = "TestsuitesValidationSmpOnly1"; + +#define CONFIGURE_MAXIMUM_PROCESSORS 2 + +#include + +#define CONFIGURE_SCHEDULER_EDF_SMP + +#include + +RTEMS_SCHEDULER_EDF_SMP( a ); + +#define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ + RTEMS_SCHEDULER_TABLE_EDF_SMP( a, TEST_SCHEDULER_A_NAME ) + +#define CONFIGURE_SCHEDULER_ASSIGNMENTS \ + RTEMS_SCHEDULER_ASSIGN( 0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY ), \ + RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER + +#include "ts-default.h" + +/** @} */