-
Notifications
You must be signed in to change notification settings - Fork 83
Implement integration tests for fields with set and notifier #463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ | |
|
|
||
| #include <gtest/gtest.h> | ||
| #include <memory> | ||
| #include <type_traits> | ||
| #include <utility> | ||
| #include <vector> | ||
|
|
||
|
|
@@ -67,10 +68,13 @@ class MyInterface : public InterfaceTrait::Base | |
| public: | ||
| using InterfaceTrait::Base::Base; | ||
|
|
||
| static constexpr bool kEnableSet{std::is_same_v<InterfaceTrait, SkeletonTrait>}; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you add this? |
||
|
|
||
| typename InterfaceTrait::template Event<TestSampleType> some_event{*this, kEventName}; | ||
| typename InterfaceTrait::template Field<TestSampleType, true> some_field{*this, kFieldName}; | ||
| typename InterfaceTrait::template Field<TestSampleType, false, kEnableSet> some_field{*this, kFieldName}; | ||
| typename InterfaceTrait::template Method<TestMethodType> some_method{*this, kMethodName}; | ||
| }; | ||
|
|
||
| using MyProxy = AsProxy<MyInterface>; | ||
| using MySkeleton = AsSkeleton<MyInterface>; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,28 @@ load("@rules_cc//cc:defs.bzl", "cc_library") | |
| load("@score_baselibs//score/language/safecpp:toolchain_features.bzl", "COMPILER_WARNING_FEATURES") | ||
| load("//quality/unit_testing:unit_testing.bzl", "cc_unit_test") | ||
|
|
||
| cc_library( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moving these should be a separate commit. You can read my comment here to better understand how commits should look / why we split them up: #385 (comment) |
||
| name = "proxy_container", | ||
| srcs = ["proxy_container.cpp"], | ||
| hdrs = ["proxy_container.h"], | ||
| features = COMPILER_WARNING_FEATURES, | ||
| visibility = ["//score/mw/com/test:__subpackages__"], | ||
| deps = [ | ||
| "//score/mw/com", | ||
| ], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "skeleton_container", | ||
| srcs = ["skeleton_container.cpp"], | ||
| hdrs = ["skeleton_container.h"], | ||
| features = COMPILER_WARNING_FEATURES, | ||
| visibility = ["//score/mw/com/test:__subpackages__"], | ||
| deps = [ | ||
| "//score/mw/com", | ||
| ], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "bigdata_type", | ||
| srcs = [ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| # ******************************************************************************* | ||
| # 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_cc//cc:defs.bzl", "cc_binary") | ||
| load("@score_baselibs//score/language/safecpp:toolchain_features.bzl", "COMPILER_WARNING_FEATURES") | ||
| load("//bazel/tools:json_schema_validator.bzl", "validate_json_schema_test") | ||
| load("//score/mw/com/test:pkg_application.bzl", "pkg_application") | ||
|
|
||
| validate_json_schema_test( | ||
| name = "validate_lola_schema", | ||
| json = "config/mw_com_config.json", | ||
| schema = "//score/mw/com:config_schema", | ||
| tags = ["lint"], | ||
| ) | ||
|
|
||
| cc_binary( | ||
| name = "main_service", | ||
| srcs = ["main_service.cpp"], | ||
| data = ["config/mw_com_config.json"], | ||
| features = COMPILER_WARNING_FEATURES + [ | ||
| "aborts_upon_exception", | ||
| ], | ||
| visibility = ["//score/mw/com/test/field_initial_value:__pkg__"], | ||
| deps = [ | ||
| "//score/mw/com", | ||
| "//score/mw/com/test/common_test_resources:sctf_test_runner", | ||
| "//score/mw/com/test/field_initial_value/fields_test_resources:field_provider", | ||
| "@score_baselibs//score/mw/log", | ||
| ], | ||
| ) | ||
|
|
||
| cc_binary( | ||
| name = "main_client", | ||
| srcs = ["main_client.cpp"], | ||
| data = ["config/mw_com_config.json"], | ||
| features = COMPILER_WARNING_FEATURES + [ | ||
| "aborts_upon_exception", | ||
| ], | ||
| visibility = ["//score/mw/com/test/field_initial_value:__pkg__"], | ||
| deps = [ | ||
| "//score/mw/com", | ||
| "//score/mw/com/test/common_test_resources:sctf_test_runner", | ||
| "//score/mw/com/test/field_initial_value/fields_test_resources:field_consumer", | ||
| "@score_baselibs//score/mw/log", | ||
| ], | ||
| ) | ||
|
|
||
| pkg_application( | ||
| name = "main_service-pkg", | ||
| app_name = "MainServiceApp", | ||
| bin = [":main_service"], | ||
| etc = [ | ||
| "config/mw_com_config.json", | ||
| "config/logging.json", | ||
| ], | ||
| visibility = [ | ||
| "//platform/aas/test/mw/com:__pkg__", | ||
| "//score/mw/com/test/field_initial_value:__subpackages__", | ||
| ], | ||
| ) | ||
|
|
||
| pkg_application( | ||
| name = "main_client-pkg", | ||
| app_name = "MainClientApp", | ||
| bin = [":main_client"], | ||
| etc = [ | ||
| "config/mw_com_config.json", | ||
| "config/logging.json", | ||
| ], | ||
| visibility = [ | ||
| "//platform/aas/test/mw/com:__pkg__", | ||
| "//score/mw/com/test/field_initial_value:__subpackages__", | ||
| ], | ||
| ) | ||
|
|
||
| test_suite( | ||
| name = "component_tests", | ||
| tests = [ | ||
| "//score/mw/com/test/field_initial_value/basic_acceptance_test/integration_test:test_field_initial_value", | ||
| ], | ||
| visibility = ["//score/mw/com/test/field_initial_value:__pkg__"], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,4 +5,3 @@ | |
| "logLevelThresholdConsole": "kDebug", | ||
| "logMode": "kRemote|kConsole" | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # ******************************************************************************* | ||
| # 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 | ||
| # ******************************************************************************* | ||
|
|
||
|
|
||
| def client(target, mode, **kwargs): | ||
| args = ["--num-retries", "20", "--backoff-time", "50", "--mode", mode] | ||
| return target.wrap_exec("bin/main_client", args, cwd="/opt/MainClientApp", wait_on_exit=True, **kwargs) | ||
|
|
||
|
|
||
| def service(target, mode, **kwargs): | ||
| args = ["--cycle-time", "250", "--mode", mode] | ||
| return target.wrap_exec("bin/main_service", args, cwd="/opt/MainServiceApp", **kwargs) | ||
|
|
||
|
|
||
| def test_field_initial_value(target): | ||
| """Test field initial value exchange between service and client.""" | ||
| with service(target, "notifier"): | ||
| with client(target, "notifier"): | ||
| pass | ||
|
|
||
|
|
||
| def test_field_set_value(target): | ||
| """Test field set exchange and accepted value propagation between service and client.""" | ||
| with service(target, "set"): | ||
| with client(target, "set"): | ||
| pass | ||
|
|
||
|
|
||
| # TODO: Add a dedicated get scenario test once getter-enabled field mode is available. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| /******************************************************************************* | ||
| * 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/mw/com/test/common_test_resources/sctf_test_runner.h" | ||
| #include "score/mw/com/test/field_initial_value/fields_test_resources/field_consumer.h" | ||
|
|
||
| #include <vector> | ||
|
|
||
| int main(int argc, const char** argv) | ||
| { | ||
| using Parameters = score::mw::com::test::SctfTestRunner::RunParameters::Parameters; | ||
|
|
||
| const std::vector<Parameters> allowed_parameters{ | ||
| Parameters::NUM_RETRIES, Parameters::RETRY_BACKOFF_TIME, Parameters::MODE}; | ||
| score::mw::com::test::SctfTestRunner test_runner(argc, argv, allowed_parameters); | ||
| const auto& run_parameters = test_runner.GetRunParameters(); | ||
|
|
||
| return score::mw::com::test::run_client( | ||
| run_parameters.GetNumRetries(), run_parameters.GetRetryBackoffTime(), run_parameters.GetMode()); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you reorder these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put this change in a separate commit with a good description of why you're changing traits / traits_test.