Skip to content

mw/com: Preparation for methods integration tests#478

Open
bemerybmw wants to merge 9 commits into
mainfrom
brem_methods_sctfs_preparation
Open

mw/com: Preparation for methods integration tests#478
bemerybmw wants to merge 9 commits into
mainfrom
brem_methods_sctfs_preparation

Conversation

@bemerybmw
Copy link
Copy Markdown
Contributor

No description provided.

bemerybmw added 2 commits May 27, 2026 18:14
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 bemerybmw force-pushed the brem_methods_sctfs_preparation branch from 47237f9 to 851849d Compare May 27, 2026 16:17
@bemerybmw bemerybmw changed the title Brem methods sctfs preparation mw/com: Preparation for methods integration tests May 28, 2026
@bemerybmw bemerybmw marked this pull request as ready for review May 28, 2026 07:58
# *******************************************************************************

test_suite(
name = "component_tests",
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.

do we tag integration tests?

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.

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.

namespace detail
{

static std::optional<std::function<void()>> g_fail_test_exit_function;
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.

this should be thread local.


using ExitFunction = std::function<void()>;

void SetFailTestExitFunction(ExitFunction exit_function);
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.

add docs

auto ProcessSynchronizer::CreateUniquePtr(const std::string& interprocess_notification_shm_path)
-> std::unique_ptr<ProcessSynchronizer>
{
auto interprocess_notification_result =
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.

fail test here and also in ProcessSynchronizer::Create(

bemerybmw added 5 commits May 28, 2026 13:10
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)
@bemerybmw bemerybmw force-pushed the brem_methods_sctfs_preparation branch 2 times, most recently from 1e6d415 to d010caa Compare May 28, 2026 12:32
bemerybmw added 2 commits May 29, 2026 08:55
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.
@bemerybmw bemerybmw force-pushed the brem_methods_sctfs_preparation branch from d010caa to 74c2a4b Compare May 29, 2026 06:58
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.

1 participant