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

Test cases not executed: switch to enforcement mode #9593

Conversation

gilles-peskine-arm
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm commented Sep 17, 2024

Switch the test coverage analysis in analyze_outcomes.py to enforcement mode. In other words, the CI will now complain if there is a test case that is not executed in any configuration. Legitimate exceptions can be recorded in the script.

The goal of this pull request is only to switch to enforcement mode, so that if we stop running a test case in the future, the CI will fail. Resolving the test cases that are already reported as not executed is out of scope here. Therefore this pull requests creates an ignore list that currently catches 9953 test cases (a vast majority from test cases systematically generated by generate_psa_tests.py). Apart from a very small number of legitimate never-executed test cases which I document as such, I have filed issues to resolve the existing problems, linked from comments in the ignore list.

Resolves #5390 (everything is analyzed or at least sorted into issues for further analysis), #2691 (finally!), #3417 (resolved by test_suite_config plus enforcement plus issues filed for the reported missing coverage).

See an example of a failed run with an earlier version of this PR in #9610, specifically https://mbedtls.trustedfirmware.org/job/mbed-tls-pr-head/job/PR-9610-head/3/display/redirect . An example with a spurious coverage exemption: https://mbedtls.trustedfirmware.org/job/mbed-tls-pr-head/job/PR-9614-head/3/ .

Content:

  • Fill the ignore list for test coverage.
  • Fix a very very small number of obvious test cases.
  • Switch to enforcement mode.

PR checklist

@gilles-peskine-arm gilles-peskine-arm added needs-ci Needs to pass CI tests size-s Estimated task size: small (~2d) component-test Test framework and CI scripts priority-high High priority - will be reviewed soon labels Sep 17, 2024
@gilles-peskine-arm gilles-peskine-arm changed the title Test cases not executed enforce development Test cases not executed: switch to enforcement mode Sep 17, 2024
@gilles-peskine-arm gilles-peskine-arm force-pushed the test-cases-not-executed-enforce-development branch from aeecc77 to 7238e19 Compare September 17, 2024 21:34
@gilles-peskine-arm gilles-peskine-arm added needs-preceding-pr Requires another PR to be merged first and removed needs-ci Needs to pass CI tests labels Sep 17, 2024
@paul-elliott-arm paul-elliott-arm self-requested a review September 19, 2024 15:00
@gilles-peskine-arm
Copy link
Contributor Author

This PR will make 3.6 and development diverge because they'll have slightly different ignore lists for coverage. With the repo split, we'll want to have the common code in the framework, and the data (list of driver components, ignore lists) in each consuming branch. Having discussed with Manuel who's handling the repo split side of things (private link), we're going to join efforts: I'll rework this PR to first move the common code into the framework repository. It's easier overall to schedule things this way.

This clears more than half of the test cases that are not executed.
This also captures a few negative test cases that are executed.
Subsequent commits will refine the filtering.

Signed-off-by: Gilles Peskine <[email protected]>
… tests

Some negative tests involving unsupported mechanisms are executed, because
they're testing what happens if the mechanism is unsupported. Refine the
ignore list for `test_suite_psa_crypto_generate_key.generated` and
`test_suite_psa_crypto_op_fail.generated` accordingly.

Signed-off-by: Gilles Peskine <[email protected]>
…aised

Ignore certain test cases which either should not be generated or should be
executed. For each ignore list entry, link to a GitHub issue whose
definition of done includes removing the entry.

Signed-off-by: Gilles Peskine <[email protected]>
Signed-off-by: Gilles Peskine <[email protected]>
Our PSA crypto implementation does not and will not support SECP224K1.

Signed-off-by: Gilles Peskine <[email protected]>
For each ignore list entry, link to a GitHub issue for its resolution,
except for ssl-opt Valgrind tests which we never intend to run on the CI.

Signed-off-by: Gilles Peskine <[email protected]>
For each ignore list entry, link to a GitHub issue for its resolution.

Signed-off-by: Gilles Peskine <[email protected]>
Copy link
Member

@paul-elliott-arm paul-elliott-arm left a comment

Choose a reason for hiding this comment

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

LGTM

@gilles-peskine-arm gilles-peskine-arm added approved Design and code approved - may be waiting for CI or backports needs-preceding-pr Requires another PR to be merged first and removed needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review labels Oct 16, 2024
Signed-off-by: Gilles Peskine <[email protected]>
@gilles-peskine-arm gilles-peskine-arm added needs-review Every commit must be reviewed by at least two team members, and removed approved Design and code approved - may be waiting for CI or backports labels Oct 16, 2024
@gilles-peskine-arm gilles-peskine-arm removed the needs-preceding-pr Requires another PR to be merged first label Oct 16, 2024
yanesca
yanesca previously approved these changes Oct 17, 2024
Copy link
Contributor

@yanesca yanesca left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@paul-elliott-arm paul-elliott-arm left a comment

Choose a reason for hiding this comment

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

LGTM

(The check_python_files failure obviously wasn't introduced here, but I presume was expected elsewhere?)

@gilles-peskine-arm
Copy link
Contributor Author

The failure of check-python-files is due to having already merged Mbed-TLS/mbedtls-framework#56 but not yet its consumers #9673 and #9675. Once the consumers are merged, I'll need to rebase/merge here and amend the framework-changing commit, so that the framework moves forward.

…ed-enforce-development

Conflicts:
* framework: update to the head of 'main'.
@gilles-peskine-arm
Copy link
Contributor Author

There was another framework update happening concurrently, which caused a CI failure when this PR had an updated framework without a necessary change in the consuming branch. I've pushed a merge commit where the one conflict is in the framework, resolved by taking the head of the main branch which has all the desired framework updates. I did the same thing in the 3.6 backport.

Copy link
Contributor

@yanesca yanesca left a comment

Choose a reason for hiding this comment

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

I did the merge locally and arrived at the same result. (For some reason it merged without a conflict for me.)

Copy link
Member

@paul-elliott-arm paul-elliott-arm left a comment

Choose a reason for hiding this comment

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

LGTM

@paul-elliott-arm paul-elliott-arm added approved Design and code approved - may be waiting for CI or backports and removed needs-review Every commit must be reviewed by at least two team members, labels Oct 18, 2024
@gilles-peskine-arm gilles-peskine-arm added this pull request to the merge queue Oct 18, 2024
Merged via the queue into Mbed-TLS:development with commit 6707584 Oct 18, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Design and code approved - may be waiting for CI or backports component-test Test framework and CI scripts priority-high High priority - will be reviewed soon size-s Estimated task size: small (~2d)
Projects
Development

Successfully merging this pull request may close these issues.

Fully analyze test cases that are not executed
3 participants