diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-02-15 17:56:22 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-02-23 09:18:17 +0100 |
commit | c061f7b3c955e1d9e6f25be7acfb6de262c791f3 (patch) | |
tree | f5658cd37534779c9b64ee8d6072d9db5e25ff84 | |
parent | spec2modules.py: Add --diff option (diff) | |
download | rtems-central-c061f7b3c955e1d9e6f25be7acfb6de262c791f3.tar.bz2 |
spec: Use test cases for validation
23 files changed, 333 insertions, 56 deletions
diff --git a/spec/acfg/val/acfg.yml b/spec/acfg/val/acfg.yml index 272c5ee5..7419d4bc 100644 --- a/spec/acfg/val/acfg.yml +++ b/spec/acfg/val/acfg.yml @@ -5,7 +5,15 @@ enabled-by: true links: [] test-actions: - action-brief: | - Check the effect of application configuration options. + Check the effect of application configuration options. In addition, this + test case validates the effect of ${../if/init:/name}. The test case + includes ${../if/header:/path} without defining ${../if/init:/name} 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 ${../if/init:/name} 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. action-code: | rtems_status_code sc; rtems_id id; @@ -344,7 +352,9 @@ test-actions: uid: ../req/ticks-per-time-slice - role: validation uid: /rtems/config/req/get-ticks-per-timeslice - links: [] + links: + - role: validation + uid: ../req/init test-brief: | Tests the effect of application configuration options. test-context: [] @@ -353,6 +363,7 @@ test-description: null test-header: null test-includes: - bsp.h +- rtems/confdefs.h - rtems/score/heap.h test-local-includes: - ts-config.h diff --git a/spec/acfg/val/appl-does-not-need-clock-driver.yml b/spec/acfg/val/appl-does-not-need-clock-driver.yml new file mode 100644 index 00000000..f468744a --- /dev/null +++ b/spec/acfg/val/appl-does-not-need-clock-driver.yml @@ -0,0 +1,62 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +copyrights: +- Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de) +enabled-by: true +links: [] +test-actions: +- action-brief: | + Get the current clock ticks since boot value. Busy wait for at least one + clock tick interval. + action-code: | + 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; + } + checks: + - brief: | + Check that the clock ticks since boot count did not change while busy + waiting for more than one clock tick interval. + code: | + T_step_eq_u32( + ${step}, + rtems_clock_get_ticks_since_boot(), + ticks_since_boot + ); + links: + - role: validation + uid: ../req/appl-does-not-need-clock-driver + links: [] +test-brief: | + Tests the effect of the ${../if/appl-does-not-need-clock-driver:/name} + application configuration option. +test-context: [] +test-context-support: null +test-description: null +test-header: null +test-includes: +- rtems.h +test-local-includes: [] +test-setup: null +test-stop: null +test-support: null +test-target: testsuites/validation/tc-acfg-appl-does-not-need-clock-driver.c +test-teardown: null +type: test-case diff --git a/spec/acfg/val/appl-needs-clock-driver.yml b/spec/acfg/val/appl-needs-clock-driver.yml new file mode 100644 index 00000000..dab34ddf --- /dev/null +++ b/spec/acfg/val/appl-needs-clock-driver.yml @@ -0,0 +1,62 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +copyrights: +- Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de) +enabled-by: true +links: [] +test-actions: +- action-brief: | + Get the current clock ticks since boot value. Busy wait for at least one + clock tick interval. + action-code: | + 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; + } + checks: + - brief: | + Check that the clock ticks since boot count changed while busy waiting + for more than one clock tick interval. + code: | + T_step_gt_u32( + ${step}, + rtems_clock_get_ticks_since_boot() - ticks_since_boot, + 0 + ); + links: + - role: validation + uid: ../req/appl-needs-clock-driver + links: [] +test-brief: | + Tests the effect of the ${../if/appl-needs-clock-driver:/name} application + configuration option. +test-context: [] +test-context-support: null +test-description: null +test-header: null +test-includes: +- rtems.h +test-local-includes: [] +test-setup: null +test-stop: null +test-support: null +test-target: testsuites/validation/tc-acfg-appl-needs-clock-driver.c +test-teardown: null +type: test-case diff --git a/spec/acfg/val/default.yml b/spec/acfg/val/default.yml index 3edc00bb..3cf7f91b 100644 --- a/spec/acfg/val/default.yml +++ b/spec/acfg/val/default.yml @@ -208,6 +208,23 @@ test-actions: links: - role: validation uid: ../if/max-tasks + - brief: | + Check the default ${/acfg/if/max-tasks:/name} value. A maximum Classic + API task value of zero is only configurable if + ${../if/idle-task-init-appl:/name} is defined or + ${../if/max-posix-threads:/name} is set to a positive value. The default + value of zero for ${../if/max-posix-threads:/name} is used by the test + suite containing the test case. The test suite defines + ${../if/idle-task-init-appl:/name}. + code: | + T_step_eq_u32( ${step}, rtems_configuration_get_maximum_tasks(), 0 ); + links: + - role: validation + uid: ../req/max-tasks + - role: validation + uid: ../req/idle-task-init-appl + - role: validation + uid: /rtems/config/req/get-maximum-tasks links: [] - action-brief: | Try to create a timer. diff --git a/spec/acfg/val/fatal-init-task-construct-failed.yml b/spec/acfg/val/fatal-init-task-construct-failed.yml index 6b69bfb6..83e10347 100644 --- a/spec/acfg/val/fatal-init-task-construct-failed.yml +++ b/spec/acfg/val/fatal-init-task-construct-failed.yml @@ -28,9 +28,21 @@ test-actions: links: - role: validation uid: ../req/fatal-init-task-construct-failed + - brief: | + Check that the ${../if/init-task-priority:/name} application + configuration option resulted in the expected system setting. + code: | + T_step_eq_u32( + ${step}, + _RTEMS_tasks_User_task_config.config.initial_priority, + 0 + ); + links: + - role: validation + uid: ../req/init-task-priority links: [] test-brief: | - Tests a fatal error. + Tests a fatal error caused by an invalid application configuration. test-context: [] test-context-support: null test-description: null @@ -54,6 +66,7 @@ test-header: target: testsuites/validation/tr-fatal-init-task-construct-failed.h test-includes: - rtems.h +- rtems/rtems/tasksdata.h test-local-includes: - tr-fatal-init-task-construct-failed.h test-setup: null diff --git a/spec/acfg/val/fatal-too-large-tls-size.yml b/spec/acfg/val/fatal-too-large-tls-size.yml index 00f07a12..0d8f2e8a 100644 --- a/spec/acfg/val/fatal-too-large-tls-size.yml +++ b/spec/acfg/val/fatal-too-large-tls-size.yml @@ -34,6 +34,18 @@ test-actions: links: - role: validation uid: ../req/fatal-too-large-tls-size + - brief: | + Check that the ${/acfg/if/max-thread-local-storage-size:/name} + application configuration option resulted in the expected system setting. + code: | + T_step_eq_sz( + ${step}, + _Thread_Maximum_TLS_size, + RTEMS_TASK_STORAGE_ALIGNMENT + ); + links: + - role: validation + uid: /acfg/if/max-thread-local-storage-size links: [] test-brief: | Tests a fatal error. @@ -60,6 +72,7 @@ test-header: target: testsuites/validation/tr-fatal-too-large-tls-size.h test-includes: - rtems.h +- rtems/score/thread.h test-local-includes: - tr-fatal-too-large-tls-size.h test-setup: null diff --git a/spec/acfg/val/one-cpu.yml b/spec/acfg/val/one-cpu.yml index 6f60ea28..a9438d51 100644 --- a/spec/acfg/val/one-cpu.yml +++ b/spec/acfg/val/one-cpu.yml @@ -9,26 +9,35 @@ test-actions: action-code: | rtems_status_code sc; rtems_id id; + uint32_t yield_count_before; checks: - brief: | - Check the configured ${/acfg/if/max-priority:/name} value using - ${/rtems/task/if/maximum-priority}. This configuration option affects - only the Deterministic Priority Scheduler which was explicitly configured - by ${/acfg/if/scheduler-priority:/name} in the test suite. + Check that the ${/acfg/if/max-priority:/name} application configuration + option resulted in the expected system setting using + ${/rtems/task/if/maximum-priority}. code: | T_eq_u32( RTEMS_MAXIMUM_PRIORITY, 127 ); links: - role: validation uid: ../req/max-priority - role: validation - uid: ../req/scheduler-priority - - role: validation uid: /rtems/task/req/maximum-priority - brief: | - Check the configured ${/acfg/if/max-priority:/name} value using - ${/rtems/task/if/maximum-priority}. This configuration option affects - only the Deterministic Priority Scheduler which was explicitly configured - by ${/acfg/if/scheduler-priority:/name} in the test suite. + Check that the Deterministic Priority Scheduler which was configured by + the ${/acfg/if/scheduler-priority:/name} application configuration in the + test suite. + code: | + 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 ); + links: + - role: validation + uid: ../req/scheduler-priority + - brief: | + Check that we are able to identify the scheduler by the name configured + by the ${/acfg/if/scheduler-priority:/name} application configuration + option in the test suite. code: | sc = rtems_scheduler_ident( TEST_SCHEDULER_A_NAME, &id ); T_rsc_success( sc ); @@ -44,12 +53,36 @@ test-description: null test-header: null test-includes: - rtems.h +- rtems/score/schedulerpriority.h test-local-includes: - ts-config.h - tx-support.h test-setup: null test-stop: null -test-support: null +test-support: | + 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 ); + } test-target: testsuites/validation/tc-acfg-one-cpu.c test-teardown: null type: test-case diff --git a/spec/acfg/val/scheduler-edf-smp.yml b/spec/acfg/val/scheduler-edf-smp.yml new file mode 100644 index 00000000..555070aa --- /dev/null +++ b/spec/acfg/val/scheduler-edf-smp.yml @@ -0,0 +1,66 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +copyrights: +- Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de) +enabled-by: RTEMS_SMP +links: [] +test-actions: +- action-brief: | + Check the effect of application configuration options. + action-code: | + rtems_status_code sc; + uint32_t yield_count_before; + checks: + - brief: | + Check that the Earliest Deadline First SMP Scheduler which was configured + by the ${/acfg/if/scheduler-edf-smp:/name} application configuration in + the test suite. + code: | + 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 ); + links: + - role: validation + uid: ../req/scheduler-edf-smp + links: [] +test-brief: | + Tests the effect of application configuration options. +test-context: [] +test-context-support: null +test-description: null +test-header: null +test-includes: +- rtems.h +- rtems/score/scheduleredfsmp.h +test-local-includes: +- ts-config.h +- tx-support.h +test-setup: null +test-stop: null +test-support: | + 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 ); + } +test-target: testsuites/validation/tc-acfg-scheduler-edf-smp.c +test-teardown: null +type: test-case diff --git a/spec/score/thread/val/tls-max-zero.yml b/spec/score/thread/val/tls-max-zero.yml new file mode 100644 index 00000000..2f0a71af --- /dev/null +++ b/spec/score/thread/val/tls-max-zero.yml @@ -0,0 +1,42 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +copyrights: +- Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de) +enabled-by: true +links: [] +test-actions: +- action-brief: | + The test action is carried out by the thread-local objects definition and + the application configuration. + action-code: | + /* Nothing to do */ + checks: + - brief: | + Check that the ${/acfg/if/max-thread-local-storage-size:/name} + application configuration option resulted in the expected system setting. + Since at least one thread-local objects is available, the referenced + requirement is validated. + code: | + T_step_eq_int( ${step}, tls_object, 0 ); + T_step_eq_sz( ${step}, _Thread_Maximum_TLS_size, 0 ); + links: + - role: validation + uid: ../req/tls-max-zero + - role: validation + uid: /acfg/if/max-thread-local-storage-size + links: [] +test-brief: | + Tests properties of thread-local objects. +test-context: [] +test-context-support: null +test-description: null +test-header: null +test-includes: +- rtems/score/thread.h +test-local-includes: [] +test-setup: null +test-stop: null +test-support: | + static _Thread_local int volatile tls_object; +test-target: testsuites/validation/tc-score-thread-tls-max-zero.c +test-teardown: null +type: test-case diff --git a/spec/testsuites/fatal-boot-processor-not-assigned-to-scheduler.yml b/spec/testsuites/fatal-boot-processor-not-assigned-to-scheduler.yml index 7b81f8e8..4bba3e7e 100644 --- a/spec/testsuites/fatal-boot-processor-not-assigned-to-scheduler.yml +++ b/spec/testsuites/fatal-boot-processor-not-assigned-to-scheduler.yml @@ -5,8 +5,6 @@ enabled-by: RTEMS_SMP links: - role: requirement-refinement uid: /req/test-suites -- role: validation - uid: /score/smp/req/fatal-boot-processor-not-assigned-to-scheduler test-brief: | This validation test suite uses an application configuration which triggers a fatal error during system initialization. diff --git a/spec/testsuites/fatal-bsp-sparc-leon3-shutdown-nop.yml b/spec/testsuites/fatal-bsp-sparc-leon3-shutdown-nop.yml index 276e35bd..32ce70f2 100644 --- a/spec/testsuites/fatal-bsp-sparc-leon3-shutdown-nop.yml +++ b/spec/testsuites/fatal-bsp-sparc-leon3-shutdown-nop.yml @@ -8,8 +8,6 @@ enabled-by: links: - role: requirement-refinement uid: /req/test-suites -- role: validation - uid: /bsp/sparc/leon3/req/fatal-shutdown-request test-brief: | This validation test suite provides an application configuration to perform a shutdown with present but not configured processors and a processor which is diff --git a/spec/testsuites/fatal-init-task-construct-failed.yml b/spec/testsuites/fatal-init-task-construct-failed.yml index f6fedb07..d292c124 100644 --- a/spec/testsuites/fatal-init-task-construct-failed.yml +++ b/spec/testsuites/fatal-init-task-construct-failed.yml @@ -5,8 +5,6 @@ enabled-by: true links: - role: requirement-refinement uid: /req/test-suites -- role: validation - uid: /acfg/if/init-task-priority test-brief: | This validation test suite contains a test case which triggers a fatal error during system initialization. diff --git a/spec/testsuites/fatal-mandatory-processor-not-present.yml b/spec/testsuites/fatal-mandatory-processor-not-present.yml index 1c6189af..1302b1b4 100644 --- a/spec/testsuites/fatal-mandatory-processor-not-present.yml +++ b/spec/testsuites/fatal-mandatory-processor-not-present.yml @@ -5,8 +5,6 @@ enabled-by: RTEMS_SMP links: - role: requirement-refinement uid: /req/test-suites -- role: validation - uid: /score/smp/req/fatal-mandatory-processor-not-present test-brief: | This validation test suite contains a test case which triggers a fatal error during system initialization. diff --git a/spec/testsuites/fatal-scheduler-requires-exactly-one-processor.yml b/spec/testsuites/fatal-scheduler-requires-exactly-one-processor.yml index 5a09f827..8ce3e344 100644 --- a/spec/testsuites/fatal-scheduler-requires-exactly-one-processor.yml +++ b/spec/testsuites/fatal-scheduler-requires-exactly-one-processor.yml @@ -5,8 +5,6 @@ enabled-by: RTEMS_SMP links: - role: requirement-refinement uid: /req/test-suites -- role: validation - uid: /score/smp/req/fatal-scheduler-requires-exactly-one-processor test-brief: | This validation test suite uses an application configuration which triggers a fatal error during system initialization. diff --git a/spec/testsuites/fatal-start-of-mandatory-processor-failed.yml b/spec/testsuites/fatal-start-of-mandatory-processor-failed.yml index d16f4c07..57469912 100644 --- a/spec/testsuites/fatal-start-of-mandatory-processor-failed.yml +++ b/spec/testsuites/fatal-start-of-mandatory-processor-failed.yml @@ -5,8 +5,6 @@ enabled-by: RTEMS_SMP links: - role: requirement-refinement uid: /req/test-suites -- role: validation - uid: /score/smp/req/fatal-start-of-mandatory-processor-failed test-brief: | This validation test suite contains a test case which triggers a fatal error during system initialization. diff --git a/spec/testsuites/fatal-too-large-tls-size.yml b/spec/testsuites/fatal-too-large-tls-size.yml index 7d07b150..54dc98a7 100644 --- a/spec/testsuites/fatal-too-large-tls-size.yml +++ b/spec/testsuites/fatal-too-large-tls-size.yml @@ -5,8 +5,6 @@ enabled-by: true links: - role: requirement-refinement uid: /req/test-suites -- role: validation - uid: /acfg/if/max-thread-local-storage-size test-brief: | This validation test suite contains a test case which triggers a fatal error during system initialization. diff --git a/spec/testsuites/terminate.yml b/spec/testsuites/terminate.yml index c779fcf7..fdf36357 100644 --- a/spec/testsuites/terminate.yml +++ b/spec/testsuites/terminate.yml @@ -5,8 +5,6 @@ enabled-by: true links: - role: requirement-refinement uid: /req/test-suites -- role: validation - uid: /acfg/req/init test-brief: | This validation test suite contains a test case for the system termination procedure. diff --git a/spec/testsuites/validation-0.yml b/spec/testsuites/validation-0.yml index 50e6e074..2204e869 100644 --- a/spec/testsuites/validation-0.yml +++ b/spec/testsuites/validation-0.yml @@ -5,10 +5,6 @@ enabled-by: true links: - role: requirement-refinement uid: /req/test-suites -- role: validation - uid: /acfg/req/appl-needs-clock-driver -- role: validation - uid: /acfg/req/init test-brief: | This general purpose validation test suite provides enough resources to run basic tests for all specified managers and functions. diff --git a/spec/testsuites/validation-acfg-0.yml b/spec/testsuites/validation-acfg-0.yml index 16245513..9a97c6d2 100644 --- a/spec/testsuites/validation-acfg-0.yml +++ b/spec/testsuites/validation-acfg-0.yml @@ -6,19 +6,11 @@ links: - role: requirement-refinement uid: /req/test-suites - role: validation - uid: /acfg/req/appl-does-not-need-clock-driver -- role: validation uid: /acfg/req/max-file-descriptors - role: validation uid: /acfg/req/disable-newlib-reentrancy - role: validation uid: /acfg/req/appl-disable-filesystem -- role: validation - uid: /acfg/req/idle-task-init-appl -- role: validation - uid: /acfg/req/idle-task-body -- role: validation - uid: /acfg/req/init test-brief: | This validation test suite is used to validate the default value of application configuration options taking the optional BSP provided settings diff --git a/spec/testsuites/validation-acfg-1.yml b/spec/testsuites/validation-acfg-1.yml index ee3fd890..f626a666 100644 --- a/spec/testsuites/validation-acfg-1.yml +++ b/spec/testsuites/validation-acfg-1.yml @@ -5,10 +5,6 @@ enabled-by: true links: - role: requirement-refinement uid: /req/test-suites -- role: validation - uid: /acfg/if/disable-bsp-settings -- role: validation - uid: /acfg/req/init test-brief: | This validation test suite is used to validate the default value of application configuration options where all optional BSP provided settings diff --git a/spec/testsuites/validation-one-cpu-0.yml b/spec/testsuites/validation-one-cpu-0.yml index 2893c582..a28544f7 100644 --- a/spec/testsuites/validation-one-cpu-0.yml +++ b/spec/testsuites/validation-one-cpu-0.yml @@ -5,10 +5,6 @@ enabled-by: true links: - role: requirement-refinement uid: /req/test-suites -- role: validation - uid: /acfg/if/scheduler-priority -- role: validation - uid: /acfg/req/init test-brief: | This general purpose validation test suite provides enough resources to run basic tests with exactly one processor and without a diff --git a/spec/testsuites/validation-smp-only-0.yml b/spec/testsuites/validation-smp-only-0.yml index ba9169f7..6d744901 100644 --- a/spec/testsuites/validation-smp-only-0.yml +++ b/spec/testsuites/validation-smp-only-0.yml @@ -5,8 +5,6 @@ enabled-by: RTEMS_SMP links: - role: requirement-refinement uid: /req/test-suites -- role: validation - uid: /acfg/req/scheduler-edf-smp test-brief: | This test suite for SMP-only test cases provides enough resources to run basic tests for all specified managers and functions. diff --git a/spec/testsuites/validation-tls-1.yml b/spec/testsuites/validation-tls-1.yml index 555069a2..c7bdd894 100644 --- a/spec/testsuites/validation-tls-1.yml +++ b/spec/testsuites/validation-tls-1.yml @@ -5,16 +5,12 @@ enabled-by: true links: - role: requirement-refinement uid: /req/test-suites -- role: validation - uid: /score/thread/req/tls-max-zero test-brief: | This validation test suite contains test cases related to the thread-local storage support. test-code: | const char rtems_test_name[] = "${.:/test-suite-name}"; - #define CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE 0 - #include "ts-idle.h" test-description: null test-includes: [] |