summaryrefslogtreecommitdiffstats
path: root/spec/testsuites
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-04-24 14:49:27 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-05-28 10:34:23 +0200
commit0dee9e48a97276ab15f7e7f5efd3c0c131c708ba (patch)
tree037f1932f0acf3cedf91ffd11860445077be8267 /spec/testsuites
parentvalidation: Move documentation to test case body (diff)
downloadrtems-central-0dee9e48a97276ab15f7e7f5efd3c0c131c708ba.tar.bz2
Generate a test suite with two test cases
Diffstat (limited to 'spec/testsuites')
-rw-r--r--spec/testsuites/validation/c-library.yml78
-rw-r--r--spec/testsuites/validation/classic-barrier.yml86
-rw-r--r--spec/testsuites/validation/profile.yml158
3 files changed, 322 insertions, 0 deletions
diff --git a/spec/testsuites/validation/c-library.yml b/spec/testsuites/validation/c-library.yml
new file mode 100644
index 00000000..3ccc95ef
--- /dev/null
+++ b/spec/testsuites/validation/c-library.yml
@@ -0,0 +1,78 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+test-case-actions:
+- action: |
+ p = aligned_alloc(128, 4);
+ checks:
+ - check: |
+ T_step_not_null(${step}, p);
+ description: |
+ Check that the returned pointer is not NULL.
+ links: []
+ - check: |
+ T_step_eq_uptr(${step}, (uintptr_t) p % 128, 0);
+ description: |
+ Check that the returned pointer is aligned by 128 bytes.
+ links: []
+ description: |
+ Allocate four bytes with an alignment of 128 bytes with aligned_alloc().
+ links: []
+- action: |
+ p = rtems_malloc(4);
+ checks:
+ - check: |
+ T_step_not_null(${step}, p);
+ description: |
+ Check that the returned pointer is not NULL.
+ links: []
+ description: |
+ Allocate four bytes with rtems_malloc().
+ links: []
+- action: |
+ d = 1;
+ memset(&d, 0, sizeof(d));
+ checks:
+ - check: |
+ T_step_eq_int(${step}, d, 0);
+ description: |
+ Check that the integer variable is equal to zero.
+ links: []
+ description: |
+ Set an integer variable to one and then to zero with memset().
+ links: []
+- action: |
+ s = 1;
+ d = 2;
+ memcpy(&d, &s, sizeof(d));
+ checks:
+ - check: |
+ T_step_eq_int(${step}, d, 1);
+ description: |
+ Check that the destination integer variable is equal to one.
+ links: []
+ description: |
+ Set a source integer variable to one, set a destination integer variable to
+ two, and copy the source to the destination variable through memcpy().
+ links: []
+test-case-brief: |
+ This test case calls functions of the C Library which are included in the
+ space profile.
+test-case-description: null
+test-case-epilogue: null
+test-case-fixture: null
+test-case-name: Space Profile C Library
+test-case-prologue: |
+ void *p;
+ int s;
+ int d;
+test-case-support: null
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: []
+includes:
+- rtems.h
+- stdlib.h
+- rtems/malloc.h
+links: []
+local-includes: []
+source: testsuites/validation/tc-space-profile.c
+type: test-case
diff --git a/spec/testsuites/validation/classic-barrier.yml b/spec/testsuites/validation/classic-barrier.yml
new file mode 100644
index 00000000..543b1d9a
--- /dev/null
+++ b/spec/testsuites/validation/classic-barrier.yml
@@ -0,0 +1,86 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+test-case-actions:
+- action: |
+ id = 0xffffffff;
+ sc = rtems_barrier_create(name, RTEMS_BARRIER_AUTOMATIC_RELEASE, 1, &id);
+ checks:
+ - check: |
+ T_step_rsc_success(${step}, sc);
+ description: |
+ Check that the barrier creation was successful.
+ links: []
+ description: |
+ Set an object identifier to an invalid value and create an automatic
+ release barrier object for one task.
+ links: []
+- action: |
+ id2 = 0xffffffff;
+ sc = rtems_barrier_ident(name, &id2);
+ checks:
+ - check: |
+ T_step_rsc_success(${step}, sc);
+ description: |
+ Check that the barrier identification by name was successful.
+ links: []
+ - check: |
+ T_step_eq_u32(${step}, id, id2);
+ description: |
+ Check that the second identifier is equal to the one returned by the
+ barrier creation.
+ links: []
+ description: |
+ Set a second object identifier to an invalid value and identify a barrier
+ object by its name.
+ links: []
+- action: |
+ released = 1;
+ sc = rtems_barrier_release(id, &released);
+ checks:
+ - check: |
+ T_step_rsc_success(${step}, sc);
+ description: |
+ Check that the barrier release was successful.
+ links: []
+ - check: |
+ T_step_eq_u32(${step}, released, 0);
+ description: |
+ Check that the count of released tasks is zero.
+ links: []
+ description: |
+ Set the count of released tasks to one and release the barrier.
+ links: []
+- action: |
+ sc = rtems_barrier_wait(id, RTEMS_NO_TIMEOUT);
+ checks:
+ - check: |
+ T_step_rsc_success(${step}, sc);
+ description: |
+ Check that the barrier wait was successful.
+ links: []
+ description: |
+ Wait with an infinite timeout for the barrier.
+ links: []
+test-case-brief: |
+ This test case calls functions of the Barrier Manager which are included in
+ the space profile.
+test-case-description: null
+test-case-epilogue: |
+ T_check_rtems_barriers(T_EVENT_RUN_INITIALIZE_EARLY, T_case_name());
+test-case-fixture: null
+test-case-name: Space Profile Classic Barriers
+test-case-prologue: |
+ static const rtems_name name = rtems_build_name('B', 'A', 'R', 'R');
+ rtems_status_code sc;
+ rtems_id id;
+ rtems_id id2;
+ uint32_t released;
+test-case-support: null
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: []
+includes:
+- rtems.h
+links: []
+local-includes: []
+source: testsuites/validation/tc-space-profile.c
+type: test-case
diff --git a/spec/testsuites/validation/profile.yml b/spec/testsuites/validation/profile.yml
new file mode 100644
index 00000000..fa3c0171
--- /dev/null
+++ b/spec/testsuites/validation/profile.yml
@@ -0,0 +1,158 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: []
+includes:
+- rtems.h
+- rtems/bspIo.h
+- rtems/sysinit.h
+- rtems/score/sysstate.h
+links: []
+local-includes: []
+source: testsuites/validation/ts-space-profile.c
+test-suite-code: |
+ #define NAME rtems_build_name('N', 'A', 'M', 'E')
+
+ static void fatal_extension(
+ rtems_fatal_source source,
+ bool always_set_to_false,
+ rtems_fatal_code error
+ )
+ {
+ T_make_runner();
+ T_step_eq_int(0, source, RTEMS_FATAL_SOURCE_APPLICATION);
+ T_step_false(1, always_set_to_false, "always_set_to_false");
+ T_step_eq_ulong(2, error, 123);
+ T_case_end();
+ T_run_finalize();
+ }
+
+ static void Init(rtems_task_argument arg)
+ {
+ (void) arg;
+
+ T_make_runner();
+ T_register();
+ T_run_all();
+ T_case_begin("SpaceProfileFatalError", NULL);
+ T_plan(3);
+ rtems_fatal(RTEMS_FATAL_SOURCE_APPLICATION, 123);
+ }
+
+ static char init_task_stack[RTEMS_MINIMUM_STACK_SIZE];
+
+ static char buffer[512];
+
+ static void check_task_context(T_event event, const char *name)
+ {
+ if (_System_state_Is_up(_System_state_Get())) {
+ T_check_task_context(event, name);
+ }
+ }
+
+ static const T_action actions[] = {
+ T_report_hash_sha256,
+ 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 = "SpaceProfile",
+ .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 init_task(void)
+ {
+ static const rtems_task_config task_config = {
+ .name = NAME,
+ .initial_priority = 1,
+ .stack_area = init_task_stack,
+ .stack_size = sizeof(init_task_stack),
+ .initial_modes = RTEMS_DEFAULT_MODES,
+ .attribute_set = RTEMS_DEFAULT_ATTRIBUTES
+ };
+ rtems_id id;
+ rtems_status_code sc;
+
+ T_run_initialize(&test_config);
+ T_case_begin("SpaceProfileTaskBuild", NULL);
+ T_plan(2);
+
+ sc = rtems_task_build(&task_config, &id);
+ T_step_rsc_success(0, sc);
+
+ sc = rtems_task_start(id, Init, 0);
+ T_step_rsc_success(1, sc);
+
+ T_check_rtems_tasks(T_EVENT_RUN_INITIALIZE_EARLY, T_case_name());
+ T_case_end();
+ }
+
+ RTEMS_SYSINIT_ITEM(
+ init_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 1
+
+ #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
+
+ #define CONFIGURE_MAXIMUM_PARTITIONS 1
+
+ #define CONFIGURE_MAXIMUM_PERIODS 1
+
+ #define CONFIGURE_MAXIMUM_SEMAPHORES 1
+
+ #define CONFIGURE_MAXIMUM_TASKS 1
+
+ #define CONFIGURE_MAXIMUM_TIMERS 1
+
+ #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
+
+ #define CONFIGURE_MESSAGE_BUFFER_MEMORY 1
+
+ #define CONFIGURE_MICROSECONDS_PER_TICK 10000
+
+ #define CONFIGURE_SCHEDULER_NAME NAME
+
+ #define CONFIGURE_INITIAL_EXTENSIONS { .fatal = fatal_extension }
+
+ /* Mandatory for space profile */
+
+ #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
+
+ #define CONFIGURE_INIT
+
+ #include <rtems/confdefs.h>
+test-suite-brief: |
+ This test suite contains test cases which call in combination all functions
+ included in the space profile.
+test-suite-description: null
+test-suite-name: Space Profile
+type: test-suite