Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ copyright_checker(
name = "copyright",
srcs = [
"score",
"tests",
"//:BUILD",
"//:MODULE.bazel",
],
Expand Down Expand Up @@ -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",
)
17 changes: 0 additions & 17 deletions docs/conf.py

This file was deleted.

30 changes: 0 additions & 30 deletions docs/features/feature_example/index.rst

This file was deleted.

18 changes: 12 additions & 6 deletions docs/features/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
88 changes: 8 additions & 80 deletions docs/template/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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/<feature_name>/``.

.. parsed-literal::

Expand All @@ -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
│ │ └── <feature_name>/ # Folder for each feature parts which should be in module documentation
│ │ └── <feature_name>/ # Folder for each feature parts which should be in module documentation. Omit in single feature case.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Omit subfolder 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
Expand Down Expand Up @@ -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_name>/ # Component folder for each component of the module
│ ├── docs/ # Documentation of the component
│ │ ├── architecture/ # Component architecture [:need:`wp__component_arch`]
Expand All @@ -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/<feature_name>/`` 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::

<module_name>/ # 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_name>/ # 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_comp>/ # Lower level component (follows <component_name> 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.
15 changes: 13 additions & 2 deletions score/component_example/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -31,9 +42,9 @@ cc_test(

docs_bundle(
name = "docs",
source_dir = "docs",
code_targets = [
":component_example",
],
source_dir = "docs",
visibility = ["//visibility:public"],
)
6 changes: 5 additions & 1 deletion score/component_example/src/component_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions score/component_example/src/component_example.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,19 @@
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
#include <gtest/gtest.h>

// 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 <gtest/gtest.h>
#include <string>

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
Empty file.
Empty file.
1 change: 1 addition & 0 deletions score/component_example/tests/component_example_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
Expand Down
Empty file.
13 changes: 12 additions & 1 deletion tests/cpp/BUILD → score/tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
)
Empty file.
27 changes: 27 additions & 0 deletions score/tests/test_main.cpp
Original file line number Diff line number Diff line change
@@ -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 <gtest/gtest.h>

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
3 changes: 3 additions & 0 deletions tests/rust/test_main.rs → score/tests/test_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
18 changes: 0 additions & 18 deletions tests/rust/BUILD

This file was deleted.

Loading