[rtems-central commit] spec: Add requirements for unit tests

Sebastian Huber sebh at rtems.org
Fri Sep 2 11:24:35 UTC 2022


Module:    rtems-central
Branch:    master
Commit:    209562c67fc76dbc5c3aa2f255ee6f2d7abb7f07
Changeset: http://git.rtems.org/rtems-central/commit/?id=209562c67fc76dbc5c3aa2f255ee6f2d7abb7f07

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Sep  2 09:03:39 2022 +0200

spec: Add requirements for unit tests

---

 spec/req/unit-test-data-structures.yml | 18 ++++++++++++++++++
 spec/req/unit-test-dead-code.yml       | 19 +++++++++++++++++++
 spec/rtems/config/unit/config.yml      |  4 +++-
 spec/score/msgq/unit/msgq.yml          |  4 +++-
 spec/score/rbtree/unit/rbtree.yml      |  4 +++-
 5 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/spec/req/unit-test-data-structures.yml b/spec/req/unit-test-data-structures.yml
new file mode 100644
index 00000000..613b91b5
--- /dev/null
+++ b/spec/req/unit-test-data-structures.yml
@@ -0,0 +1,18 @@
+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:
+- role: requirement-refinement
+  uid: root
+non-functional-type: design
+rationale: |
+  Implementations to support data structures such as red-black trees a
+  sufficiently complex to require unit tests.  Testing through the API is
+  impractical.
+references: []
+requirement-type: non-functional
+text: |
+  Unit tests may be used to test code which implements reusable data
+  structures.
+type: requirement
diff --git a/spec/req/unit-test-dead-code.yml b/spec/req/unit-test-dead-code.yml
new file mode 100644
index 00000000..57961d16
--- /dev/null
+++ b/spec/req/unit-test-dead-code.yml
@@ -0,0 +1,19 @@
+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:
+- role: requirement-refinement
+  uid: root
+non-functional-type: design
+rationale: |
+  In general, dead code should be avoided.  For justified exceptions it is
+  acceptable, for example to avoid hard to maintain deviations from the RTEMS
+  mainline code.  For these exceptions, unit tests may be used to achieve the
+  code and branch coverage goals.
+references: []
+requirement-type: non-functional
+text: |
+  Unit tests may be used to test code which is not testable through the
+  ${/glossary/api:/term}.
+type: requirement
diff --git a/spec/rtems/config/unit/config.yml b/spec/rtems/config/unit/config.yml
index 031f471d..c81ad8ae 100644
--- a/spec/rtems/config/unit/config.yml
+++ b/spec/rtems/config/unit/config.yml
@@ -2,7 +2,9 @@ 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: []
+links:
+- role: requirement-refinement
+  uid: /req/unit-test-dead-code
 test-actions:
 - action-brief: |
     Call get_config_max() indirectly through
diff --git a/spec/score/msgq/unit/msgq.yml b/spec/score/msgq/unit/msgq.yml
index dee7e3ef..06a609a0 100644
--- a/spec/score/msgq/unit/msgq.yml
+++ b/spec/score/msgq/unit/msgq.yml
@@ -2,7 +2,9 @@ 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: []
+links:
+- role: requirement-refinement
+  uid: /req/unit-test-dead-code
 test-actions:
 
 #### _CORE_message_queue_Insert_message() ####################################
diff --git a/spec/score/rbtree/unit/rbtree.yml b/spec/score/rbtree/unit/rbtree.yml
index 64c7f921..1723e67a 100644
--- a/spec/score/rbtree/unit/rbtree.yml
+++ b/spec/score/rbtree/unit/rbtree.yml
@@ -3,7 +3,9 @@ copyrights:
 - Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
 - Copyright (C) 2010 Gedare Bloom
 enabled-by: true
-links: []
+links:
+- role: requirement-refinement
+  uid: /req/unit-test-data-structures
 test-actions:
 - action-brief: |
     Call _RBTree_Initialize_one() and check the tree properties.



More information about the vc mailing list