Skip to content

Implement integration tests for fields with set and notifier#463

Open
sahithi-nukala wants to merge 5 commits into
eclipse-score:mainfrom
sahithi-nukala:sah_add_integration_test_for_fields
Open

Implement integration tests for fields with set and notifier#463
sahithi-nukala wants to merge 5 commits into
eclipse-score:mainfrom
sahithi-nukala:sah_add_integration_test_for_fields

Conversation

@sahithi-nukala
Copy link
Copy Markdown
Contributor

@sahithi-nukala sahithi-nukala commented May 21, 2026

  • Move proxy and skeleton containers from methods to common test resources because it would be used by both fields and methods.
  • Update traits and traits tests for field get/set/notifier parameters.
  • Restructure field initial value integration tests and add set and notifier scenarios

@sahithi-nukala sahithi-nukala force-pushed the sah_add_integration_test_for_fields branch 4 times, most recently from 8306eb3 to 38982b6 Compare May 21, 2026 13:57

// Note : at the moment the SkeletonField::Get implementation is not in the branch which means the skeleton and
// proxy side does not have same template parameters.
template <typename SampleType, bool EnableSet = false, bool EnableGet = false, bool EnableNotifier = false>
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.

Why did you reorder these?

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.

Please put this change in a separate commit with a good description of why you're changing traits / traits_test.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done. updated the traits file changes into a separate commit

public:
using InterfaceTrait::Base::Base;

static constexpr bool kEnableSet{std::is_same_v<InterfaceTrait, SkeletonTrait>};
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.

Why did you add this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

because this uses same templated interface for both proxy and skeleton, but the field should not have the same capabilities on both sides. so for this set needs to stay enabled on the skeleton side, while the proxy side should remain without set.

load("@score_baselibs//score/language/safecpp:toolchain_features.bzl", "COMPILER_WARNING_FEATURES")
load("//quality/unit_testing:unit_testing.bzl", "cc_unit_test")

cc_library(
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.

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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done. pushed these changes with separate commit.

@sahithi-nukala sahithi-nukala force-pushed the sah_add_integration_test_for_fields branch 6 times, most recently from 7bd4c90 to a4435a5 Compare May 27, 2026 11:52
@sahithi-nukala sahithi-nukala marked this pull request as ready for review May 27, 2026 12:18
@sahithi-nukala sahithi-nukala requested a review from bemerybmw May 27, 2026 12:18
Comment thread score/mw/com/test/field_initial_value/basic_acceptance_test/BUILD
@sahithi-nukala sahithi-nukala marked this pull request as draft May 28, 2026 05:04
@sahithi-nukala sahithi-nukala force-pushed the sah_add_integration_test_for_fields branch 8 times, most recently from 0e981e5 to 5496cf0 Compare May 29, 2026 09:42
@sahithi-nukala sahithi-nukala requested a review from bemerybmw May 29, 2026 10:17
@sahithi-nukala sahithi-nukala force-pushed the sah_add_integration_test_for_fields branch from 5496cf0 to 4039570 Compare May 29, 2026 10:17
@sahithi-nukala sahithi-nukala marked this pull request as ready for review May 29, 2026 11:06
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

test_suite(
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.

We decided not to use these component_test suites but we will instead run tests using wildcards e.g. bazel test //score/mw/com/test/.... So you can remove this.

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.

We usually consumer / provider instead of client / service. Could you please follow the same naming convention?

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.

Please use the tests in this pr as a guide for new integration tests: #485

using Parameters = score::mw::com::test::SctfTestRunner::RunParameters::Parameters;

const std::vector<Parameters> allowed_parameters{Parameters::CYCLE_TIME, Parameters::MODE};
score::mw::com::test::SctfTestRunner test_runner(argc, argv, allowed_parameters);
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.

SctfTestRunner is very old and we don't use it for new tests. Please look at how we do config parsing here: https://github.com/eclipse-score/communication/blob/brem_methods_sctfs/score/mw/com/test/methods/multiple_proxies/main_provider.cpp


const std::vector<Parameters> allowed_parameters{Parameters::CYCLE_TIME, Parameters::MODE};
score::mw::com::test::SctfTestRunner test_runner(argc, argv, allowed_parameters);
const auto& run_parameters = test_runner.GetRunParameters();
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.

return -17;
}

while (!stop_token.stop_requested())
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.

Use ProcessSynchronizer instead of a loop on the stop token like in

auto process_synchronizer_result = ProcessSynchronizer::Create(kInterprocessNotificationShmPath);

}
auto instance_specifier = std::move(instance_specifier_result).value();

auto service_result = SetEnabledSkeleton::Create(std::move(instance_specifier));
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.

Use SkeletonContainer instead of doing this yourself


while (!stop_token.stop_requested())
{
std::this_thread::sleep_for(cycle_time);
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.

We don't need cycle_time to be passed in from python, we only want to pass in params that need to be changed when calling the binary from python (e.g. mode). Anyway, this won't be needed when using ProcessSynchronizer.

if (!instance_specifier_result.has_value())
{
std::cerr << "Unable to create instance specifier, terminating\n";
return -3;
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.

Instead of returning error codes and propagating this up through all the layers, we should instead use FailTest to immediately fail the test e.g.

FailTest("Provider: Failed to register with_in_args_and_return handler");

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.

Same applies for the consumer

auto instance_specifier = std::move(instance_specifier_result).value();

std::promise<std::vector<InitialOnlyProxy::HandleType>> service_discovery_promise{};
auto service_discovery_future = service_discovery_promise.get_future();
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.

Use ProxyContainer

};

template <typename T>
class SetEnabledInterface : public T::Base
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.

We should have one class per file.

namespace score::mw::com::test
{

constexpr const char* const kInstanceSpecifierString = "test/fields/set_and_notifier";
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.

The shared constants should be in a different file, not with the interface classes.

return target.wrap_exec("bin/main_service", args, cwd="/opt/MainServiceApp", **kwargs)


def test_field_notifier_initial_value(target):
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.

We should have different python files per test configuration (e.g. https://github.com/eclipse-score/communication/tree/f6a14ef6f69482b404ec9392067fdd67c5126d51/score/mw/com/test/methods/mixed_criticality/integration_test). The configurations needed are mentioned in the ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants