diff --git a/src/extensions/score_metamodel/checks/check_options.py b/src/extensions/score_metamodel/checks/check_options.py index 0780594fb..41e2c9e82 100644 --- a/src/extensions/score_metamodel/checks/check_options.py +++ b/src/extensions/score_metamodel/checks/check_options.py @@ -273,14 +273,24 @@ def check_extra_options( log.warning_for_need(need, msg) +# Same pattern as the `valid_from`/`valid_until` options in metamodel.yaml: +# v. with an optional ., no leading zeroes. +_MILESTONE_PATTERN = re.compile(r"v(0|[1-9]\d*)\.(0|[1-9]\d*)(\.(0|[1-9]\d*))?$") + + def parse_milestone(value: str) -> tuple[int, int, int]: - """Parse a string like 'v0.5' or 'v1.0.0'. No suffixes.""" - match = re.match(r"v(\d+)(\.(\d+))?(\.(\d+))?$", value) + """Parse a string like 'v0.5' or 'v1.0.0'. No suffixes. + + Uses the same pattern as the `valid_from`/`valid_until` options in + metamodel.yaml, so values rejected by the option schema raise ValueError + and stay with pattern validation instead of being compared here. + """ + match = _MILESTONE_PATTERN.match(value) if not match: raise ValueError(f"Invalid milestone format: {value}") major = int(match.group(1)) - minor = int(match.group(3) or 0) - patch = int(match.group(5) or 0) + minor = int(match.group(2)) + patch = int(match.group(4) or 0) return (major, minor, patch) @@ -303,8 +313,13 @@ def check_validity_consistency( if not valid_from or not valid_until: return - valid_from_version = parse_milestone(valid_from) - valid_until_version = parse_milestone(valid_until) + try: + valid_from_version = parse_milestone(valid_from) + valid_until_version = parse_milestone(valid_until) + except ValueError: + # Pattern validation reports malformed milestones separately. + return + if valid_from_version >= valid_until_version: msg = ( "inconsistent validity: " diff --git a/src/extensions/score_metamodel/metamodel.yaml b/src/extensions/score_metamodel/metamodel.yaml index fbbca7d31..d263baae1 100644 --- a/src/extensions/score_metamodel/metamodel.yaml +++ b/src/extensions/score_metamodel/metamodel.yaml @@ -1242,7 +1242,7 @@ graph_checks: # req-Id: tool_req__docs_req_arch_link_safety_to_arch tool_req__docs_req_arch_link_safety_to_arch: needs: - include: feat_arc_sta, logic_arc_int, logic_arc_int_op, comp_arc_sta, real_arc_int, real_arc_int_op + include: feat_arc_sta, logic_arc_int, logic_arc_int_op, comp_arc_sta, real_arc_int, real_arc_int_op, comp condition: and: - safety != QM diff --git a/src/extensions/score_metamodel/tests/rst/architecture/test_arch_link_fulfils.rst b/src/extensions/score_metamodel/tests/rst/architecture/test_arch_link_fulfils.rst new file mode 100644 index 000000000..fa3db19c2 --- /dev/null +++ b/src/extensions/score_metamodel/tests/rst/architecture/test_arch_link_fulfils.rst @@ -0,0 +1,189 @@ +.. + # ******************************************************************************* + # Copyright (c) 2026 Contributors to the Eclipse Foundation + # + # See the NOTICE file(s) distributed with this work for additional + # information regarding copyright ownership. + # + # This program and the accompanying materials are made available under the + # terms of the Apache License Version 2.0 which is available at + # https://www.apache.org/licenses/LICENSE-2.0 + # + # SPDX-License-Identifier: Apache-2.0 + # ******************************************************************************* + +.. test_metadata:: + :id: test_metadata__arch_link_fulfils + :fully_verifies_list: tool_req__docs_arch_link_fulfils[version==3] + :test_type: requirements_based + :derivation_technique: requirements_based + + Checks the allowed ``fulfils`` target type for each architecture source type. + Each permitted source-target combination is accepted, and mismatched feature + and component requirement targets are rejected. + + +.. feat:: Feature + :id: feat__arch_fulfils__feature + :security: NO + :safety: QM + :status: valid + + +.. comp:: Component + :id: comp__arch_fulfils__component + :security: NO + :safety: QM + :status: valid + :belongs_to: feat__arch_fulfils__feature + + +.. logic_arc_int:: Logical interface + :id: logic_arc_int__arch_fulfils__interface + :security: NO + :safety: QM + :status: valid + :included_by: feat__arch_fulfils__feature + + +.. feat_req:: Feature requirement + :id: feat_req__arch_fulfils__feature__good + :reqtype: Functional + :security: NO + :safety: QM + :status: valid + :valid_from: v1.0 + :satisfied_by: feat__arch_fulfils__feature + + A feature requirement target. + + +.. comp_req:: Component requirement + :id: comp_req__arch_fulfils__component__good + :reqtype: Functional + :security: NO + :safety: QM + :status: valid + :satisfied_by: comp__arch_fulfils__component + + A component requirement target. + + +.. feat_arc_sta:: Feature static view fulfils feature requirement + :id: feat_arc_sta__arch_fulfils__good + :security: NO + :safety: QM + :status: valid + :belongs_to: feat__arch_fulfils__feature + :includes: logic_arc_int__arch_fulfils__interface + :fulfils: feat_req__arch_fulfils__feature__good + :expect_not: but it must reference + + +.. feat_arc_dyn:: Feature dynamic view fulfils feature requirement + :id: feat_arc_dyn__arch_fulfils__good + :security: NO + :safety: QM + :status: valid + :belongs_to: feat__arch_fulfils__feature + :fulfils: feat_req__arch_fulfils__feature__good + :expect_not: but it must reference + + +.. logic_arc_int:: Logical interface fulfils feature requirement + :id: logic_arc_int__arch_fulfils__fulfils_good + :security: NO + :safety: QM + :status: valid + :fulfils: feat_req__arch_fulfils__feature__good + :expect_not: but it must reference + + +.. comp_arc_sta:: Component static view fulfils component requirement + :id: comp_arc_sta__arch_fulfils__good + :security: NO + :safety: QM + :status: valid + :belongs_to: comp__arch_fulfils__component + :fulfils: comp_req__arch_fulfils__component__good + :expect_not: but it must reference + + +.. comp_arc_dyn:: Component dynamic view fulfils component requirement + :id: comp_arc_dyn__arch_fulfils__good + :security: NO + :safety: QM + :status: valid + :belongs_to: comp__arch_fulfils__component + :fulfils: comp_req__arch_fulfils__component__good + :expect_not: but it must reference + + +.. real_arc_int:: Real interface fulfils component requirement + :id: real_arc_int__arch_fulfils__good + :security: NO + :safety: QM + :status: valid + :language: cpp + :fulfils: comp_req__arch_fulfils__component__good + :expect_not: but it must reference + + +.. feat_arc_sta:: Feature static view rejects component requirement + :id: feat_arc_sta__arch_fulfils__bad + :security: NO + :safety: QM + :status: valid + :belongs_to: feat__arch_fulfils__feature + :includes: logic_arc_int__arch_fulfils__interface + :fulfils: comp_req__arch_fulfils__component__good + :expect: but it must reference Feature Requirement (feat_req) + + +.. comp_arc_sta:: Component static view rejects feature requirement + :id: comp_arc_sta__arch_fulfils__bad + :security: NO + :safety: QM + :status: valid + :belongs_to: comp__arch_fulfils__component + :fulfils: feat_req__arch_fulfils__feature__good + :expect: but it must reference Component Requirement (comp_req) + + +.. feat_arc_dyn:: Feature dynamic view rejects component requirement + :id: feat_arc_dyn__arch_fulfils__bad + :security: NO + :safety: QM + :status: valid + :belongs_to: feat__arch_fulfils__feature + :fulfils: comp_req__arch_fulfils__component__good + :expect: but it must reference Feature Requirement (feat_req) + + +.. logic_arc_int:: Logical interface rejects component requirement + :id: logic_arc_int__arch_fulfils__bad + :security: NO + :safety: QM + :status: valid + :fulfils: comp_req__arch_fulfils__component__good + :expect: but it must reference Feature Requirement (feat_req) + + +.. comp_arc_dyn:: Component dynamic view rejects feature requirement + :id: comp_arc_dyn__arch_fulfils__bad + :security: NO + :safety: QM + :status: valid + :belongs_to: comp__arch_fulfils__component + :fulfils: feat_req__arch_fulfils__feature__good + :expect: but it must reference Component Requirement (comp_req) + + +.. real_arc_int:: Real interface rejects feature requirement + :id: real_arc_int__arch_fulfils__bad + :security: NO + :safety: QM + :status: valid + :language: cpp + :fulfils: feat_req__arch_fulfils__feature__good + :expect: but it must reference Component Requirement (comp_req) diff --git a/src/extensions/score_metamodel/tests/rst/attributes/test_common_attr_description.rst b/src/extensions/score_metamodel/tests/rst/attributes/test_common_attr_description.rst new file mode 100644 index 000000000..0109c4f95 --- /dev/null +++ b/src/extensions/score_metamodel/tests/rst/attributes/test_common_attr_description.rst @@ -0,0 +1,153 @@ +.. + # ******************************************************************************* + # Copyright (c) 2026 Contributors to the Eclipse Foundation + # + # See the NOTICE file(s) distributed with this work for additional + # information regarding copyright ownership. + # + # This program and the accompanying materials are made available under the + # terms of the Apache License Version 2.0 which is available at + # https://www.apache.org/licenses/LICENSE-2.0 + # + # SPDX-License-Identifier: Apache-2.0 + # ******************************************************************************* + + +.. test_metadata:: Common description attribute + :id: test_metadata__common_attr_description + :partially_verifies_list: tool_req__docs_common_attr_description + :test_type: requirements_based + :derivation_technique: requirements_based + + Checks that requirement types accept non-empty descriptions and reject a + missing description. + + +.. feat:: Feature target + :id: feat__description_target + :version: 1 + :status: valid + :safety: QM + :security: NO + + +.. comp:: Component target + :id: comp__description_target + :version: 1 + :status: valid + :safety: QM + :security: NO + :belongs_to: feat__description_target + + +.. stkh_req:: Requirement used as a tool requirement target + :id: stkh_req__description__abcd + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :rationale: fixture target + :valid_from: v1.0 + + +.. feat_req:: Feature requirement with a description + :id: feat_req__description__aaaa + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :valid_from: v1.0 + :satisfied_by: feat__description_target + :expect_not: is missing required attribute: `content` + + This feature requirement has useful content. + + +.. feat_req:: Feature requirement without a description + :id: feat_req__description__aaab + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :valid_from: v1.0 + :satisfied_by: feat__description_target + :expect: is missing required attribute: `content` + + +.. comp_req:: Component requirement with a description + :id: comp_req__description__aaaa + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :satisfied_by: comp__description_target + :expect_not: is missing required attribute: `content` + + This component requirement has useful content. + + +.. comp_req:: Component requirement without a description + :id: comp_req__description__aaab + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :satisfied_by: comp__description_target + :expect: is missing required attribute: `content` + + +.. aou_req:: Assumption with a description + :id: aou_req__description__aaaa + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :expect_not: is missing required attribute: `content` + + This assumption has useful content. + + +.. aou_req:: Assumption without a description + :id: aou_req__description__aaab + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :expect: is missing required attribute: `content` + + +.. tool_req:: Tool requirement with a description + :id: tool_req__description_valid + :version: 1 + :satisfies: stkh_req__description__abcd + :expect_not: is missing required attribute: `content` + + This tool requirement has useful content. + + +.. tool_req:: Tool requirement without a description + :id: tool_req__description_missing + :version: 1 + :satisfies: stkh_req__description__abcd + :expect: is missing required attribute: `content` + + +.. gd_req:: Process requirement with a description + :id: gd_req__description_with + :version: 1 + :expect_not: is missing required attribute: `content` + + This process requirement has useful content. + + +.. gd_req:: Process requirement without a description + :id: gd_req__description_missing + :version: 1 + :expect: is missing required attribute: `content` diff --git a/src/extensions/score_metamodel/tests/rst/attributes/test_prohibited_words.rst b/src/extensions/score_metamodel/tests/rst/attributes/test_prohibited_words.rst index db9006fa5..8d89f2bb9 100644 --- a/src/extensions/score_metamodel/tests/rst/attributes/test_prohibited_words.rst +++ b/src/extensions/score_metamodel/tests/rst/attributes/test_prohibited_words.rst @@ -14,9 +14,9 @@ #CHECK: check_for_prohibited_words -.. test_metadata:: Test Prohibeted Words - :id: test_metadata__check_prohibeted_words - :partially_verifies_list: tool_req__docs_common_attr_title, tool_req__docs_common_attr_desc_wording +.. test_metadata:: Prohibited Word Checks + :id: test_metadata__check_prohibited_words + :fully_verifies_list: tool_req__docs_common_attr_title, tool_req__docs_common_attr_desc_wording :test_type: requirements_based :derivation_technique: requirements_based @@ -86,6 +86,86 @@ This should really work +.. stkh_req:: This shall work + :id: stkh_req__test__title_shall + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :rationale: test title wording + :valid_from: v1.0 + :expect: contains a weak word: `shall` in option: `title` + + +.. stkh_req:: This will work + :id: stkh_req__test__title_will + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :rationale: test title wording + :valid_from: v1.0 + :expect: contains a weak word: `will` in option: `title` + + +.. stkh_req:: Description contains about + :id: stkh_req__test__desc_about + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :rationale: test description wording + :valid_from: v1.0 + :expect: contains a weak word: `about` in option: `content` + + This description is about the behavior. + + +.. stkh_req:: Description contains some + :id: stkh_req__test__desc_some + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :rationale: test description wording + :valid_from: v1.0 + :expect: contains a weak word: `some` in option: `content` + + Some behavior is described here. + + +.. stkh_req:: Description contains thing + :id: stkh_req__test__desc_thing + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :rationale: test description wording + :valid_from: v1.0 + :expect: contains a weak word: `thing` in option: `content` + + The thing is described here. + + +.. stkh_req:: Description contains absolutely + :id: stkh_req__test__desc_absolutely + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :rationale: test description wording + :valid_from: v1.0 + :expect: contains a weak word: `absolutely` in option: `content` + + This absolutely describes behavior. + + .. tool_req:: Enforces description wording rules :id: tool_req__docs_common_attr_desc_wording diff --git a/src/extensions/score_metamodel/tests/rst/attributes/test_validity.rst b/src/extensions/score_metamodel/tests/rst/attributes/test_validity.rst index e8d7b2c4f..01fa29383 100644 --- a/src/extensions/score_metamodel/tests/rst/attributes/test_validity.rst +++ b/src/extensions/score_metamodel/tests/rst/attributes/test_validity.rst @@ -13,35 +13,186 @@ # ******************************************************************************* -.. test_metadata:: - :id: test_metadata__validity_correct - :partially_verifies_list: tool_req__docs_req_attr_validity_correctness,tool_req__docs_req_attr_validity_consistency +.. test_metadata:: Validity attribute checks + :id: test_metadata__validity_checks + :fully_verifies_list: tool_req__docs_req_attr_validity_correctness, tool_req__docs_req_attr_validity_consistency :test_type: requirements_based :derivation_technique: requirements_based - This is a multiline description. - It can contain blank lines and arbitrary text, - and it ends only at the closing sentinel. + Checks milestone formatting for validity attributes and the ordering of + valid_from before valid_until. -.. feat_req:: from after until - :id: feat_req__random_id1 +.. stkh_req:: Valid major and minor milestones + :id: stkh_req__validity__aaaa + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :rationale: valid milestone values :valid_from: v1.0 + :valid_until: v2.0 + :expect_not: does not follow pattern, inconsistent validity + + +.. stkh_req:: Valid patch milestone ordering + :id: stkh_req__validity__aaab + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :rationale: valid patch values + :valid_from: v1.2.3 + :valid_until: v1.2.4 + :expect_not: does not follow pattern, inconsistent validity + + +.. stkh_req:: Invalid valid_from format + :id: stkh_req__validity__aaac + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :rationale: invalid milestone format + :valid_from: v1 :valid_until: v0.5 - :expect: feat_req__random_id1: inconsistent validity: valid_from (v1.0) >= valid_until (v0.5). + :expect: valid_from (v1): does not follow pattern + :expect_not: inconsistent validity + + +.. stkh_req:: Invalid valid_until format + :id: stkh_req__validity__aaad + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :rationale: invalid milestone format + :valid_from: v1.0 + :valid_until: v1.0.0-beta + :expect: valid_until (v1.0.0-beta): does not follow pattern + +.. stkh_req:: valid_from is after valid_until + :id: stkh_req__validity__aaae + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :rationale: inconsistent validity + :valid_from: v1.1 + :valid_until: v1.0 + :expect: inconsistent validity: valid_from (v1.1) >= valid_until (v1.0) -.. feat_req:: until after from - :id: feat_req__random_id2 - :valid_from: v0.5 +.. stkh_req:: valid_from equals valid_until + :id: stkh_req__validity__aaaf + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :rationale: equal validity bounds are inconsistent + :valid_from: v1.0.0 :valid_until: v1.0 + :expect: inconsistent validity: valid_from (v1.0.0) >= valid_until (v1.0) + + +.. stkh_req:: Missing valid_until is allowed + :id: stkh_req__validity__aaag + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :rationale: no end of validity period + :valid_from: v1.0 :expect_not: inconsistent validity +.. feat:: Validity target feature + :id: feat__validity_target + :version: 1 + :status: valid + :safety: QM + :security: NO -.. stkh_req:: from after until for stakeholder requirement - :id: stkh_req__random_id1 - :valid_from: v1.0.1 - :valid_until: v0.5 - :expect: stkh_req__random_id1: inconsistent validity: valid_from (v1.0.1) >= valid_until (v0.5) + +.. feat_req:: Valid feature requirement milestones + :id: feat_req__validity__aaaa + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :satisfied_by: feat__validity_target + :valid_from: v1.0 + :valid_until: v2.0 + :expect_not: does not follow pattern, inconsistent validity + + This feature requirement is used to check the validity attributes. + + +.. feat_req:: Feature requirement valid_from is after valid_until + :id: feat_req__validity__aaab + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :satisfied_by: feat__validity_target + :valid_from: v1.1 + :valid_until: v1.0 + :expect: inconsistent validity: valid_from (v1.1) >= valid_until (v1.0) + + This feature requirement is used to check the validity attributes. + + +.. feat_req:: Feature requirement with malformed valid_from + :id: feat_req__validity__aaac + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :satisfied_by: feat__validity_target + :valid_from: v01.0 + :valid_until: v1.0 + :expect: valid_from (v01.0): does not follow pattern + :expect_not: inconsistent validity + + This feature requirement is used to check the validity attributes. + + +.. feat_req:: Feature requirement with malformed valid_until + :id: feat_req__validity__aaad + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :satisfied_by: feat__validity_target + :valid_from: v1.0 + :valid_until: v01.0 + :expect: valid_until (v01.0): does not follow pattern + :expect_not: inconsistent validity + + This feature requirement is used to check the validity attributes. + + +.. feat_req:: Feature requirement without valid_until + :id: feat_req__validity__aaae + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: valid + :satisfied_by: feat__validity_target + :valid_from: v1.0 + :expect_not: inconsistent validity + + This feature requirement is used to check the validity attributes. diff --git a/src/extensions/score_metamodel/tests/rst/graph/test_arch_link_safety.rst b/src/extensions/score_metamodel/tests/rst/graph/test_arch_link_safety.rst new file mode 100644 index 000000000..0a75e0d40 --- /dev/null +++ b/src/extensions/score_metamodel/tests/rst/graph/test_arch_link_safety.rst @@ -0,0 +1,158 @@ +.. + # ******************************************************************************* + # Copyright (c) 2026 Contributors to the Eclipse Foundation + # + # See the NOTICE file(s) distributed with this work for additional + # information regarding copyright ownership. + # + # This program and the accompanying materials are made available under the + # terms of the Apache License Version 2.0 which is available at + # https://www.apache.org/licenses/LICENSE-2.0 + # + # SPDX-License-Identifier: Apache-2.0 + # ******************************************************************************* + +.. test_metadata:: + :id: test_metadata__arch_link_safety + :fully_verifies_list: tool_req__docs_req_arch_link_safety_to_arch[version==2] + :test_type: requirements_based + :derivation_technique: requirements_based + + Checks that valid safety architecture elements implement only valid safety + architecture elements. + A valid safety link is accepted, while links to a QM or invalid target are + rejected. + + +.. logic_arc_int:: Safety logical interface + :id: logic_arc_int__arch_sec__safety_interface + :security: NO + :safety: ASIL_B + :status: valid + :version: 1 + + +.. logic_arc_int_op:: Valid safety logical operation + :id: logic_arc_int_op__arch_sec__safety_valid + :security: NO + :safety: ASIL_B + :status: valid + :version: 1 + :included_by: logic_arc_int__arch_sec__safety_interface + + +.. logic_arc_int_op:: QM logical operation + :id: logic_arc_int_op__arch_sec__safety_qm + :security: NO + :safety: QM + :status: valid + :version: 1 + :included_by: logic_arc_int__arch_sec__safety_interface + + +.. logic_arc_int_op:: Invalid safety logical operation + :id: logic_arc_int_op__arch_sec__safety_invalid + :security: NO + :safety: ASIL_B + :status: invalid + :version: 1 + :included_by: logic_arc_int__arch_sec__safety_interface + + +.. real_arc_int:: Safety real interface + :id: real_arc_int__arch_sec__safety_real_interface + :security: NO + :safety: ASIL_B + :status: valid + :version: 1 + :language: cpp + + +.. real_arc_int_op:: Safety operation implements valid safety operation + :id: real_arc_int_op__arch_sec__safety_src_valid + :security: NO + :safety: ASIL_B + :status: valid + :version: 1 + :included_by: real_arc_int__arch_sec__safety_real_interface + :implements: logic_arc_int_op__arch_sec__safety_valid + :expect_not: does not fulfill condition + + +.. real_arc_int_op:: Safety operation implements QM operation + :id: real_arc_int_op__arch_sec__safety_src_qm + :security: NO + :safety: ASIL_B + :status: valid + :version: 1 + :included_by: real_arc_int__arch_sec__safety_real_interface + :implements: logic_arc_int_op__arch_sec__safety_qm + :expect: does not fulfill condition + + +.. real_arc_int_op:: Safety operation implements invalid safety operation + :id: real_arc_int_op__arch_sec__safety_src_invalid + :security: NO + :safety: ASIL_B + :status: valid + :version: 1 + :included_by: real_arc_int__arch_sec__safety_real_interface + :implements: logic_arc_int_op__arch_sec__safety_invalid + :expect: does not fulfill condition + + +.. feat:: Safety feature + :id: feat__arch_sec__safety_feature + :security: NO + :safety: QM + :status: valid + :version: 1 + + +.. logic_arc_int:: QM logical interface + :id: logic_arc_int__arch_sec__safety_qm_interface + :security: NO + :safety: QM + :status: valid + :version: 1 + + +.. logic_arc_int:: Invalid safety logical interface + :id: logic_arc_int__arch_sec__safety_invalid_interface + :security: NO + :safety: ASIL_B + :status: invalid + :version: 1 + + +.. comp:: Safety component implements valid safety logical interface + :id: comp__arch_sec__safety_comp_valid + :security: NO + :safety: ASIL_B + :status: valid + :version: 1 + :belongs_to: feat__arch_sec__safety_feature + :implements: logic_arc_int__arch_sec__safety_interface + :expect_not: does not fulfill condition + + +.. comp:: Safety component implements QM logical interface + :id: comp__arch_sec__safety_comp_qm + :security: NO + :safety: ASIL_B + :status: valid + :version: 1 + :belongs_to: feat__arch_sec__safety_feature + :implements: logic_arc_int__arch_sec__safety_qm_interface + :expect: does not fulfill condition + + +.. comp:: Safety component implements invalid safety logical interface + :id: comp__arch_sec__safety_comp_invalid + :security: NO + :safety: ASIL_B + :status: valid + :version: 1 + :belongs_to: feat__arch_sec__safety_feature + :implements: logic_arc_int__arch_sec__safety_invalid_interface + :expect: does not fulfill condition diff --git a/src/extensions/score_metamodel/tests/rst/graph/test_metamodel_graph.rst b/src/extensions/score_metamodel/tests/rst/graph/test_metamodel_graph.rst index 5e66f5b16..9bb9b2c20 100644 --- a/src/extensions/score_metamodel/tests/rst/graph/test_metamodel_graph.rst +++ b/src/extensions/score_metamodel/tests/rst/graph/test_metamodel_graph.rst @@ -14,8 +14,8 @@ .. test_metadata:: :id: test_metadata__metamodel_graph_checks - :fully_verifies_list: potential_tool_malfunction__docs_as_code__m2 - :partially_verifies_list: tool_req__docs_common_attr_safety_link_check + :fully_verifies_list: potential_tool_malfunction__docs_as_code__m2, + tool_req__docs_common_attr_safety_link_check[version==1] :test_type: requirements_based :derivation_technique: requirements_based @@ -62,13 +62,37 @@ .. Negative Test: Child requirement QM. Parent requirement is `ASIL_B`. Child cant fulfill the safety level of the parent. +.. feat:: Parent feature of the component requirement + :id: feat__graph_parent + :version: 1 + :safety: QM + :status: valid + :security: NO + + This feature is the parent of the component requirement fixture. + +.. comp:: Component target of the component requirement + :id: comp__qm_child_target + :version: 1 + :safety: QM + :status: valid + :security: NO + :belongs_to: feat__graph_parent + + This component is satisfied by the component requirement fixture. + .. comp_req:: Child requirement 3 - :id: feat_req__qm_child_with_asil_parent + :id: comp_req__qm_child_with_asil_parent + :reqtype: Functional :safety: QM - :derived_from: feat_req__parent__ASIL_B :status: valid + :security: NO + :satisfied_by: comp__qm_child_target + :derived_from: feat_req__parent__ASIL_B :expect: QM requirements cannot be derived from ASIL requirements. + This component requirement cannot fulfill the safety level of its parent requirement. + .. Parent requirement does not exist @@ -79,33 +103,3 @@ :status: valid :derived_from: feat_req__parent0__abcd :expect: unknown outgoing link - - -.. doc_tool:: Nested tool qualification report - :id: doc_tool__nested_qualification - :status: evaluated - :security_affected: NO - :version: 1 - -.. tool_usecase:: Nested tool use case - :id: tool_usecase__blabla__nested - :belongs_to: doc_tool__nested_qualification - :version: 1 - - A use case contains its tool malfunctions as nested needs. - - .. potential_tool_malfunction:: Nested tool malfunction - :id: potential_tool_malfunction__blabla__nested - :safety_affected: YES - :detection_sufficient: NO - :safety_measures: Review the generated result before release. - :violates: tool_req__test__qualification - :version: 1 - - The generated result may contain a silent error. - -.. tool_req:: Test tool requirement - :id: tool_req__test__qualification - :version: 1 - - The test fixture uses this requirement as the target of tool qualification links. diff --git a/src/extensions/score_metamodel/tests/rst/options/test_options_common_attrs.rst b/src/extensions/score_metamodel/tests/rst/options/test_options_common_attrs.rst new file mode 100644 index 000000000..86e6596b7 --- /dev/null +++ b/src/extensions/score_metamodel/tests/rst/options/test_options_common_attrs.rst @@ -0,0 +1,603 @@ +.. + # ******************************************************************************* + # Copyright (c) 2026 Contributors to the Eclipse Foundation + # + # See the NOTICE file(s) distributed with this work for additional + # information regarding copyright ownership. + # + # This program and the accompanying materials are made available under the + # terms of the Apache License Version 2.0 which is available at + # https://www.apache.org/licenses/LICENSE-2.0 + # + # SPDX-License-Identifier: Apache-2.0 + # ******************************************************************************* + +.. test_metadata:: + :id: test_metadata__common_attrs + :fully_verifies_list: tool_req__docs_common_attr_status[version==1], tool_req__docs_common_attr_security[version==1] + :test_type: requirements_based + :derivation_technique: requirements_based + + Tests that the common ``status`` and ``security`` attributes are enforced on + every directive that declares them in the metamodel: + the four requirement types (stkh_req, feat_req, comp_req, aou_req), + the eight architecture element/view types, and - for ``status`` only - + the five safety-analysis types. + + Every directive has its own metamodel regex, + so each one gets at least one invalid-value (negative) case; + the missing-value cases cover the mandatory-attribute mechanism + for all four requirement types. + + +.. stkh_req:: Valid common status and security values + :id: stkh_req__common_attrs__good + :version: 1 + :reqtype: Functional + :safety: QM + :security: YES + :status: valid + :rationale: valid common attributes + :valid_from: v1.0 + :expect_not: does not follow pattern, missing required attribute: `status`, missing required attribute: `security` + + +.. stkh_req:: Invalid common status + :id: stkh_req__common_attrs__bad_status + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: draft + :rationale: invalid status + :valid_from: v1.0 + :expect: status (draft): does not follow pattern + :expect_not: security (NO): does not follow pattern + + +.. stkh_req:: Missing common status + :id: stkh_req__common_attrs__missing_status + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :rationale: missing status + :valid_from: v1.0 + :expect: is missing required attribute: `status` + + +.. stkh_req:: Invalid common security + :id: stkh_req__common_attrs__bad_security + :version: 1 + :reqtype: Functional + :safety: QM + :security: MAYBE + :status: valid + :rationale: invalid security + :valid_from: v1.0 + :expect: security (MAYBE): does not follow pattern + :expect_not: status (valid): does not follow pattern + + +.. stkh_req:: Missing common security + :id: stkh_req__common_attrs__missing_security + :version: 1 + :reqtype: Functional + :safety: QM + :status: valid + :rationale: missing security + :valid_from: v1.0 + :expect: is missing required attribute: `security` + + +.. stkh_req:: Valid invalid status and NO security values + :id: stkh_req__common_attrs__invalid_no + :version: 1 + :reqtype: Functional + :safety: QM + :security: NO + :status: invalid + :rationale: both values are allowed + :valid_from: v1.0 + :expect_not: does not follow pattern + + +.. + Support needs used as link targets by the negative fixtures below. + All are valid (`status: valid`, `safety: QM`, `security: NO`), + so they do not interact with the safety/security graph checks. + + +.. feat:: Support feature + :id: feat__attrs_support + :version: 1 + :security: NO + :safety: QM + :status: valid + + +.. logic_arc_int:: Support logical interface + :id: logic_arc_int__attrs_support + :security: NO + :safety: QM + :status: valid + + +.. logic_arc_int_op:: Support logical interface operation + :id: logic_arc_int_op__attrs_support + :security: NO + :safety: QM + :status: valid + :included_by: logic_arc_int__attrs_support + + +.. comp:: Support component + :id: comp__attrs_support + :version: 1 + :security: NO + :safety: QM + :status: valid + :belongs_to: feat__attrs_support + + +.. comp_arc_sta:: Support component package view + :id: comp_arc_sta__attrs_support + :security: NO + :safety: QM + :status: valid + :belongs_to: comp__attrs_support + + +.. comp_arc_dyn:: Support component sequence view + :id: comp_arc_dyn__attrs_support + :security: NO + :safety: QM + :status: valid + :belongs_to: comp__attrs_support + + +.. real_arc_int:: Support interface + :id: real_arc_int__attrs_support + :security: NO + :safety: QM + :status: valid + :language: cpp + + +.. real_arc_int_op:: Support interface operation + :id: real_arc_int_op__attrs_support + :security: NO + :safety: QM + :status: valid + :included_by: real_arc_int__attrs_support + + +.. feat_arc_sta:: Support feature static view + :id: feat_arc_sta__attrs_support + :security: NO + :safety: QM + :status: valid + :includes: logic_arc_int__attrs_support, logic_arc_int_op__attrs_support + :belongs_to: feat__attrs_support + + +.. feat_arc_dyn:: Support feature dynamic view + :id: feat_arc_dyn__attrs_support + :security: NO + :safety: QM + :status: valid + :belongs_to: feat__attrs_support + + +.. + Invalid ``status`` value for every directive that declares it, + i.e. all requirement types, all architecture types and all safety-analysis types. + + +.. feat_req:: Invalid status + :id: feat_req__attrs__bad_status + :reqtype: Functional + :security: NO + :safety: QM + :status: draft + :valid_from: v1.0 + :satisfied_by: feat__attrs_support + :expect: status (draft): does not follow pattern + :expect_not: security (NO): does not follow pattern + + Negative `status` test for feat_req. + + +.. comp_req:: Invalid status + :id: comp_req__attrs__bad_status + :reqtype: Functional + :security: NO + :safety: QM + :status: draft + :satisfied_by: comp__attrs_support + :expect: status (draft): does not follow pattern + :expect_not: security (NO): does not follow pattern + + Negative `status` test for comp_req. + + +.. aou_req:: Invalid status + :id: aou_req__attrs__bad_status + :reqtype: Functional + :security: NO + :safety: QM + :status: draft + :expect: status (draft): does not follow pattern + :expect_not: security (NO): does not follow pattern + + Negative `status` test for aou_req. + + +.. feat:: Invalid status + :id: feat__attrs_bad_status + :version: 1 + :security: NO + :safety: QM + :status: draft + :expect: status (draft): does not follow pattern + :expect_not: security (NO): does not follow pattern + + +.. feat_arc_sta:: Invalid status + :id: feat_arc_sta__attrs__bad_status + :security: NO + :safety: QM + :status: draft + :includes: logic_arc_int__attrs_support, logic_arc_int_op__attrs_support + :belongs_to: feat__attrs_support + :expect: status (draft): does not follow pattern + :expect_not: security (NO): does not follow pattern + + +.. feat_arc_dyn:: Invalid status + :id: feat_arc_dyn__attrs__bad_status + :security: NO + :safety: QM + :status: draft + :belongs_to: feat__attrs_support + :expect: status (draft): does not follow pattern + :expect_not: security (NO): does not follow pattern + + +.. logic_arc_int:: Invalid status + :id: logic_arc_int__attrs__bad_status + :security: NO + :safety: QM + :status: draft + :expect: status (draft): does not follow pattern + :expect_not: security (NO): does not follow pattern + + +.. logic_arc_int_op:: Invalid status + :id: logic_arc_int_op__attrs__bad_status + :security: NO + :safety: QM + :status: draft + :included_by: logic_arc_int__attrs_support + :expect: status (draft): does not follow pattern + :expect_not: security (NO): does not follow pattern + + +.. comp:: Invalid status + :id: comp__attrs_bad_status + :version: 1 + :security: NO + :safety: QM + :status: draft + :belongs_to: feat__attrs_support + :expect: status (draft): does not follow pattern + :expect_not: security (NO): does not follow pattern + + +.. comp_arc_sta:: Invalid status + :id: comp_arc_sta__attrs__bad_status + :security: NO + :safety: QM + :status: draft + :belongs_to: comp__attrs_support + :expect: status (draft): does not follow pattern + :expect_not: security (NO): does not follow pattern + + +.. comp_arc_dyn:: Invalid status + :id: comp_arc_dyn__attrs__bad_status + :security: NO + :safety: QM + :status: draft + :belongs_to: comp__attrs_support + :expect: status (draft): does not follow pattern + :expect_not: security (NO): does not follow pattern + + +.. real_arc_int:: Invalid status + :id: real_arc_int__attrs__bad_status + :security: NO + :safety: QM + :status: draft + :language: cpp + :expect: status (draft): does not follow pattern + :expect_not: security (NO): does not follow pattern + + +.. real_arc_int_op:: Invalid status + :id: real_arc_int_op__attrs__bad_status + :security: NO + :safety: QM + :status: draft + :included_by: real_arc_int__attrs_support + :expect: status (draft): does not follow pattern + :expect_not: security (NO): does not follow pattern + + +.. feat_saf_fmea:: Invalid status + :id: feat_saf_fmea__attrs__bad_status + :fault_id: FD_NEG + :failure_effect: Negative `status` test for feat_saf_fmea. + :sufficient: no + :status: draft + :violates: feat_arc_dyn__attrs_support + :expect: status (draft): does not follow pattern + + +.. comp_saf_fmea:: Invalid status + :id: comp_saf_fmea__attrs__bad_status + :fault_id: FD_NEG + :failure_effect: Negative `status` test for comp_saf_fmea. + :sufficient: no + :status: draft + :violates: comp_arc_dyn__attrs_support + :expect: status (draft): does not follow pattern + + +.. plat_saf_dfa:: Invalid status + :id: plat_saf_dfa__attrs__bad_status + :failure_id: FI_NEG + :failure_effect: Negative `status` test for plat_saf_dfa. + :sufficient: no + :status: draft + :violates: feat_arc_sta__attrs_support + :expect: status (draft): does not follow pattern + + +.. feat_saf_dfa:: Invalid status + :id: feat_saf_dfa__attrs__bad_status + :failure_id: FI_NEG + :failure_effect: Negative `status` test for feat_saf_dfa. + :sufficient: no + :status: draft + :violates: feat_arc_sta__attrs_support + :expect: status (draft): does not follow pattern + + +.. comp_saf_dfa:: Invalid status + :id: comp_saf_dfa__attrs__bad_status + :failure_id: FI_NEG + :failure_effect: Negative `status` test for comp_saf_dfa. + :sufficient: no + :status: draft + :violates: comp_arc_sta__attrs_support + :expect: status (draft): does not follow pattern + + +.. + Missing ``status`` value for all requirement types. + + +.. feat_req:: Missing status + :id: feat_req__attrs__missing_status + :reqtype: Functional + :security: NO + :safety: QM + :valid_from: v1.0 + :satisfied_by: feat__attrs_support + :expect: is missing required attribute: `status` + + Missing `status` test for feat_req. + + +.. comp_req:: Missing status + :id: comp_req__attrs__missing_status + :reqtype: Functional + :security: NO + :safety: QM + :satisfied_by: comp__attrs_support + :expect: is missing required attribute: `status` + + Missing `status` test for comp_req. + + +.. aou_req:: Missing status + :id: aou_req__attrs__missing_status + :reqtype: Functional + :security: NO + :safety: QM + :expect: is missing required attribute: `status` + + Missing `status` test for aou_req. + + +.. + Invalid ``security`` value for every directive that declares it, + i.e. all requirement types and all architecture types. + + +.. feat_req:: Invalid security + :id: feat_req__attrs__bad_security + :reqtype: Functional + :security: MAYBE + :safety: QM + :status: valid + :valid_from: v1.0 + :satisfied_by: feat__attrs_support + :expect: security (MAYBE): does not follow pattern + :expect_not: status (valid): does not follow pattern + + Negative `security` test for feat_req. + + +.. comp_req:: Invalid security + :id: comp_req__attrs__bad_security + :reqtype: Functional + :security: MAYBE + :safety: QM + :status: valid + :satisfied_by: comp__attrs_support + :expect: security (MAYBE): does not follow pattern + :expect_not: status (valid): does not follow pattern + + Negative `security` test for comp_req. + + +.. aou_req:: Invalid security + :id: aou_req__attrs__bad_security + :reqtype: Functional + :security: MAYBE + :safety: QM + :status: valid + :expect: security (MAYBE): does not follow pattern + :expect_not: status (valid): does not follow pattern + + Negative `security` test for aou_req. + + +.. feat:: Invalid security + :id: feat__attrs_bad_security + :version: 1 + :security: MAYBE + :safety: QM + :status: valid + :expect: security (MAYBE): does not follow pattern + :expect_not: status (valid): does not follow pattern + + +.. feat_arc_sta:: Invalid security + :id: feat_arc_sta__attrs__bad_security + :security: MAYBE + :safety: QM + :status: valid + :includes: logic_arc_int__attrs_support, logic_arc_int_op__attrs_support + :belongs_to: feat__attrs_support + :expect: security (MAYBE): does not follow pattern + :expect_not: status (valid): does not follow pattern + + +.. feat_arc_dyn:: Invalid security + :id: feat_arc_dyn__attrs__bad_security + :security: MAYBE + :safety: QM + :status: valid + :belongs_to: feat__attrs_support + :expect: security (MAYBE): does not follow pattern + :expect_not: status (valid): does not follow pattern + + +.. logic_arc_int:: Invalid security + :id: logic_arc_int__attrs__bad_security + :security: MAYBE + :safety: QM + :status: valid + :expect: security (MAYBE): does not follow pattern + :expect_not: status (valid): does not follow pattern + + +.. logic_arc_int_op:: Invalid security + :id: logic_arc_int_op__attrs__bad_security + :security: MAYBE + :safety: QM + :status: valid + :included_by: logic_arc_int__attrs_support + :expect: security (MAYBE): does not follow pattern + :expect_not: status (valid): does not follow pattern + + +.. comp:: Invalid security + :id: comp__attrs_bad_security + :version: 1 + :security: MAYBE + :safety: QM + :status: valid + :belongs_to: feat__attrs_support + :expect: security (MAYBE): does not follow pattern + :expect_not: status (valid): does not follow pattern + + +.. comp_arc_sta:: Invalid security + :id: comp_arc_sta__attrs__bad_security + :security: MAYBE + :safety: QM + :status: valid + :belongs_to: comp__attrs_support + :expect: security (MAYBE): does not follow pattern + :expect_not: status (valid): does not follow pattern + + +.. comp_arc_dyn:: Invalid security + :id: comp_arc_dyn__attrs__bad_security + :security: MAYBE + :safety: QM + :status: valid + :belongs_to: comp__attrs_support + :expect: security (MAYBE): does not follow pattern + :expect_not: status (valid): does not follow pattern + + +.. real_arc_int:: Invalid security + :id: real_arc_int__attrs__bad_security + :security: MAYBE + :safety: QM + :status: valid + :language: cpp + :expect: security (MAYBE): does not follow pattern + :expect_not: status (valid): does not follow pattern + + +.. real_arc_int_op:: Invalid security + :id: real_arc_int_op__attrs__bad_security + :security: MAYBE + :safety: QM + :status: valid + :included_by: real_arc_int__attrs_support + :expect: security (MAYBE): does not follow pattern + :expect_not: status (valid): does not follow pattern + + +.. + Missing ``security`` value for all requirement types. + + +.. feat_req:: Missing security + :id: feat_req__attrs__missing_security + :reqtype: Functional + :safety: QM + :status: valid + :valid_from: v1.0 + :satisfied_by: feat__attrs_support + :expect: is missing required attribute: `security` + + Missing `security` test for feat_req. + + +.. comp_req:: Missing security + :id: comp_req__attrs__missing_security + :reqtype: Functional + :safety: QM + :status: valid + :satisfied_by: comp__attrs_support + :expect: is missing required attribute: `security` + + Missing `security` test for comp_req. + + +.. aou_req:: Missing security + :id: aou_req__attrs__missing_security + :reqtype: Functional + :safety: QM + :status: valid + :expect: is missing required attribute: `security` + + Missing `security` test for aou_req. diff --git a/src/extensions/score_metamodel/tests/rst/options/test_options_links_milestones.rst b/src/extensions/score_metamodel/tests/rst/options/test_options_links_milestones.rst new file mode 100644 index 000000000..d60fc3090 --- /dev/null +++ b/src/extensions/score_metamodel/tests/rst/options/test_options_links_milestones.rst @@ -0,0 +1,394 @@ +.. + # ******************************************************************************* + # Copyright (c) 2026 Contributors to the Eclipse Foundation + # + # See the NOTICE file(s) distributed with this work for additional + # information regarding copyright ownership. + # + # This program and the accompanying materials are made available under the + # terms of the Apache License Version 2.0 which is available at + # https://www.apache.org/licenses/LICENSE-2.0 + # + # SPDX-License-Identifier: Apache-2.0 + # ******************************************************************************* + +.. test_metadata:: + :id: test_metadata__links_and_milestones + :partially_verifies_list: tool_req__docs_req_types[version==1] + :test_type: requirements_based + :derivation_technique: requirements_based + + Tests the required options and links of the requirement types + (std_wp/stkh_req/feat_req), the `mod` maturity option, + the `fulfils` link and the milestone (`valid_from` / `valid_until`) + value checks. + + +.. + Required option: `status` is missing + +.. std_wp:: This is a test + :id: std_wp__test__abcd + :expect: std_wp__test__abcd: is missing required attribute: `status`. + + + +.. All required options are present + +.. std_wp:: This is a test + :id: std_wp__test_options__abce + :status: active + :version: 1 + :expect_not: attribute + + + +.. Required link `derived_from` refers to wrong requirement type + +.. feat_req:: Child requirement + :id: feat_req__abce + :derived_from: std_wp__test_options__abce + :expect: feat_req__abce: references 'std_wp__test_options__abce' as 'derived_from', but it must reference Stakeholder Requirement (stkh_req). + + + +.. All required links are present + +.. feat_req:: Child requirement + :id: feat_req__abcg + :derived_from: stkh_req__abcd + :satisfied_by: feat__abcg + :expect_not: feat_req__abcg: is missing required link + +.. stkh_req:: Parent requirement + :id: stkh_req__abcd + + + +.. Test if the optional `maturity` option for `mod` follows the pattern `^(preview|experimental|release)$` + +.. mod:: Test Module Maturity Bad + :id: mod__test_options__maturity_bad + :maturity: stable + :expect: mod__test_options__maturity_bad.maturity (stable): does not follow pattern `^(preview|experimental|release)$`. + + + +.. mod:: Test Module Maturity Good + :id: mod__test_options__maturity_good + :maturity: preview + :expect_not: does not follow pattern + +.. comp_req:: Child requirement ASIL_B + :id: comp_req__child__ASIL_B + :safety: ASIL_B + :status: valid + + +.. Positive Test: fulfils is optional for static views, an unlinked feat_arc_sta is accepted. + +.. feat_arc_sta:: Static view without fulfils + :id: feat_arc_sta__fulfils__optional + :status: valid + :safety: ASIL_B + :security: YES + :expect_not: is missing required link: `fulfils` + + +.. Negative Test: when fulfils is present, its target type is still restricted. + +.. feat_arc_sta:: Static view with invalid fulfils target + :id: feat_arc_sta__fulfils__bad_target + :status: valid + :safety: ASIL_B + :security: YES + :fulfils: comp_req__child__ASIL_B + :expect: feat_arc_sta__fulfils__bad_target: references 'comp_req__child__ASIL_B' as 'fulfils', but it must reference Feature Requirement (feat_req) or Assumption of Use Requirement (aou_req). +.. Tests if the attribute `safety` follows the pattern `^(QM|ASIL_B)$` + +.. document:: This is a test document + :id: doc__test_good_1 + :status: valid + :safety: QM + :expect_not: does not follow pattern + + +.. document:: This is a test document + :id: doc__test_good_2 + :status: valid + :safety: ASIL_B + :expect_not: does not follow pattern + + +.. Tests if the attribute `status` follows the pattern `^(valid|draft|invalid)$` + +.. document:: This is a test document + :id: doc__test_good_3 + :status: draft + :safety: QM + :expect_not: does not follow pattern + + + +.. document:: This is a test document + :id: doc__test_bad_status_1 + :status: active + :safety: QM + :expect: doc__test_bad_status_1.status (active): does not follow pattern `^(valid|draft|invalid)$`., + doc__test_bad_status_1: is missing required attribute: `security`., + doc__test_bad_status_1: is missing required link: `realizes`. + + + + +.. stkh_req:: This is a test + :id: stkh_req__test_good_1 + :status: valid + :safety: QM + :expect_not: does not follow pattern + + + + +.. stkh_req:: This is a test + :id: stkh_req__test_good_2 + :status: valid + :safety: ASIL_B + :expect_not: does not follow pattern + + + + +.. feat_req:: This is a test + :id: feat_req__test_good_1 + :status: valid + :safety: QM + :expect_not: does not follow pattern + + + + +.. feat_req:: This is a test + :id: feat_req__test_good_2 + :status: valid + :safety: ASIL_B + :expect_not: does not follow pattern + + + + +.. comp_req:: This is a test + :id: comp_req__test_good_1 + :status: valid + :safety: QM + :expect_not: does not follow pattern + + + + +.. comp_req:: This is a test + :id: comp_req__test_good_2 + :status: valid + :safety: ASIL_B + :expect_not: does not follow pattern + + + + +.. tool_req:: This is a test + :id: tool_req__test_good_1 + :status: valid + :safety: QM + :satisfies: comp_req__test_good_1 + :expect_not: does not follow pattern + + + + + +.. tool_req:: This is a test + :id: tool_req__test_good_2 + :status: valid + :safety: ASIL_B + :satisfies: comp_req__test_good_2 + :expect_not: does not follow pattern + + + + +.. aou_req:: This is a test + :id: aou_req__test_good_1 + :status: valid + :safety: QM + :expect_not: does not follow pattern + + + + +.. aou_req:: This is a test + :id: aou_req__test_good_2 + :status: valid + :safety: ASIL_B + :expect_not: does not follow pattern + + + + +.. feat_arc_sta:: This is a test + :id: feat_arc_sta__test_good_1 + :status: valid + :safety: QM + :expect_not: does not follow pattern + + + +.. feat_arc_sta:: This is a test + :id: feat_arc_sta__test_good_2 + :status: valid + :safety: ASIL_B + :expect_not: does not follow pattern + + + + +.. feat_arc_dyn:: This is a test + :id: feat_arc_dyn__test_good_1 + :status: valid + :safety: QM + :expect_not: does not follow pattern + + + + + +.. feat_arc_dyn:: This is a test + :id: feat_arc_dyn__test_good_2 + :status: valid + :safety: ASIL_B + :expect_not: does not follow pattern + + + + +.. logic_arc_int:: This is a test + :id: logic_arc_int__test_good_1 + :status: valid + :safety: QM + :expect_not: does not follow pattern + + + + + +.. logic_arc_int:: This is a test + :id: logic_arc_int__test_good_2 + :status: valid + :safety: ASIL_B + :expect_not: does not follow pattern + + + + +.. logic_arc_int_op:: This is a test + :id: logic_arc_int_op__test_good_1 + :status: valid + :safety: QM + :expect_not: does not follow pattern + + + + +.. logic_arc_int_op:: This is a test + :id: logic_arc_int_op__test_good_2 + :status: valid + :safety: ASIL_B + :expect_not: does not follow pattern + + + + +.. comp_arc_sta:: This is a test + :id: comp_arc_sta__test_good_1 + :status: valid + :safety: QM + :expect_not: does not follow pattern + + + + +.. comp_arc_sta:: This is a test + :id: comp_arc_sta__test_good_2 + :status: valid + :safety: ASIL_B + :expect_not: does not follow pattern + + + + +.. comp_arc_dyn:: This is a test + :id: comp_arc_dyn__test_good_1 + :status: valid + :safety: QM + :expect_not: does not follow pattern + + + + +.. comp_arc_dyn:: This is a test + :id: comp_arc_dyn__test_good_2 + :status: valid + :safety: ASIL_B + :expect_not: does not follow pattern + + + + + +.. real_arc_int:: This is a test + :id: real_arc_int__test_good_1 + :status: valid + :safety: QM + :expect_not: does not follow pattern + + + + +.. real_arc_int:: This is a test + :id: real_arc_int__test_good_2 + :status: valid + :safety: ASIL_B + :expect_not: does not follow pattern + + + + +.. real_arc_int_op:: This is a test + :id: real_arc_int_op__test_good_1 + :status: valid + :safety: QM + :expect_not: does not follow pattern + + + +.. real_arc_int_op:: This is a test + :id: real_arc_int_op__test_good_2 + :status: valid + :safety: ASIL_B + :expect_not: does not follow pattern + + + +.. feat_req:: milestone must be a version + :id: feat_req__random_id3 + :valid_from: 2035-03 + :expect: feat_req__random_id3.valid_from (2035-03): does not follow pattern + + + + +.. feat_req:: milestone must be a version + :id: feat_req__random_id4 + :valid_until: 2035-03 + :expect: feat_req__random_id4.valid_until (2035-03): does not follow pattern + + diff --git a/src/extensions/score_metamodel/tests/rst/options/test_options_options.rst b/src/extensions/score_metamodel/tests/rst/options/test_options_safety_analysis.rst similarity index 55% rename from src/extensions/score_metamodel/tests/rst/options/test_options_options.rst rename to src/extensions/score_metamodel/tests/rst/options/test_options_safety_analysis.rst index 4cedcb548..a2be3fb83 100644 --- a/src/extensions/score_metamodel/tests/rst/options/test_options_options.rst +++ b/src/extensions/score_metamodel/tests/rst/options/test_options_safety_analysis.rst @@ -1,6 +1,6 @@ .. # ******************************************************************************* - # Copyright (c) 2025 Contributors to the Eclipse Foundation + # Copyright (c) 2026 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. @@ -12,55 +12,16 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* - .. test_metadata:: - :id: test_metadata__mandatory_options_and_links - :partially_verifies_list: tool_req__docs_common_attr_status[version==1], tool_req__docs_req_types[version==1] + :id: test_metadata__safety_analysis_options + :partially_verifies_list: tool_req__docs_saf_attrs_sufficient :test_type: requirements_based :derivation_technique: requirements_based - Tests if we correctly enforce mandatory options & links - -.. - Required option: `status` is missing - -.. std_wp:: This is a test - :id: std_wp__test__abcd - :expect: std_wp__test__abcd: is missing required attribute: `status`. - - - -.. All required options are present - -.. std_wp:: This is a test - :id: std_wp__test_options__abce - :status: active - :version: 1 - :expect_not: attribute - - - -.. Required link `derived_from` refers to wrong requirement type - -.. feat_req:: Child requirement - :id: feat_req__abce - :derived_from: std_wp__test_options__abce - :expect: feat_req__abce: references 'std_wp__test_options__abce' as 'derived_from', but it must reference Stakeholder Requirement (stkh_req). - - - -.. All required links are present - -.. feat_req:: Child requirement - :id: feat_req__abcg - :derived_from: stkh_req__abcd - :satisfied_by: feat__abcg - :expect_not: feat_req__abcg: is missing required link - -.. stkh_req:: Parent requirement - :id: stkh_req__abcd - - + Tests the `sufficient` option of the safety-analysis types, + the `violates` / `mitigated_by` link restrictions, the non-empty + `content` check, and the security-analysis types (feat_sec_threat, + feat_sec_ana). .. Test if the `sufficient` option for Safety Analysis (FMEA and DFA) follows the pattern `^(yes|no)$` @@ -78,22 +39,6 @@ -.. Test if the optional `maturity` option for `mod` follows the pattern `^(preview|experimental|release)$` - -.. mod:: Test Module Maturity Bad - :id: mod__test_options__maturity_bad - :maturity: stable - :expect: mod__test_options__maturity_bad.maturity (stable): does not follow pattern `^(preview|experimental|release)$`. - - - -.. mod:: Test Module Maturity Good - :id: mod__test_options__maturity_good - :maturity: preview - :expect_not: does not follow pattern - - - .. feat_saf_fmea:: This is a test :id: feat_saf_fmea__test_options__3 :sufficient: no @@ -193,6 +138,21 @@ :expect: feat_saf_fmea__test_options__bad_16.sufficient (yEs): does not follow pattern `^(yes|no)$`. +.. + Support architecture views for the positive `violates` link tests below. + +.. feat_arc_dyn:: This is a test + :id: feat_arc_dyn__test_good_1 + :status: valid + :safety: QM + :expect_not: does not follow pattern + +.. feat_arc_sta:: This is a test + :id: feat_arc_sta__test_good_1 + :status: valid + :safety: QM + :expect_not: does not follow pattern + .. comp_req:: Child requirement ASIL_B :id: comp_req__child__ASIL_B @@ -237,307 +197,6 @@ :violates: feat_arc_sta__test_good_1 :expect_not: violates ---- feat_saf_fmea violates end --- - - ---- arch fulfils optional begin --- - -.. Positive Test: fulfils is optional for static views, an unlinked feat_arc_sta is accepted. - -.. feat_arc_sta:: Static view without fulfils - :id: feat_arc_sta__fulfils__optional - :status: valid - :safety: ASIL_B - :security: YES - :expect_not: is missing required link: `fulfils` - - -.. Negative Test: when fulfils is present, its target type is still restricted. - -.. feat_arc_sta:: Static view with invalid fulfils target - :id: feat_arc_sta__fulfils__bad_target - :status: valid - :safety: ASIL_B - :security: YES - :fulfils: comp_req__child__ASIL_B - :expect: feat_arc_sta__fulfils__bad_target: references 'comp_req__child__ASIL_B' as 'fulfils', but it must reference Feature Requirement (feat_req) or Assumption of Use Requirement (aou_req). - ---- arch fulfils optional end --- - - -.. Tests if the attribute `safety` follows the pattern `^(QM|ASIL_B)$` - -.. document:: This is a test document - :id: doc__test_good_1 - :status: valid - :safety: QM - :expect_not: does not follow pattern - - -.. document:: This is a test document - :id: doc__test_good_2 - :status: valid - :safety: ASIL_B - :expect_not: does not follow pattern - - -.. Tests if the attribute `status` follows the pattern `^(valid|draft|invalid)$` - -.. document:: This is a test document - :id: doc__test_good_3 - :status: draft - :safety: QM - :expect_not: does not follow pattern - - - -.. document:: This is a test document - :id: doc__test_bad_status_1 - :status: active - :safety: QM - :expect: doc__test_bad_status_1.status (active): does not follow pattern `^(valid|draft|invalid)$`., - doc__test_bad_status_1: is missing required attribute: `security`., - doc__test_bad_status_1: is missing required link: `realizes`. - - - - -.. stkh_req:: This is a test - :id: stkh_req__test_good_1 - :status: valid - :safety: QM - :expect_not: does not follow pattern - - - - -.. stkh_req:: This is a test - :id: stkh_req__test_good_2 - :status: valid - :safety: ASIL_B - :expect_not: does not follow pattern - - - - -.. feat_req:: This is a test - :id: feat_req__test_good_1 - :status: valid - :safety: QM - :expect_not: does not follow pattern - - - - -.. feat_req:: This is a test - :id: feat_req__test_good_2 - :status: valid - :safety: ASIL_B - :expect_not: does not follow pattern - - - - -.. comp_req:: This is a test - :id: comp_req__test_good_1 - :status: valid - :safety: QM - :expect_not: does not follow pattern - - - - -.. comp_req:: This is a test - :id: comp_req__test_good_2 - :status: valid - :safety: ASIL_B - :expect_not: does not follow pattern - - - - -.. tool_req:: This is a test - :id: tool_req__test_good_1 - :status: valid - :safety: QM - :satisfies: comp_req__test_good_1 - :expect_not: does not follow pattern - - - - - -.. tool_req:: This is a test - :id: tool_req__test_good_2 - :status: valid - :safety: ASIL_B - :satisfies: comp_req__test_good_2 - :expect_not: does not follow pattern - - - - -.. aou_req:: This is a test - :id: aou_req__test_good_1 - :status: valid - :safety: QM - :expect_not: does not follow pattern - - - - -.. aou_req:: This is a test - :id: aou_req__test_good_2 - :status: valid - :safety: ASIL_B - :expect_not: does not follow pattern - - - - -.. feat_arc_sta:: This is a test - :id: feat_arc_sta__test_good_1 - :status: valid - :safety: QM - :expect_not: does not follow pattern - - - -.. feat_arc_sta:: This is a test - :id: feat_arc_sta__test_good_2 - :status: valid - :safety: ASIL_B - :expect_not: does not follow pattern - - - - -.. feat_arc_dyn:: This is a test - :id: feat_arc_dyn__test_good_1 - :status: valid - :safety: QM - :expect_not: does not follow pattern - - - - - -.. feat_arc_dyn:: This is a test - :id: feat_arc_dyn__test_good_2 - :status: valid - :safety: ASIL_B - :expect_not: does not follow pattern - - - - -.. logic_arc_int:: This is a test - :id: logic_arc_int__test_good_1 - :status: valid - :safety: QM - :expect_not: does not follow pattern - - - - - -.. logic_arc_int:: This is a test - :id: logic_arc_int__test_good_2 - :status: valid - :safety: ASIL_B - :expect_not: does not follow pattern - - - - -.. logic_arc_int_op:: This is a test - :id: logic_arc_int_op__test_good_1 - :status: valid - :safety: QM - :expect_not: does not follow pattern - - - - -.. logic_arc_int_op:: This is a test - :id: logic_arc_int_op__test_good_2 - :status: valid - :safety: ASIL_B - :expect_not: does not follow pattern - - - - -.. comp_arc_sta:: This is a test - :id: comp_arc_sta__test_good_1 - :status: valid - :safety: QM - :expect_not: does not follow pattern - - - - -.. comp_arc_sta:: This is a test - :id: comp_arc_sta__test_good_2 - :status: valid - :safety: ASIL_B - :expect_not: does not follow pattern - - - - -.. comp_arc_dyn:: This is a test - :id: comp_arc_dyn__test_good_1 - :status: valid - :safety: QM - :expect_not: does not follow pattern - - - - -.. comp_arc_dyn:: This is a test - :id: comp_arc_dyn__test_good_2 - :status: valid - :safety: ASIL_B - :expect_not: does not follow pattern - - - - - -.. real_arc_int:: This is a test - :id: real_arc_int__test_good_1 - :status: valid - :safety: QM - :expect_not: does not follow pattern - - - - -.. real_arc_int:: This is a test - :id: real_arc_int__test_good_2 - :status: valid - :safety: ASIL_B - :expect_not: does not follow pattern - - - - -.. real_arc_int_op:: This is a test - :id: real_arc_int_op__test_good_1 - :status: valid - :safety: QM - :expect_not: does not follow pattern - - - -.. real_arc_int_op:: This is a test - :id: real_arc_int_op__test_good_2 - :status: valid - :safety: ASIL_B - :expect_not: does not follow pattern - - .. Ensuring that non empty content is detected correctly @@ -561,21 +220,6 @@ - -.. feat_req:: milestone must be a version - :id: feat_req__random_id3 - :valid_from: 2035-03 - :expect: feat_req__random_id3.valid_from (2035-03): does not follow pattern - - - - -.. feat_req:: milestone must be a version - :id: feat_req__random_id4 - :valid_until: 2035-03 - :expect: feat_req__random_id4.valid_until (2035-03): does not follow pattern - - .. Security Analysis: feat_sec_threat diff --git a/src/extensions/score_metamodel/tests/rst/safety/test_saf_mandatory_attrs.rst b/src/extensions/score_metamodel/tests/rst/safety/test_saf_mandatory_attrs.rst index eaff4400d..e869d4339 100644 --- a/src/extensions/score_metamodel/tests/rst/safety/test_saf_mandatory_attrs.rst +++ b/src/extensions/score_metamodel/tests/rst/safety/test_saf_mandatory_attrs.rst @@ -36,7 +36,7 @@ :status: valid :failure_effect: signal lost :sufficient: yes - :expect: is missing required attribute: `failure_id` + :expect: is missing required attribute: `failure_id`. .. comp_saf_dfa:: Valid failure_id diff --git a/src/extensions/score_metamodel/tests/rst/safety/test_saf_violates.rst b/src/extensions/score_metamodel/tests/rst/safety/test_saf_violates.rst index 1bc9c1232..79e2013bf 100644 --- a/src/extensions/score_metamodel/tests/rst/safety/test_saf_violates.rst +++ b/src/extensions/score_metamodel/tests/rst/safety/test_saf_violates.rst @@ -14,7 +14,7 @@ .. test_metadata:: :id: test_metadata__saf_violates - :partially_verifies_list: tool_req__docs_saf_attrs_violates[version==2] + :fully_verifies_list: tool_req__docs_saf_attrs_violates[version==2] :test_type: requirements_based :derivation_technique: requirements_based @@ -130,3 +130,49 @@ :status: valid :violates: feat_arc_sta__bad_001 :expect: must reference Component Package Diagram + + +.. comp_saf_fmea:: comp FMEA violates feat arc + :id: comp_saf_fmea__viol__bad_001 + :fault_id: fault_bad_005 + :failure_effect: wrong link target + :sufficient: no + :status: valid + :violates: feat_arc_dyn__001 + :expect: must reference Component Sequence Diagram + + +.. feat_saf_dfa:: Missing violates link + :id: feat_saf_dfa__viol__missing_001 + :failure_id: df_missing_violates + :failure_effect: missing link + :sufficient: no + :status: valid + :expect: is missing required link: `violates` + + +.. comp_saf_dfa:: Missing violates link + :id: comp_saf_dfa__viol__missing_001 + :failure_id: df_missing_violates_dfa + :failure_effect: missing link + :sufficient: no + :status: valid + :expect: is missing required link: `violates` + + +.. feat_saf_fmea:: Missing violates link + :id: feat_saf_fmea__viol__missing_001 + :fault_id: fault_missing_violates_fmea + :failure_effect: missing link + :sufficient: yes + :status: valid + :expect: is missing required link: `violates` + + +.. comp_saf_fmea:: Missing violates link + :id: comp_saf_fmea__viol__missing_001 + :fault_id: fault_missing_violates_fmea + :failure_effect: missing link + :sufficient: yes + :status: valid + :expect: is missing required link: `violates` diff --git a/src/extensions/score_metamodel/tests/test_check_options.py b/src/extensions/score_metamodel/tests/test_check_options.py index 97d4b61c6..4b447329b 100644 --- a/src/extensions/score_metamodel/tests/test_check_options.py +++ b/src/extensions/score_metamodel/tests/test_check_options.py @@ -67,9 +67,9 @@ class TestCheckOptions: ] @add_test_properties( - partially_verifies=["tool_req__docs_common_attr_security"], - test_type="requirements-based", - derivation_technique="requirements-analysis", + partially_verifies=[], + test_type="interface-test", + derivation_technique="error-guessing", ) def test_unknown_directive(self): """Given a need with an unknown type, should raise an error""" @@ -91,9 +91,9 @@ def test_unknown_directive(self): check_options(app, need_1, cast(CheckLogger, logger)) @add_test_properties( - partially_verifies=["tool_req__docs_common_attr_description"], - test_type="requirements-based", - derivation_technique="requirements-analysis", + partially_verifies=[], + test_type="interface-test", + derivation_technique="error-guessing", ) def test_unknown_option_present_in_neither_req_opt_neither_opt_opt(self): """ diff --git a/src/extensions/score_metamodel/tests/test_metamodel__init__.py b/src/extensions/score_metamodel/tests/test_metamodel__init__.py index ba4de2659..b2425207d 100644 --- a/src/extensions/score_metamodel/tests/test_metamodel__init__.py +++ b/src/extensions/score_metamodel/tests/test_metamodel__init__.py @@ -43,9 +43,9 @@ def setup_checks(): @add_test_properties( - partially_verifies=["tool_req__docs_common_attr_description"], - test_type="requirements-based", - derivation_technique="requirements-analysis", + partially_verifies=[], + test_type="interface-test", + derivation_technique="equivalence-classes", ) def test_returns_empty_list_when_filter_is_empty(): """Return an empty list if no filter string is provided.""" @@ -53,9 +53,9 @@ def test_returns_empty_list_when_filter_is_empty(): @add_test_properties( - partially_verifies=["tool_req__docs_common_attr_description"], - test_type="requirements-based", - derivation_technique="requirements-analysis", + partially_verifies=[], + test_type="interface-test", + derivation_technique="equivalence-classes", ) def test_returns_valid_checks(): """Return the provided valid check names.""" @@ -64,9 +64,9 @@ def test_returns_valid_checks(): @add_test_properties( - partially_verifies=["tool_req__docs_common_attr_description"], - test_type="requirements-based", - derivation_technique="requirements-analysis", + partially_verifies=[], + test_type="interface-test", + derivation_technique="equivalence-classes", ) def test_strips_whitespace(): """Remove surrounding spaces from each check name.""" @@ -75,9 +75,9 @@ def test_strips_whitespace(): @add_test_properties( - partially_verifies=["tool_req__docs_common_attr_description"], - test_type="requirements-based", - derivation_technique="requirements-analysis", + partially_verifies=[], + test_type="interface-test", + derivation_technique="error-guessing", ) def test_raises_assertion_for_invalid_check(): """Raise AssertionError if a check name is unknown."""