summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Kühndel <frank.kuehndel@embedded-brains.de>2021-10-12 19:22:23 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-10-13 09:55:54 +0200
commit331dc0cb890760b6acf5cd95182d21fb2f2650b2 (patch)
treeb9b37a639a8919e45a290f0df73be611be68e669
parentspec: timer: improve test for branch coverage (diff)
downloadrtems-central-331dc0cb890760b6acf5cd95182d21fb2f2650b2.tar.bz2
spec: add unit test to cover get_config_max()
-rw-r--r--spec/rtems/config/unit/config.yml63
1 files changed, 63 insertions, 0 deletions
diff --git a/spec/rtems/config/unit/config.yml b/spec/rtems/config/unit/config.yml
new file mode 100644
index 00000000..031f471d
--- /dev/null
+++ b/spec/rtems/config/unit/config.yml
@@ -0,0 +1,63 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links: []
+test-actions:
+- action-brief: |
+ Call get_config_max() indirectly through
+ rtems_configuration_get_maximum_semaphores() with a specially manipulated
+ argument to enter an if-branch only accessed when unlimited objects
+ are configured.
+ action-code: |
+ uint32_t max = rtems_configuration_get_maximum_semaphores();
+ checks:
+ - brief: |
+ The value returned by the function call must be the one artificially
+ injected by this test.
+ code: |
+ T_eq_u32( max, SEMAPHORES_PER_BLOCK | RTEMS_UNLIMITED_OBJECTS );
+ links: []
+ links:
+ - name: get_config_max
+ role: unit-test
+ uid: ../../../score/if/domain
+test-brief: |
+ Unit tests for the configuration manager.
+test-context:
+- brief: |
+ This member contains the original value of
+ ``_Semaphore_Information->objects_per_block``.
+ description: null
+ member: |
+ Objects_Maximum objects_per_block_ori
+test-context-support: |
+ #define SEMAPHORES_PER_BLOCK 32
+test-description: |
+ Parts of the file ``cpukit/sapi/src/getconfigmax.c``
+ are only executed when unlimited objects are configured. The
+ space qualified code subset does not support this feature. This test
+ exercises the code parts otherwise not reached in order to achieve full
+ code coverage.
+test-header: null
+test-includes:
+- rtems.h
+- rtems/rtems/semdata.h
+- rtems/score/object.h
+- rtems/score/objectdata.h
+test-local-includes: []
+test-setup:
+ brief: null
+ code: |
+ ctx->objects_per_block_ori = _Semaphore_Information.objects_per_block;
+ _Semaphore_Information.objects_per_block = SEMAPHORES_PER_BLOCK;
+ description: null
+test-stop: null
+test-support: null
+test-target: testsuites/unit/tc-config.c
+test-teardown:
+ brief: null
+ code: |
+ _Semaphore_Information.objects_per_block = ctx->objects_per_block_ori;
+ description: null
+type: test-case