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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Twister: additional scripts #72808
base: main
Are you sure you want to change the base?
Twister: additional scripts #72808
Changes from all commits
c85207f
826aa69
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without duplication check, the resulting match result will be difficult to rely on a real-world config, especially with regular expressions on both
scenarios
andplatforms
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that this function allow duplicate entries all without
override
attribute, doesn't it ? so it is still a problem with duplicates and their precedence.Override
should help when (1) there are duplicate matches, and (2) there is only one withoverride
among them to choose it. All other situations for several matched_elements (several overrides, have no overrides) are conflicts and configuration error.Also, It is an overcomplication to have
override_script
for each of 3 scripts in an entry when duplicates are possible with (platform, scenario) key. Much easier and clear is to have theoverride
attribute for an element.Let's resolve this design problem first as the main reason for my -1 in this PR for quite a while.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the request to include the override_script parameter code was updated. Now, if override_script is not set to true, the script will not run. Additionally, if there are duplicates (e.g., two different scripts for the same board with override_script set to true), no script will be executed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To move forward I'd suggest: 1) don't use regexp matching at
_matches_element()
, 2) just fail on any duplicate found, so forget the idea ofoverride
attribute.It will simplify the proposed change significantly, whereas keep most of its functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this way it should allow only:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise when an element has e.g. just 'mec' in platforms it will match like
*mec*
, isn't it ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it can be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this check can be called only once, right ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was asked to enhance security to ensure that users are fully aware when using the --scripting-list parameter. To address this, I have introduced parameter
override_scripts
which manages the redeclaration of provided scripts. Your concerns about _matches_elemet function and duplicates, lets clear how its work based on examples :example_script.sh
is provided from command line via parameter-pre-script ./example_script.sh
or from map.file_matches_elemet
is not called, script executed :example_script.sh
example_script.sh
is provided from command line via parameter-pre-script ./example_script.sh
or from map.file other_script.sh is provided with --scripting-listthere will be no script executed for scenario " EXAMPLE_SCENARIO " on platform "EXAMPLE_PLATFORM", there will be log message
pre_script will not be overridden on EXAMPLE_PLATFORM
and none script will be executed, on other scenarios and boards-pre-script ./example_script.sh
will be executedexample_script.sh
is provided from command line via parameter-pre-script ./example_script.sh
or from map.fileother_script.sh is provided with --scripting-list
script
/example_script.sh
will be called only for scenario EXAMPLE_SCENARIO on platform EXAMPLE_PLATFORM, other configurations will be executed with-pre-script ./example_script.sh
there will be log message that none of this scripts will be executed
Execution will be stopped with log message
/example_script2.sh will be executed for scenario EXAMPLE_SCENARIO for platform
Handling duplicates works, i see that you aware about Input sources for scenarios and platforms could be not controlled cause of regexp, but data for
_matches_script
are loaded and validated form schemascripting_schema
using thescl.yaml_load_verify
function - this ensures that the input conforms to known structure,load_from_yaml()
function - watch for invalid regex pattern is encountered if yes, exception will be raised.