[rtems-central commit] spec: add unit test to cover get_config_max()
Sebastian Huber
sebh at rtems.org
Wed Oct 13 07:58:21 UTC 2021
Module: rtems-central
Branch: master
Commit: 331dc0cb890760b6acf5cd95182d21fb2f2650b2
Changeset: http://git.rtems.org/rtems-central/commit/?id=331dc0cb890760b6acf5cd95182d21fb2f2650b2
Author: Frank Kühndel <frank.kuehndel at embedded-brains.de>
Date: Tue Oct 12 19:22:23 2021 +0200
spec: add unit test to cover get_config_max()
---
spec/rtems/config/unit/config.yml | 63 +++++++++++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)
diff --git a/spec/rtems/config/unit/config.yml b/spec/rtems/config/unit/config.yml
new file mode 100644
index 0000000..031f471
--- /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
More information about the vc
mailing list