mw/com: Preparation for methods integration tests#478
Open
bemerybmw wants to merge 9 commits into
Open
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.
47237f9 to
851849d
Compare
bemerybmw
commented
May 28, 2026
| # ******************************************************************************* | ||
|
|
||
| test_suite( | ||
| name = "component_tests", |
Contributor
Author
There was a problem hiding this comment.
do we tag integration tests?
Contributor
Author
There was a problem hiding this comment.
After speaking with xavi, this isn't something we should start adding without first thinking about what testing levels we have e.g. unit tests, tests which use real system calls (e.g. in OSAL), SCTF etc.
bemerybmw
commented
May 28, 2026
| namespace detail | ||
| { | ||
|
|
||
| static std::optional<std::function<void()>> g_fail_test_exit_function; |
Contributor
Author
There was a problem hiding this comment.
this should be thread local.
bemerybmw
commented
May 28, 2026
|
|
||
| using ExitFunction = std::function<void()>; | ||
|
|
||
| void SetFailTestExitFunction(ExitFunction exit_function); |
bemerybmw
commented
May 28, 2026
| auto ProcessSynchronizer::CreateUniquePtr(const std::string& interprocess_notification_shm_path) | ||
| -> std::unique_ptr<ProcessSynchronizer> | ||
| { | ||
| auto interprocess_notification_result = |
Contributor
Author
There was a problem hiding this comment.
fail test here and also in ProcessSynchronizer::Create(
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)
1e6d415 to
d010caa
Compare
FailTestIf resulted in a runtime failure if calling it with a score::result::error when the condition is true since the result does not contain an error in that case but the function argument is still evaluated even though the condition is true. Passing an error is a common use case so we simply remove this and use FailTest with an if statement.
d010caa to
74c2a4b
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.
No description provided.