-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Calculate PSA crypto test case dependencies automatically #4018
Comments
As part of this issue it would be great to also think about the maintenance of the WITHOUT_SYSTEMATIC_DEPENDENCIES and |
Arguably the logic for the systematic dependencies exceptions should be in We can live with this exception list for a while though. Adding a new identifier is rare, and if an identifier requires such an exception, we're likely to notice if the new test cases that are being added for this identifier aren't being run. |
Regarding annotations: I think we don't actually need a new annotation mechansm. The test code generator already parses the type of a test case argument. It currently accepts |
There is now a significant amount of Python code dedicated to deducing test case dependencies from test data. At the time of writing, it is used for automatically generated test cases ( At this point, the dependency calculation code needs a few inputs beyond the test data:
Some of these could be partially deduced from heuristics (e.g. assume that the bit-size is the argument called |
Currently, when you write a test case, you need to declare its dependencies, i.e. which compilation options are necessary for it to run and have the desired outcome. This is a tedious and error-prone process. Many test cases are copy-pasted variations, and it's easy to forget to update one dependency when changing the test case data. We often only find out we got it wrong through CI results, or sometimes through bug reports when a particular combination of compile-time options isn't tested on the CI.
It would be helpful if the test framework could determine test case dependencies automatically. This is not always possible, but #4012 shows that it's doable in practice for PSA cryptographic mechanisms.
#4012 was originally intended as a one-time conversion from classic dependencies to
PSA_WANT_
dependencies. But the same logic can be used to determine dependencies ingenerate_test_code.py
.Goals of this issue:
generate_test_code.py
determinePSA_WANT_
dependencies automatically for PSA cryptographic mechanisms.We aren't quite ready to do this yet. There are a few issues we may want to resolve first.
PSA_ERROR_NOT_SUPPORTED
, could either be testing what happens if A is not supported or if B is not supported)..data
or.function
file? How general would this annotation need to be?depends_on:
lines in.data
files and.function
files,@noauto
says to not have automatic depenencies at all.@ignore=3,4
says to ignore arguments 3 and 4.PSA_WANT_
dependencies are explicitly listed in the.data
file (and there's no explicit annotation that says to not have automatic dependencies at all), shouldgenerate_test_code.py
use them instead of the automatic ones? in addition to the automatic ones? ignore them? complain?MBEDTLS_USE_PSA_CRYPTO
.Out of scope:
The text was updated successfully, but these errors were encountered: