Skip to content

Changes related to service method integration tests#277

Open
gdadunashvili wants to merge 9 commits intoeclipse-score:mainfrom
gdadunashvili:dadu_bugfixes_from_sctfs
Open

Changes related to service method integration tests#277
gdadunashvili wants to merge 9 commits intoeclipse-score:mainfrom
gdadunashvili:dadu_bugfixes_from_sctfs

Conversation

@gdadunashvili
Copy link
Copy Markdown
Member

These are changes that are related to integration tests for methods.
Either bugfixes that were discovered through methods tests, or infrastructure code that will be used by integration tests

@gdadunashvili gdadunashvili added the test-qnx Enables the checks with QNX toolchains. Checks require committer approval to start execution. label Apr 9, 2026
@gdadunashvili gdadunashvili temporarily deployed to workflow-approval April 9, 2026 14:41 — with GitHub Actions Inactive
Copy link
Copy Markdown
Contributor

@bemerybmw bemerybmw left a comment

Choose a reason for hiding this comment

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

The final merge commit can be removed?

param_name.data(), po::value<std::string>(), ("specify " + std::string{param_doc}).data());
}

po::variables_map args;
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.

This should use the CommandLineArgsMapType alias.

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.

Still not done?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Now CommandLineArgsMapType is a std::unordered map and boost command line options does not escape the body of this function

using CommandLineArgsMapType = boost::program_options::variables_map;

template <typename ParsedType>
auto GetValueIfProvided(const boost::program_options::variables_map& args, const std::string& arg_string)
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 add docstrings to these functions and mention when they should be used.


namespace score::mw::com::test
{
auto ParseCommandLineArguments(int argc,
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.

This code is extracted from SctfTestRunner? IMO, SctfTestRunner should be updated to use this, otherwise we have two ways of parsing command line arguments. And if we then want to for example remove the boost dependency in the future, we only have that dependency in this target and so only have to refactor this code and not the SctfTestRunner.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I addressed this issue

std::string error_msg = "could not find the requested parameter: " + arg_string;
if constexpr (std::is_same_v<ParsedType, std::string>)
{
return (args.count(arg_string) > 0U) ? args[arg_string].as<std::string>()
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.

This check is duplicated in each if. Can't we just check if args.count(arg_string) == 0U once at the start?


using CommandLineArgsMapType = boost::program_options::variables_map;

template <typename ParsedType>
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 templating with ParsedType and then checking within the function that it's a string, int or float, why not template with:
enum class ParsedType
{
INVALID,
INT,
STRING,
FLOAT
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Doing this is not possible since the return type can not be deduced anymore. Also since I changed the implementation to from_chars there are not internal branches anymore

} // namespace detail

template <typename... Args>
void fail_test(Args&&... args)
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 add function docs


namespace detail
{
void fail_test_(std::stringstream&& strstr);
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 lowercase and trailing underscore? Why not FailTest or FailTestImpl or something like that?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

changed it


void fail_test_(std::stringstream&& strstr)
{
std::move(strstr) << "\033[0m \033[1m\033[41mTEST FAILED\033[0m\n";
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 are you moving here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I was mistaken


using CommandLineArgsMapType = std::unordered_map<std::string, std::string>;

/// \brief Get a value reperesednted as a string, from an arguments map and parse it into the appropriate type
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.

Suggested change
/// \brief Get a value reperesednted as a string, from an arguments map and parse it into the appropriate type
/// \brief Get a value represented as a string, from an arguments map and parse it into the appropriate type

param_name.data(), po::value<std::string>(), ("specify " + std::string{param_doc}).data());
}

po::variables_map args;
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.

Still not done?


/// \brief Get a value reperesednted as a string, from an arguments map and parse it into the appropriate type
///
/// \tparam ParsedType Target type of the parsed argument. Must be std::string, integral or floating point type.
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.

Suggested change
/// \tparam ParsedType Target type of the parsed argument. Must be std::string, integral or floating point type.
/// \tparam ReturnType Target type of the parsed argument. Must be std::string, integral or floating point type.

gdadunashvili and others added 9 commits April 15, 2026 15:28
This function can safely terminate a test and offers the ability to
consume variadic number of printable arguments to print them as an error
message
methods tests reuse the same configuration with slight variations, like
changing the applicationID or asil_level, but leavidng the rest
unchanged. This can lead to many duplicated json files which only
slightly differ and are hard to maintain.
This config_generator bazel rule together with the config_generator.py
and base_mw_com_config.json provides a way to generate config files
on the fly during the build step.
Handler scopes need to be reinitiated by PrepareOffer in case they were
expired by StopOffer before
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test-qnx Enables the checks with QNX toolchains. Checks require committer approval to start execution.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants