Skip to content
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

sanitycheck: add option to allow re-running single tests multiple times #22147

Closed
wants to merge 1 commit into from

Conversation

nashif
Copy link
Member

@nashif nashif commented Jan 23, 2020

Using --number-of-runs we now can run a single test multiple times
to test for reproducibility and to catch sporadic failures.

The output looks like this:

i9:zephyr(rerun_sc): sanitycheck -p mps2_an385 -T tests/kernel/tickless/tickless_concept/ --number-of-runs 10
Renaming output directory to /home/nashif/Work/zephyrproject/zephyr/sanity-out.17
INFO    - JOBS: 20
INFO    - Building initial testcase list...
INFO    - 1 test configurations selected, 0 configurations discarded due to filters.
INFO    - Adding tasks to the queue...
INFO    - Ran mps2_an385/tests/kernel/tickless/tickless_concept/kernel.tickless.concept (1/10 100.00% passrate): passed
INFO    - Ran mps2_an385/tests/kernel/tickless/tickless_concept/kernel.tickless.concept (2/10 100.00% passrate): passed
INFO    - Ran mps2_an385/tests/kernel/tickless/tickless_concept/kernel.tickless.concept (3/10 100.00% passrate): passed
INFO    - Ran mps2_an385/tests/kernel/tickless/tickless_concept/kernel.tickless.concept (4/10 100.00% passrate): passed
INFO    - Ran mps2_an385/tests/kernel/tickless/tickless_concept/kernel.tickless.concept (5/10 100.00% passrate): passed
INFO    - Ran mps2_an385/tests/kernel/tickless/tickless_concept/kernel.tickless.concept (6/10 100.00% passrate): passed
INFO    - Ran mps2_an385/tests/kernel/tickless/tickless_concept/kernel.tickless.concept (7/10 100.00% passrate): passed
INFO    - Ran mps2_an385/tests/kernel/tickless/tickless_concept/kernel.tickless.concept (8/10 100.00% passrate): passed
INFO    - Ran mps2_an385/tests/kernel/tickless/tickless_concept/kernel.tickless.concept (9/10 100.00% passrate): passed
INFO    - Ran mps2_an385/tests/kernel/tickless/tickless_concept/kernel.tickless.concept (10/10 100.00% passrate): passed
INFO    - Total complete:    1/   1  100%  skipped:    0, failed:    0
INFO    - 1 of 1 tests passed (100.00%), 0 failed, 0 skipped with 0 warnings in 54.65 seconds
INFO    - In total 1 test cases were executed on 1 out of total 219 platforms (0.46%)

@zephyrbot zephyrbot added the area: Sanitycheck Sanitycheck has been renamed to Twister label Jan 23, 2020
@nashif nashif added the DNM This PR should not be merged (Do Not Merge) label Jan 23, 2020
count = 0
passed = 0
failed = 0
while count < self.rerun:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could simplify to

for count in range(self.rerun):
    ...

Copy link
Collaborator

Choose a reason for hiding this comment

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

run_i and self.n_reruns or the like might be clearer naming.

self.run()
self.instance.status, _ = self.instance.handler.get_state()
if self.instance.status in ['failed', 'timeout']:
failed = failed + 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could do failed += 1. Python has +=.

if self.instance.status in ['failed', 'timeout']:
failed = failed + 1
else:
passed = passed + 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could do passed += 1.

Using --number-of-runs <int> we now can run a single test multiple times
to test for reproducibility and to catch sporadic failures.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
@github-actions github-actions bot added has-conflicts Issue/PR has conflicts with another issue/PR and removed has-conflicts Issue/PR has conflicts with another issue/PR labels Jun 30, 2020
@nashif nashif self-assigned this Jul 29, 2020
@nashif nashif closed this Sep 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Sanitycheck Sanitycheck has been renamed to Twister DNM This PR should not be merged (Do Not Merge) has-conflicts Issue/PR has conflicts with another issue/PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants