Skip to content

mw/com: Add methods integration tests#485

Draft
bemerybmw wants to merge 5 commits into
mainfrom
brem_methods_sctfs
Draft

mw/com: Add methods integration tests#485
bemerybmw wants to merge 5 commits into
mainfrom
brem_methods_sctfs

Conversation

@bemerybmw

Copy link
Copy Markdown
Contributor

Depends-on: #479

bemerybmw added 2 commits June 9, 2026 15:39
The signature_variations is the exact same as the mixed_criticality
tests, except the latter runs the test for all combinations of asil
levels of consumers and providers. Therefore, we remove
signature_variations.
@bemerybmw bemerybmw force-pushed the brem_methods_sctfs branch 2 times, most recently from 118eb76 to ff33ccc Compare June 9, 2026 15:04
@bemerybmw bemerybmw force-pushed the brem_methods_sctfs branch from ff33ccc to dd28657 Compare June 10, 2026 07:14
void check_result(std::future<score::Result<MethodReturnTypePtr<std::int32_t>>>&& result_future,
std::int32_t expected_value)
{
std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;

Comment on lines +76 to +79
if (!find_result.has_value() || find_result->size() != 1)
{
FailTest("FindService failed or returned wrong count. Error: ", find_result.error());
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

find_result.error() will not exist if find_result->size() != 1 is the failing condition.

@@ -0,0 +1,208 @@
/********************************************************************************

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This file is never built. could be a duplicate of stop_offer_during_call.cpp?

{
std::cout << "Could not create Instance specifier!.\n"
<< "Here is why: " << instance_specifier_result.error() << "\n\n"
<< std::flush;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

FailTest should be added here


auto async_result =
std::async(std::launch::async, [&proxy, test_input]() -> score::Result<MethodReturnTypePtr<std::int32_t>> {
while (true)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we should hardcode an upper limit of 1 Million iteration or sth. I know the test framework will interrupt long before that but this might get copy pasted to be executed in some other context

return target.wrap_exec("./bin/stop_offer_during_call",args,
cwd="/opt/StopOfferDuringCallApp/", wait_on_exit=True, **kwargs)

def test_multiple_proxies(target, **kwargs):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
def test_multiple_proxies(target, **kwargs):
def test_stop_offer_during_call(target, **kwargs):

Comment on lines +1 to +2
load("@score_baselibs//score/language/safecpp:toolchain_features.bzl", "COMPILER_WARNING_FEATURES")
load("//bazel/tools:json_schema_validator.bzl", "validate_json_schema_test")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this should be after the copyright?

Comment on lines +28 to +31
namespace
{
using namespace score::mw::com;
using namespace score::mw::com::test;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this could just be turned into
namespace score::mw::com::test {

skeleton.StopOfferService();
std::cout << "Step 4.4: StopOfferService was called while the method was still running\n" << std::flush;

++repetiction_count;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
++repetiction_count;
++repetition_count;

offer_service(skeleton);
}

if (repetiction_count == 0)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

maybe this should be successful_repetition_count?

}

template <typename ResultType>
void FailIfMethodCallDidNotFail(const std::string& method_name, const ResultType& call_result)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a nitpick, but the name has too much logic in it. Maybe name it sth without a negation, like FailOnUnexpectedSuccess?

if (was_successfully_offered)
{
FailTest("ERROR: OfferService succeeded when it should have failed!");
return;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
return;

std::cout << "\nConsumer: Step 10.1: Wait until proxy has reconnected to recreated skeleton" << std::endl;
// Since we have no way of being notified of the proxy being reconnected to the new skeleton, we keep calling a
// method in a loop until it succeeds. If it succeeded then it indicates that the proxy reconnected.
while (!consumer.GetProxy().without_args_or_return().has_value())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should we add an upper bound to this loop just to be safe?

int main(int argc, const char** argv)
{
score::mw::com::test::SetupAssertHandler();
score::mw::com::runtime::InitializeRuntime(argc, argv);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is the old runtime initializer, should we use the new one everywhere? Also in other tests...


std::cout << "\nConsumer: Step 11: Call the same method again" << std::endl;
consumer.CallMethodWithInArgsAndReturn(
kTestValueA, kTestValueB, AllSignaturesMethodConsumer::CopyMode::WITH_COPY, kFailureMessagePrefix);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We could make one of these zero copy?

# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
def test_edge_cases(target):
with target.wrap_exec("bin/incomplete_handlers_test", cwd="/opt/EdgeCasesTestApp", wait_on_exit=True) as process:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
with target.wrap_exec("bin/incomplete_handlers_test", cwd="/opt/EdgeCasesTestApp", wait_on_exit=True) as process:
with target.wrap_exec("bin/incomplete_handlers_test", cwd="/opt/EdgeCasesTestApp", wait_on_exit=True):

# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
def test_edge_cases(target):
with target.wrap_exec("bin/proxy_recreation_test", cwd="/opt/EdgeCasesTestApp", wait_on_exit=True) as process:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
with target.wrap_exec("bin/proxy_recreation_test", cwd="/opt/EdgeCasesTestApp", wait_on_exit=True) as process:
with target.wrap_exec("bin/proxy_recreation_test", cwd="/opt/EdgeCasesTestApp", wait_on_exit=True):

# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
def test_edge_cases(target):
with target.wrap_exec("bin/skeleton_recreation_test", cwd="/opt/EdgeCasesTestApp", wait_on_exit=True) as process:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
with target.wrap_exec("bin/skeleton_recreation_test", cwd="/opt/EdgeCasesTestApp", wait_on_exit=True) as process:
with target.wrap_exec("bin/skeleton_recreation_test", cwd="/opt/EdgeCasesTestApp", wait_on_exit=True):

if (call_result.has_value())
{
FailTest(kFailureMessagePrefix, " Consumer: ", method_name, " unexpectedly succeeded.");
return;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
return;

return;
}

std::cout << "Consumer: " << method_name << " failed as expected: " << call_result.error() << std::endl;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Technically we would need to disambiguate at call_result.error().
A method call could fail "propperly" with kBindingFailiure which is what we expect here. Or it could fail on this assertion, when we are trying to geth the queue_position.

@@ -0,0 +1,90 @@
{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is identical to consumer_asil_b_to_asil_b_mw_com_config.json

I think it is confusing to have towo identical configurations that are named differently. we could have oine that is called asil_b_to_asil_b_mw_com_config.json

@@ -0,0 +1,90 @@
{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same comment as with provider_asil_b...
this file is identical to consumer_qm_to_qm... and should be deleted.

Comment on lines +18 to +20
Verifies that method calls are sent from consumer to provider with the correct values.
Verifies that the provider executes the correct handler on the provided values.
Verifies that the consumer receives the correct return values.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Verifies that method calls are sent from consumer to provider with the correct values.
Verifies that the provider executes the correct handler on the provided values.
Verifies that the consumer receives the correct return values.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should probably not have this here. It is not clear from the test name that these particular behaviors are verified. So someone could easily change the test behavior without knowing that these comments need to be updated

Comment on lines +18 to +20
Verifies that method calls are sent from consumer to provider with the correct values.
Verifies that the provider executes the correct handler on the provided values.
Verifies that the consumer receives the correct return values.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Verifies that method calls are sent from consumer to provider with the correct values.
Verifies that the provider executes the correct handler on the provided values.
Verifies that the consumer receives the correct return values.

"""
def test_mixed_criticality_consumer_provider(target):
call_consumer_and_provider(
target, Criticality.QM, Criticality.QM, Criticality.QM)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
target, Criticality.QM, Criticality.QM, Criticality.QM)
target, consumer_criticality=Criticality.QM, consumer_expects_criticality=Criticality.QM, provider_criticality=Criticality.QM)

FailTest(
"Methods mixed_criticality provider failed: WaitForProxyTestToFinish was stopped by "
"stop_token instead of notification");
return;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
return;

Comment on lines +13 to +15

/// \brief ASIL-B provider main entry point for mixed criticality method tests.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
/// \brief ASIL-B provider main entry point for mixed criticality method tests.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this information is contained in the file name


int main(int argc, const char** argv)
{
auto service_instance_manifest_path = score::mw::com::test::ParseServiceInstanceManifest(argc, argv);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is never used

auto service_instance_manifest_path = score::mw::com::test::ParseServiceInstanceManifest(argc, argv);

score::mw::com::test::SetupAssertHandler();
score::mw::com::runtime::InitializeRuntime(argc, argv);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

instead of the legacy initializer we should use the new one which makes use of the service_instance_manifest_path

Comment on lines +45 to +46
provider_criticality: Criticality,
timeout_sec=60):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
provider_criticality: Criticality,
timeout_sec=60):
provider_criticality: Criticality):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is no longer necessary with the current test framework

@gdadunashvili gdadunashvili self-requested a review June 12, 2026 15:09
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