Permit FVP tests to return a useful exit status. #576
Merged
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.
This allows picolibc tests to mark themselves as "skipped" by returning the special exit code 77. Previously that didn't work in an FVP test run, so those tests are marked as failed rather than skipped.
In particular, test-sprintf-percent-n was affected, because we build picolibc in a mode that doesn't support printf("%n"), and that test knew it and was trying to return "skipped".
Background: Fast Models does support the SYS_EXIT_EXTENDED semihosting request, which allows specifying an exit status. But it doesn't support the ":semihosting-features" pseudo-file that advertises support for non-default semihosting features including that one. So picolibc wrongly believes that SYS_EXIT_EXTENDED doesn't work, and doesn't try it.
This commit works around that lack of support by simply creating a real file called ":semihosting-features" in the directory where the model will run. Then picolibc does find it, and learns from it that it's allowed to SYS_EXIT_EXTENDED.
This makes test-sprintf-percent-n stop failing. It also means we can remove the semihost-exit-extended test from the list of tests specially disabled on FVP runs, because now it works.