[PATCH v5 6/7] validation: Add general purpose test suite
Sebastian Huber
sebastian.huber at embedded-brains.de
Wed Sep 16 14:49:09 UTC 2020
Add a general purpose test suite for validation tests.
This is the first test suite generated from a specification item in the
rtems-central repository.
Update #3959.
---
Doxyfile | 2 +-
cpukit/doxygen/top-level-groups.h | 6 +
spec/build/testsuites/grp.yml | 4 +
spec/build/testsuites/optvalidation.yml | 15 ++
spec/build/testsuites/validation/grp.yml | 18 ++
.../testsuites/validation/validation-0.yml | 19 ++
testsuites/validation/ts-validation-0.c | 222 ++++++++++++++++++
7 files changed, 285 insertions(+), 1 deletion(-)
create mode 100644 spec/build/testsuites/optvalidation.yml
create mode 100644 spec/build/testsuites/validation/grp.yml
create mode 100644 spec/build/testsuites/validation/validation-0.yml
create mode 100644 testsuites/validation/ts-validation-0.c
diff --git a/Doxyfile b/Doxyfile
index c794938191..ffb87fe89d 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -812,7 +812,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
-INPUT = bsps cpukit
+INPUT = bsps cpukit testsuites/validation
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
diff --git a/cpukit/doxygen/top-level-groups.h b/cpukit/doxygen/top-level-groups.h
index a177e8a715..c1a91a3482 100644
--- a/cpukit/doxygen/top-level-groups.h
+++ b/cpukit/doxygen/top-level-groups.h
@@ -42,3 +42,9 @@
*
* @brief RTEMS Implementation.
*/
+
+/**
+ * @defgroup RTEMSTestSuites Test Suites
+ *
+ * @brief Collection of Test Suites
+ */
diff --git a/spec/build/testsuites/grp.yml b/spec/build/testsuites/grp.yml
index ec2b6c616b..5c6457f06d 100644
--- a/spec/build/testsuites/grp.yml
+++ b/spec/build/testsuites/grp.yml
@@ -34,6 +34,8 @@ links:
uid: optsp
- role: build-dependency
uid: opttm
+- role: build-dependency
+ uid: optvalidation
- role: build-dependency
uid: ada/grp
- role: build-dependency
@@ -58,6 +60,8 @@ links:
uid: sptests/grp
- role: build-dependency
uid: tmtests/grp
+- role: build-dependency
+ uid: validation/grp
type: build
use-after:
- rtemscpu
diff --git a/spec/build/testsuites/optvalidation.yml b/spec/build/testsuites/optvalidation.yml
new file mode 100644
index 0000000000..81eb320d53
--- /dev/null
+++ b/spec/build/testsuites/optvalidation.yml
@@ -0,0 +1,15 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+actions:
+- get-boolean: null
+- env-enable: null
+build-type: option
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+default: false
+default-by-variant: []
+description: |
+ Build the validation test programs (may be also enabled by BUILD_TESTS)
+enabled-by: true
+links: []
+name: BUILD_VALIDATIONTESTS
+type: build
diff --git a/spec/build/testsuites/validation/grp.yml b/spec/build/testsuites/validation/grp.yml
new file mode 100644
index 0000000000..390fb48803
--- /dev/null
+++ b/spec/build/testsuites/validation/grp.yml
@@ -0,0 +1,18 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+build-type: group
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by:
+- BUILD_TESTS
+- BUILD_VALIDATIONTESTS
+includes:
+- ${BSP_INCLUDES}
+install: []
+ldflags: []
+links:
+- role: build-dependency
+ uid: validation-0
+type: build
+use-after:
+- rtemstest
+use-before: []
diff --git a/spec/build/testsuites/validation/validation-0.yml b/spec/build/testsuites/validation/validation-0.yml
new file mode 100644
index 0000000000..d024efb96f
--- /dev/null
+++ b/spec/build/testsuites/validation/validation-0.yml
@@ -0,0 +1,19 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+build-type: test-program
+cflags: []
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+cppflags: []
+cxxflags: []
+enabled-by: true
+features: c cprogram
+includes: []
+ldflags: []
+links: []
+source:
+- testsuites/validation/ts-validation-0.c
+stlib: []
+target: testsuites/validation/ts-validation-0.exe
+type: build
+use-after: []
+use-before: []
diff --git a/testsuites/validation/ts-validation-0.c b/testsuites/validation/ts-validation-0.c
new file mode 100644
index 0000000000..3e60fb6ab8
--- /dev/null
+++ b/testsuites/validation/ts-validation-0.c
@@ -0,0 +1,222 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestSuiteTestsuitesValidation0
+ */
+
+/*
+ * Copyright (C) 2020 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 was automatically generated. Do not edit it manually.
+ * Please have a look at
+ *
+ * https://docs.rtems.org/branches/master/eng/req/howto.html
+ *
+ * for information how to maintain and re-generate this file.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems.h>
+#include <rtems/bspIo.h>
+#include <rtems/sysinit.h>
+
+#include <rtems/test.h>
+
+/**
+ * @defgroup RTEMSTestSuiteTestsuitesValidation0 spec:/testsuites/validation-0
+ *
+ * @ingroup RTEMSTestSuites
+ *
+ * @brief This general purpose validation test suite provides enough resources
+ * to run basic tests for all specified managers and functions.
+ *
+ * In SMP configurations, up to three scheduler instances using the SMP EDF
+ * scheduler are provided using up to four processors.
+ *
+ * @{
+ */
+
+#include <rtems/test-info.h>
+
+const char rtems_test_name[] = "Validation0";
+
+static char buffer[ 512 ];
+
+static const T_action actions[] = {
+ T_report_hash_sha256,
+ T_check_task_context,
+ T_check_rtems_barriers,
+ T_check_rtems_extensions,
+ T_check_rtems_message_queues,
+ T_check_rtems_partitions,
+ T_check_rtems_periods,
+ T_check_rtems_semaphores,
+ T_check_rtems_tasks,
+ T_check_rtems_timers
+};
+
+static const T_config test_config = {
+ .name = rtems_test_name,
+ .buf = buffer,
+ .buf_size = sizeof( buffer ),
+ .putchar = rtems_put_char,
+ .verbosity = T_VERBOSE,
+ .now = T_now_clock,
+ .action_count = T_ARRAY_SIZE( actions ),
+ .actions = actions
+};
+
+static void runner_task( rtems_task_argument arg )
+{
+ int exit_code;
+
+ (void) arg;
+
+ rtems_test_begin( rtems_test_name, TEST_STATE );
+ T_register();
+ exit_code = T_main( &test_config );
+
+ if ( exit_code == 0 ) {
+ rtems_test_end( rtems_test_name );
+ }
+
+ rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, (uint32_t) exit_code );
+}
+
+#define MAX_TLS_SIZE RTEMS_ALIGN_UP( 64, RTEMS_TASK_STORAGE_ALIGNMENT )
+
+#define ATTRIBUTES RTEMS_FLOATING_POINT
+
+RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT )
+static char runner_task_storage[
+ RTEMS_TASK_STORAGE_SIZE(
+ MAX_TLS_SIZE + RTEMS_MINIMUM_STACK_SIZE,
+ ATTRIBUTES
+ )
+];
+
+static const rtems_task_config runner_task_config = {
+ .name = rtems_build_name( 'R', 'U', 'N', ' ' ),
+ .initial_priority = 1,
+ .storage_area = runner_task_storage,
+ .storage_size = sizeof( runner_task_storage ),
+ .maximum_thread_local_storage_size = MAX_TLS_SIZE,
+ .initial_modes = RTEMS_DEFAULT_MODES,
+ .attributes = ATTRIBUTES
+};
+
+static void init_runner_task(void)
+{
+ rtems_id id;
+ rtems_status_code sc;
+
+ sc = rtems_task_construct( &runner_task_config, &id );
+ if ( sc != RTEMS_SUCCESSFUL ) {
+ rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, 1 );
+ }
+
+ sc = rtems_task_start( id, runner_task, 0 );
+ if ( sc != RTEMS_SUCCESSFUL ) {
+ rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, 1 );
+ }
+}
+
+RTEMS_SYSINIT_ITEM(
+ init_runner_task,
+ RTEMS_SYSINIT_CLASSIC_USER_TASKS,
+ RTEMS_SYSINIT_ORDER_MIDDLE
+);
+
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_PROCESSORS 4
+
+#define CONFIGURE_MAXIMUM_BARRIERS 3
+
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 3
+
+#define CONFIGURE_MAXIMUM_PARTITIONS 3
+
+#define CONFIGURE_MAXIMUM_PERIODS 3
+
+#define CONFIGURE_MAXIMUM_SEMAPHORES 3
+
+#define CONFIGURE_MAXIMUM_TASKS 3
+
+#define CONFIGURE_MINIMUM_TASKS_WITH_USER_PROVIDED_STORAGE \
+ CONFIGURE_MAXIMUM_TASKS
+
+#define CONFIGURE_MAXIMUM_TIMERS 3
+
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 3
+
+#define CONFIGURE_MICROSECONDS_PER_TICK 1000
+
+#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 0
+
+#define CONFIGURE_DISABLE_NEWLIB_REENTRANCY
+
+#define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
+
+#define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION
+
+#define CONFIGURE_IDLE_TASK_BODY _CPU_Thread_Idle_body
+
+#if defined(RTEMS_SMP)
+
+#define CONFIGURE_SCHEDULER_EDF_SMP
+
+#include <rtems/scheduler.h>
+
+RTEMS_SCHEDULER_EDF_SMP(a);
+
+RTEMS_SCHEDULER_EDF_SMP(b);
+
+RTEMS_SCHEDULER_EDF_SMP(c);
+
+#define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
+ RTEMS_SCHEDULER_TABLE_EDF_SMP(a, rtems_build_name('A', ' ', ' ', ' ')), \
+ RTEMS_SCHEDULER_TABLE_EDF_SMP(b, rtems_build_name('B', ' ', ' ', ' ')), \
+ RTEMS_SCHEDULER_TABLE_EDF_SMP(c, rtems_build_name('C', ' ', ' ', ' '))
+
+#define CONFIGURE_SCHEDULER_ASSIGNMENTS \
+ RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY), \
+ RTEMS_SCHEDULER_ASSIGN(1, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL), \
+ RTEMS_SCHEDULER_ASSIGN(2, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL), \
+ RTEMS_SCHEDULER_ASSIGN(2, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL)
+
+#endif /* RTEMS_SMP */
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+
+/** @} */
--
2.26.2
More information about the devel
mailing list