mw/com: Update existing method integration tests#479
Draft
bemerybmw wants to merge 11 commits into
Draft
Conversation
We prefer to have copies of the configuration checked in for each test rather than using a tool to generate them. This makes it easier to validate that the configuration files are as expected, makes it easier for a user to use the config file as an example for how to create one themselves and also prevents the test being altered without realising if the generation tool is ever updated.
bemerybmw
commented
May 28, 2026
| if (!call_result.has_value()) | ||
| { | ||
| FailTest(failure_message_prefix, " Consumer: with_in_args_and_return call failed: ", call_result.error()); | ||
| return; |
bemerybmw
commented
May 28, 2026
| }; | ||
|
|
||
| bool CreateProxy(InstanceSpecifier instance_specifier); | ||
| void CreateProxy(InstanceSpecifier instance_specifier, const std::string& failure_message_prefix); |
Contributor
Author
There was a problem hiding this comment.
move to commit adding failtest to proxy / skeleton container
bemerybmw
commented
May 28, 2026
| std::cerr << "Consumer: Could not allocate method args: " << allocated_args_result.error() << std::endl; | ||
| FailTest( | ||
| failure_message_prefix, " Consumer: Could not allocate method args: ", allocated_args_result.error()); | ||
| return Unexpected(allocated_args_result.error()); |
bemerybmw
commented
May 28, 2026
|
|
||
| // Set an exit function to notify the provider in case of failure in calls to FailTest, so that it does not wait | ||
| // indefinitely for the consumer to finish. | ||
| ExitFunction process_synchronizer_guard{[&process_synchronizer_result]() { |
Contributor
Author
There was a problem hiding this comment.
auto process_synchronizer_guard{ExitFunctionGuard::Create(&process_synchronizer_result {
process_synchronizer_result->Notify();
})};
ClearTestExitFunction() should be private and only called by the guard on destruction.
Sometimes we want to perform some clean up before aborting via FailTest. Since destructors won't be called when calling std::_Exit, we allow registering a callable which will be called before exiting. This callable can be registered by creating an ExitFunctionGuard which will call the registered callable on destruction of the guard or when exiting via FailTest.
MakeError takes a string_view which was previously binding to a local string. When the error was logged, the string was already destroyed. We no longer pass a dynamic string to MakeError to avoid lifetime issues.
This function can be used if we need to store a ProcessSynchronizer in a data structure which requires it to be moveable (such as a std::vector)
This directory contains a datatype interface containing all 4 combinations of InArgs and Return values. It also provides helper classes which encapsulate some of the boilerplate code when using this datatype such as registering method handlers, calling methods etc.
Report failures using FailTest instead of propagating the errors up through function return types which makes signatures and calling more complex and can result in tests not failing when they should if the error code is not handled correctly by the parent layer.
- Don't use MethodConsumer. Since this is a basic test which we want to serve also as an example for users, we don't want to extract methods related functionality out of the class. Additionally, to simplify the code and to make it clearer when MethodConsumer can be used, it's no longer templated with the Proxy type so cannot be used with the type defined within this test. - Fail the test using FailTest instead of propagating the errors up through function return types which makes signatures and calling more complex and can result in tests not failing when they should if the error code is not handled correctly by the parent layer.
Fail the test using FailTest instead of propagating the errors up through function return types which makes signatures and calling more complex and can result in tests not failing when they should if the error code is not handled correctly by the parent layer.
fec6d40 to
4a1dc11
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends-on: #478