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

twister: Twister cannot properly handle runners errors (flashing) #32478

Closed
PerMac opened this issue Feb 19, 2021 · 3 comments · Fixed by #33214
Closed

twister: Twister cannot properly handle runners errors (flashing) #32478

PerMac opened this issue Feb 19, 2021 · 3 comments · Fixed by #33214
Assignees
Labels
area: Twister Twister bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@PerMac
Copy link
Member

PerMac commented Feb 19, 2021

Describe the bug
Errors occurring during flashing devices are not handled properly. There are several scenarios related to this issue.
I am able to reliably reproduce it on nrf5340 board, which raises errors during programming when app protected is not disabled, however, I see the same issues occasionally on other boards when an error occurs during programming.
Scenarios:
1.) configuration: when '--ninja' is used (both with and without --hardware-map): the test fails as soon as there is an error (which is good). However, the fail is reported as FAILED Cmake build failure (device) and treated as build error. Therefore, using --retry-failed does not retries such failures (which is bad).

  • expected behavior: Such fail is not treated as a build error and the failed test is retried when --retry-failed is used

2.) configuration: without --ninja and without --hardware-map: the test ends only after timeout, even though "make" reports earlier there was a fail (Makefile:748: recipe for target 'flash' failed). This adds ~60s of wasted time to the test suite which can stack to some meaningful time in big test suites. In this scenario, --retry-failed works as it should

  • expected behavior: test should be terminated as soon as there is an error in make for flash.

3.) configuration: without --ninja and with --hardware-map: Similar to 2.). This time, the output about make flash failing is not printed out. The rest is the same. Tests can be retried but are terminated only by timeouts.

  • expected behavior: test should be terminated as soon as there is an error in make for flash.

The fact that hardware-related errors are seen as build errors results in printing out/saving in the report a lot of useless information which hinders the real issues. In such a case the full build log is dumped, even though the building was fine.

Impact
Can significantly increase the execution time for big test suites. Failed tests might not get retried. Hinders real errors with full build logs.

Environment (please complete the following information):

  • OS Ubuntu: 18.04
  • Toolchain: Zephyr SDK
  • Commit SHA or Version used: zephyr-v2.5.0-276-g8e75fff5808f

Additional context
@nashif I also wonder if this could be the cause for "log mixing" problem #25719. I saw in my setups, that when flashing failed, the already programmed app can be executed giving not matching output.

@PerMac PerMac added bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug area: Twister Twister labels Feb 19, 2021
@nashif
Copy link
Member

nashif commented Feb 19, 2021

Those are multiple issues, it would be nicer to open 1 issue for each problem with more details.

@nashif
Copy link
Member

nashif commented Feb 21, 2021

configuration: when '--ninja' is used (both with and without --hardware-map): the test fails as soon as there is an error (which is good). However, the fail is reported as FAILED Cmake build failure (device) and treated as build error. Therefore, using --retry-failed does not retries such failures (which is bad).

We do not retry cmake/build failures and this is by design. Can you give more details about the failure? Why exactly does it fail?

@PerMac
Copy link
Member Author

PerMac commented Feb 22, 2021

@nashif I don't think splitting this issue would help, as all of the issues (most likely) have the same root cause, i.e. flashing a board being a part of the building stage.
There can be various reasons for failures during flashing, e.g some connection issues or, like in the case where I can have the error all the time, when the board is "protected" and needs "recovery" before being flashable (I guess this is specific to nrf5340 board).
I think that having flashing as a separate procedure (not part of the build stage) might solve these issues.
Anyway, I will try to debug the reported issues further and if I see that any of them can be solved on its own, I will descope it from here and create a separate bug report.

@PerMac PerMac self-assigned this Feb 24, 2021
@PerMac PerMac linked a pull request Mar 11, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Twister Twister bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants