-
Notifications
You must be signed in to change notification settings - Fork 8.4k
twister: harness_config extended by test retries in testcase.yaml #81325
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: harness_config extended by test retries in testcase.yaml #81325
Conversation
4fdb20a to
0c25089
Compare
|
You need to add an example/test of this being used and document this new behaviour. |
0c25089 to
f5c311e
Compare
f5c311e to
7e0d0c6
Compare
|
still missing a test |
07ff041 to
928ae6a
Compare
please add a test into tests/ztest that uses those keywords and shows how repitition is achieved and handled, a twister unit test is not enough. |
ba245c4 to
9905e7d
Compare
tests/ztest/repeat/testcase.yaml
Outdated
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.
ztest_suite_repeat and ztest_test_repeat are configuration options of ztest harness, not console.
How is this going to work when used in other tests? does each ztest need to start parsing console and output?
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 used the console harness to verify that this change works as expected. I have added test for ztest harness where number of repetitions per suite or test are configured in prj.conf.
doc/develop/test/twister.rst
Outdated
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.
From TestInstance implementation change it appears to me that suite_repeat, test_repeat, and test_shuffle are generic parameters, and ztest is going to be just one of possible implementations, but later the ztest_* properties (with different names to what is in the doc) were introduced for Harness (for any harness, actually), and I'm confused.
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.
done
doc/develop/test/twister.rst
Outdated
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.
what about suite_shuffle ?
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.
done
38462e9 to
2649451
Compare
2649451 to
8cb5934
Compare
yperess
left a comment
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.
How is this different from adding this to the test yaml?
extra_configs:
- CONFIG_ZTEST_REPEAT=y
- CONFIG_ZTEST_REPEAT_COUNT=<NUMBER>
- CONFIG_ZTEST_SUITE_REPEAT_COUNT=<NUMBER>
|
@nashif Could you share your perspective? |
8cb5934 to
2138a50
Compare
Extend Twister to allow defining repeat counts for specific scenarios by harness_config. Signed-off-by: Mateusz Junkier <mateusz.junkier@intel.com>
2138a50 to
d1f3bd3
Compare
it does have the same outcome with the main difference of seperating how you are testing from what is being tested, i.e. the extra_configs are used to add new scenarios using different config options of the test subject, the ZTEST config options are not what is being tested, it is how we execute the test, so they should be part of the harness configuration. |
| @@ -0,0 +1,38 @@ | |||
| /* | |||
| * Copyright (c) 2024 Intel Corporation | |||
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.
| * Copyright (c) 2024 Intel Corporation | |
| * Copyright (c) 2025 Intel Corporation |
gbarkadiusz
left a comment
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.
LGTM
The ztest harness could be enhanced to support repeatability options, allowing users to specify these options directly within the harness configuration. By defining scenarios that include harness_config, we will unify the testing environment, making it easier to debug or keep same test scope.
Currently, Zephyr supports test repetition via command-line arguments:
However, this approach has the following drawbacks:
Lack of Standardization: Different users may specify different command-line options, leading to inconsistencies.
Manual Configuration Overhead: Users must remember and manually pass these options for every test execution.
Limited Automation Support: Running tests in CI/CD pipelines requires additional scripting to ensure consistent repetition settings.
By extending prj.conf, we allow users to define test repetition at the configuration level, ensuring that all builds include consistent test execution settings. This solution enables us to easily expand our testing scope, run stress tests, identify flaky tests, evaluate performance, and check for regressions.
Example of prj.conf :
Users can also define test repetition in testcase.yaml: