diff --git a/BUILD b/BUILD index 345d4421..42507311 100644 --- a/BUILD +++ b/BUILD @@ -24,7 +24,6 @@ copyright_checker( name = "copyright", srcs = [ "score", - "tests", "//:BUILD", "//:MODULE.bazel", ], @@ -57,5 +56,7 @@ docs( data = [ "@score_process_description//:needs_json", ], + project = "Module Template Project", + project_url = "https://eclipse-score.github.io/module_template/", source_dir = "docs", ) diff --git a/docs/conf.py b/docs/conf.py deleted file mode 100644 index c083d31d..00000000 --- a/docs/conf.py +++ /dev/null @@ -1,17 +0,0 @@ -# ******************************************************************************* -# 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 -# ******************************************************************************* - -project = "Module Template Project" -project_url = "https://eclipse-score.github.io/module_template/" - -extensions = ["score_sphinx_bundle"] diff --git a/docs/features/feature_example/architecture/arc_inspection.rst b/docs/features/architecture/arc_inspection.rst similarity index 100% rename from docs/features/feature_example/architecture/arc_inspection.rst rename to docs/features/architecture/arc_inspection.rst diff --git a/docs/features/feature_example/architecture/index.rst b/docs/features/architecture/index.rst similarity index 100% rename from docs/features/feature_example/architecture/index.rst rename to docs/features/architecture/index.rst diff --git a/docs/features/feature_example/index.rst b/docs/features/feature_example/index.rst deleted file mode 100644 index b174ba02..00000000 --- a/docs/features/feature_example/index.rst +++ /dev/null @@ -1,30 +0,0 @@ -.. - # ******************************************************************************* - # 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 - # ******************************************************************************* - -[Feature Name] -############## - -Feature description and requirements can be found in the SCORE Platform. - -.. toctree:: - :hidden: - - architecture/index.rst - architecture/arc_inspection.rst - safety_analysis/fmea.rst - safety_analysis/dfa.rst - safety_analysis/aou_requirements.rst - safety_planning/index.rst - security_planning/index.rst - security_analysis/aou_requirements.rst diff --git a/docs/features/index.rst b/docs/features/index.rst index 0dff9502..b174ba02 100644 --- a/docs/features/index.rst +++ b/docs/features/index.rst @@ -12,13 +12,19 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -.. _features_template: +[Feature Name] +############## -Features -======== +Feature description and requirements can be found in the SCORE Platform. .. toctree:: - :maxdepth: 1 - :glob: + :hidden: - */index + architecture/index.rst + architecture/arc_inspection.rst + safety_analysis/fmea.rst + safety_analysis/dfa.rst + safety_analysis/aou_requirements.rst + safety_planning/index.rst + security_planning/index.rst + security_analysis/aou_requirements.rst diff --git a/docs/features/feature_example/safety_analysis/aou_requirements.rst b/docs/features/safety_analysis/aou_requirements.rst similarity index 100% rename from docs/features/feature_example/safety_analysis/aou_requirements.rst rename to docs/features/safety_analysis/aou_requirements.rst diff --git a/docs/features/feature_example/safety_analysis/dfa.rst b/docs/features/safety_analysis/dfa.rst similarity index 100% rename from docs/features/feature_example/safety_analysis/dfa.rst rename to docs/features/safety_analysis/dfa.rst diff --git a/docs/features/feature_example/safety_analysis/fmea.rst b/docs/features/safety_analysis/fmea.rst similarity index 100% rename from docs/features/feature_example/safety_analysis/fmea.rst rename to docs/features/safety_analysis/fmea.rst diff --git a/docs/features/feature_example/safety_planning/index.rst b/docs/features/safety_planning/index.rst similarity index 100% rename from docs/features/feature_example/safety_planning/index.rst rename to docs/features/safety_planning/index.rst diff --git a/docs/features/feature_example/security_analysis/aou_requirements.rst b/docs/features/security_analysis/aou_requirements.rst similarity index 100% rename from docs/features/feature_example/security_analysis/aou_requirements.rst rename to docs/features/security_analysis/aou_requirements.rst diff --git a/docs/features/feature_example/security_planning/index.rst b/docs/features/security_planning/index.rst similarity index 100% rename from docs/features/feature_example/security_planning/index.rst rename to docs/features/security_planning/index.rst diff --git a/docs/template/index.rst b/docs/template/index.rst index 65fa9903..5917d8f1 100644 --- a/docs/template/index.rst +++ b/docs/template/index.rst @@ -28,10 +28,13 @@ It also provides an example of modeling architecture in Sphinx Needs in :ref:`de It also provides the component architecture template snippets in :ref:`component_architecture`. It also provides an example of documenting detailed design in :ref:`detailed_design_example`. -Module Folder Structure (Multiple Features Variant) ---------------------------------------------------- -The module template includes the following top-level structure: +Module Folder Structure +----------------------- + +.. note:: + When only a single feature is implemented in the module, the additional feature-name nesting under ``docs/features/`` can be omitted. + If multiple features are to be references, then structure them under ``docs/features//``. .. parsed-literal:: @@ -40,7 +43,7 @@ The module template includes the following top-level structure: │ └── workflows/ # CI/CD pipelines ├── docs/ # Global documentation of the module │ ├── features/ # Feature documentation and architecture - │ │ └── / # Folder for each feature parts which should be in module documentation + │ │ └── / # Folder for each feature parts which should be in module documentation. Omit in single feature case. │ │ ├── architecture/ # Feature architecture [:need:`wp__feature_arch`] | | | # and of architecture review [:need:`wp__sw_arch_verification`] │ │ ├── safety_analysis/ # Feature safety analysis artifacts @@ -72,7 +75,7 @@ The module template includes the following top-level structure: │ # module verifications [:need:`wp__verification_module_ver_report`], ├── examples/ # Usage examples for the module / features ├── score/ # Components of the module - │ ├── tests/ # Module-level tests (e.g. feature integration tests) [:need:`wp__verification_feat_int_test`] + │ ├── tests/ # Module-level tests (i.e., feature integration tests) [:need:`wp__verification_feat_int_test`] │ └── / # Component folder for each component of the module │ ├── docs/ # Documentation of the component │ │ ├── architecture/ # Component architecture [:need:`wp__component_arch`] @@ -96,80 +99,5 @@ The module template includes the following top-level structure: ├── project_config.bzl # Project metadata used by Bazel macros └── README.md # Entry point of the repository -.. note:: - - The feature-specific subfolder under ``docs/features//`` is only necessary - if more than one feature is implemented in the module. - -Module Folder Structure (Single-Feature Variant) ------------------------------------------------- - -The following variant keeps the same structure but removes the additional -feature-name nesting under ``docs/features/``. In this case, the ``features/`` -subfolder is optional and omitted. This variant is intended for modules that only implement a single feature, to avoid unnecessary nesting. -For identification of the single feature, the repository name or module name should be replicate the feature name. - -.. parsed-literal:: - - / # Root folder of the module, subfolder only if more than one module exists in the repository - ├── .github/ - │ └── workflows/ # CI/CD pipelines - ├── docs/ # Global documentation of the module and the single feature - │ ├── features/ # Feature folder parts for each feature which should be in module documentation - │ │ ├── architecture/ # Feature architecture [:need:`wp__feature_arch`] - | | | # and of architecture review [:need:`wp__sw_arch_verification`] - │ │ ├── safety_analysis/ # Feature safety analysis artifacts - | | | # ([:need:`wp__feature_fmea`], [:need:`wp__feature_dfa`], [:need:`wp__requirements_feat_aou`]) - │ │ ├── safety_planning/ # Feature safety planning artifacts - │ │ ├── security_analysis/ # Feature security analysis artifacts - | | | # ([:need:`wp__feature_security_analysis`], [:need:`wp__requirements_feat_aou`]) - │ │ └── security_planning/ # Feature security planning artifacts - │ ├── module/ # Module documentation - │ | ├── manuals/ # User manual, integration manual, table of assumptions of use - │ │ | | # safety manual [:need:`wp__module_safety_manual`], - │ │ | | # needs table of [:need:`wp__requirements_feat_aou`] - │ │ | | # security manual [:need:`wp__module_security_manual`] - │ │ | │ # Additional optional user centric documentation (e.g. configuration guide, - │ │ | │ # examples user guide, APIs & usage, performance analysis) - │ │ | ├── config/ # Configuration guide (optional) - │ │ | ├── examples/ # Examples user guide (optional) - │ │ | ├── api_description/ # API detail description (optional) - │ │ | └── performance/ # Performance analysis (optional) - │ | ├── release/ # Module release note [:need:`wp__module_sw_release_note`] - │ | ├── safety_mgt/ # Module safety plan [:need:`wp__module_safety_plan`], - │ | │ # module safety package [:need:`wp__module_safety_package`], - │ | │ # formal document and safety analysis reviews [:need:`wp__fdr_reports`] - │ | └── security_mgt/ # Module security plan [:need:`wp__module_security_plan`], - │ | # module security package [:need:`wp__module_security_package`], - │ | # formal document reviews [:need:`wp__fdr_reports_security`], - │ | # module SW bill of material [:need:`wp__sw_module_sbom`] - │ └── verification_report/ # Module verification report, - │ # module verifications [:need:`wp__verification_module_ver_report`], - ├── examples/ # Usage examples for the module / features - ├── score/ # Components of the module - │ ├── tests/ # Module-level tests (e.g. feature integration tests) [:need:`wp__verification_feat_int_test`] - │ └── / # Component folder for each component of the module - │ ├── docs/ # Documentation of the component - │ │ ├── architecture/ # Component architecture [:need:`wp__component_arch`] - │ │ │ # (only if lower level components exist) - | | | # architecture review [:need:`wp__sw_arch_verification`], - │ │ ├── detailed_design/ # Detailed design [:need:`wp__sw_implementation`] - │ │ │ # code inspection [:need:`wp__sw_implementation_inspection`] - │ │ ├── requirements/ # Component requirements [:need:`wp__requirements_comp`],[:need:`wp__requirements_inspect`] - │ │ ├── safety_analysis/ # Safety analysis [:need:`wp__sw_component_fmea`], [:need:`wp__sw_component_dfa`], [:need:`wp__requirements_comp_aou`] - | | | # Component classification [:need:`wp__sw_component_class`] for pre-existing software - │ │ │ # (only if component architecture exists) - │ │ ├── security_analysis/ # Security analysis [:need:`wp__sw_component_security_analysis`] - │ │ │ # (only if component architecture exists) - | | | # component AoU requirements [:need:`wp__requirements_comp_aou`] - │ │ └── manuals/ # User documentation (of a single component, e.g., user manual of a library component, optional) - │ ├── src/ # Source files, include files, unit tests [:need:`wp__verification_sw_unit_test`], - │ │ └── / # Lower level component (follows structure) - │ └── tests/ # Component-level tests (e.g., integration or complex unit tests) [:need:`wp__verification_comp_int_test`] - ├── MODULE.bazel # Bazel module definition - ├── BUILD # Root build rules - ├── project_config.bzl # Project metadata used by Bazel macros - └── README.md # Entry point of the repository - .. attention:: This page is describing the module template and shall be deleted in the module's documentation. diff --git a/score/component_example/BUILD b/score/component_example/BUILD index 2c96bbfa..fac890c2 100644 --- a/score/component_example/BUILD +++ b/score/component_example/BUILD @@ -21,7 +21,18 @@ cc_library( ) cc_test( - name = "component_example_test", + name = "component_example_unit_tests", + size = "small", + srcs = ["src/component_example_test.cpp"], + deps = [ + ":component_example", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "component_example_component_integration_tests", + size = "small", srcs = ["tests/component_example_test.cpp"], deps = [ ":component_example", @@ -31,9 +42,9 @@ cc_test( docs_bundle( name = "docs", - source_dir = "docs", code_targets = [ ":component_example", ], + source_dir = "docs", visibility = ["//visibility:public"], ) diff --git a/score/component_example/src/component_example.cpp b/score/component_example/src/component_example.cpp index 68cf9bf4..a7e542d2 100644 --- a/score/component_example/src/component_example.cpp +++ b/score/component_example/src/component_example.cpp @@ -16,8 +16,12 @@ namespace score { namespace component_example { +std::string make_hello() { + return "Hello"; +} + std::string make_hello_message(const std::string& name) { - return "Hello, " + name + "!"; + return make_hello() + ", " + name + "!"; } } // namespace component_example diff --git a/score/component_example/src/component_example.hpp b/score/component_example/src/component_example.hpp index d5937de1..20a6920d 100644 --- a/score/component_example/src/component_example.hpp +++ b/score/component_example/src/component_example.hpp @@ -19,6 +19,10 @@ namespace score { namespace component_example { +// Unit +std::string make_hello(); + +// Component API std::string make_hello_message(const std::string& name); } // namespace component_example diff --git a/tests/cpp/test_main.cpp b/score/component_example/src/component_example_test.cpp similarity index 51% rename from tests/cpp/test_main.cpp rename to score/component_example/src/component_example_test.cpp index b7e1dc2e..26691570 100644 --- a/tests/cpp/test_main.cpp +++ b/score/component_example/src/component_example_test.cpp @@ -10,32 +10,19 @@ * * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -#include -// Function to be tested -int add(int a, int b) { - return a + b; -} +#include "score/component_example/src/component_example.hpp" -// Test case -TEST(AdditionTest, HandlesPositiveNumbers) { - EXPECT_EQ(add(2, 3), 5); - EXPECT_EQ(add(10, 20), 30); -} +#include +#include -TEST(AdditionTest, HandlesNegativeNumbers) { - EXPECT_EQ(add(-2, -3), -5); - EXPECT_EQ(add(-10, 5), -5); -} +namespace score { +namespace component_example { -TEST(AdditionTest, HandlesZero) { - EXPECT_EQ(add(0, 0), 0); - EXPECT_EQ(add(0, 5), 5); - EXPECT_EQ(add(5, 0), 5); +// Unit test for make_hello() function +TEST(ComponentExampleTest, MakeHelloReturnsExpectedGreeting) { + EXPECT_EQ(make_hello(), "Hello"); } -// Main function for running tests -int main(int argc, char **argv) { - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} +} // namespace component_example +} // namespace score diff --git a/score/component_example/src/details/.gitkeep b/score/component_example/src/details/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/score/component_example/tests/.gitkeep b/score/component_example/tests/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/score/component_example/tests/component_example_test.cpp b/score/component_example/tests/component_example_test.cpp index 0d6c9bb2..ba6ebcf0 100644 --- a/score/component_example/tests/component_example_test.cpp +++ b/score/component_example/tests/component_example_test.cpp @@ -19,6 +19,7 @@ namespace score { namespace component_example { +// Component Integration Test (CIT) for component_example component. TEST(ComponentExampleTest, MakeHelloMessageReturnsExpectedGreeting) { EXPECT_EQ(make_hello_message("World"), "Hello, World!"); EXPECT_EQ(make_hello_message("SCORE"), "Hello, SCORE!"); diff --git a/score/component_example/tests/integration_tests/.gitkeep b/score/component_example/tests/integration_tests/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/cpp/BUILD b/score/tests/BUILD similarity index 70% rename from tests/cpp/BUILD rename to score/tests/BUILD index 16c2c364..b7b9d716 100644 --- a/tests/cpp/BUILD +++ b/score/tests/BUILD @@ -10,10 +10,21 @@ # # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* +load("@rules_cc//cc:defs.bzl", "cc_test") +load("@rules_rust//rust:defs.bzl", "rust_test") + +rust_test( + name = "feature_integration_tests_rust", + size = "small", + srcs = ["test_main.rs"], +) + cc_test( - name = "cpp_test_main", + name = "feature_integration_tests_cpp", + size = "small", srcs = ["test_main.cpp"], deps = [ + "//score/component_example", "@googletest//:gtest_main", # GoogleTest dependency via Bazel Modules ], ) diff --git a/score/tests/features/feature_example/integration_tests/.gitkeep b/score/tests/features/feature_example/integration_tests/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/score/tests/test_main.cpp b/score/tests/test_main.cpp new file mode 100644 index 00000000..85cb6b6e --- /dev/null +++ b/score/tests/test_main.cpp @@ -0,0 +1,27 @@ +/******************************************************************************** + * 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 + ********************************************************************************/ +#include "score/component_example/src/component_example.hpp" +#include + +namespace score { +namespace component_example { + +// Module-level tests (e.g. feature integration tests) +// Only one component in this example. +TEST(ComponentExampleTest, MakeHelloMessageReturnsExpectedGreeting) { + EXPECT_EQ(make_hello_message("World"), "Hello, World!"); + EXPECT_EQ(make_hello_message("SCORE"), "Hello, SCORE!"); +} + +} // namespace component_example +} // namespace score diff --git a/tests/rust/test_main.rs b/score/tests/test_main.rs similarity index 86% rename from tests/rust/test_main.rs rename to score/tests/test_main.rs index 7194058f..09bb618b 100644 --- a/tests/rust/test_main.rs +++ b/score/tests/test_main.rs @@ -11,6 +11,9 @@ // SPDX-License-Identifier: Apache-2.0 // ******************************************************************************* #[test] + +// Module-level tests (e.g. feature integration tests) +// Only one component in this example. fn test_hello() { assert_eq!(2 + 2, 4); } diff --git a/tests/rust/BUILD b/tests/rust/BUILD deleted file mode 100644 index f65caa52..00000000 --- a/tests/rust/BUILD +++ /dev/null @@ -1,18 +0,0 @@ -# ******************************************************************************* -# 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 -# ******************************************************************************* -load("@rules_rust//rust:defs.bzl", "rust_test") - -rust_test( - name = "rust_hello_test", - srcs = ["test_main.rs"], -)