From 209562c67fc76dbc5c3aa2f255ee6f2d7abb7f07 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 2 Sep 2022 09:03:39 +0200 Subject: 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(-) create mode 100644 spec/req/unit-test-data-structures.yml create mode 100644 spec/req/unit-test-dead-code.yml 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. -- cgit v1.2.3