Commit Graph

32091 Commits

Author SHA1 Message Date
Gilles Peskine cb27d4f7a2 Use standard code instead of the homemade FileWrapper
We had a home-made FileWrapper class, written in the days of Python 2,
whose main purpose was to add line numbers. Use the standard class fileinput
instead.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-11-05 18:00:43 +01:00
Gilles Peskine 612ccb7217 Use utf-8 when opening text files
All of our source files are encoded in UTF-8. We have other scripts that
make this assumption. We don't want to depend on the platform encoding.

This fixes a bug whereby non-ASCII characters in .function files led to an
error when writing the generated C file. Fix Mbed-TLS/mbedtls-framework#64.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-11-05 17:58:10 +01:00
Ronald Cron d68446c9da Merge pull request #47 from gabor-mezei-arm/9140_stderr_for_c_build
Validated by #9292 (dev) and #9709 (3.6) CI.
2024-10-21 14:15:33 +02:00
Gabor Mezei d1d2e3c061 fix typo
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-10-17 14:29:18 +02:00
Gilles Peskine 3eafac12ae Merge pull request #58 from Mbed-TLS/dev/gilles-peskine-arm/generate_config_tests-require_psa
PSA_WANT_xxx is only meaningful when PSA crypto is enabled
2024-10-16 19:31:07 +02:00
David Horstmann 311d8acd1c Merge pull request #56 from eleuzi01/issue-54
Move TLS auxiliary test scripts to the framework
2024-10-16 14:47:38 +01:00
Bence Szépkúti 77a3edb7a6 Merge pull request #33 from bensze01/main
Add Jenkinsfile
2024-10-16 08:08:19 +02:00
Bence Szépkúti 51950e72b9 Add Jenkinsfile
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2024-10-16 08:02:15 +02:00
Elena Uziunaite 53a0461c4d Remove unused import
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-15 12:28:59 +01:00
Elena Uziunaite e966d35352 Merge branch 'tmp-branch-move-files-to-framework' into issue-54 2024-10-15 12:28:34 +01:00
Elena Uziunaite 1bce0cbfff Move some files to framework repository
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-15 12:28:33 +01:00
Ronald Cron cb81d8086f Merge pull request #9671 from Harry-Ramsey/duplicate-common-header-file-development
Refactor duplicate common header file
2024-10-15 06:05:07 +00:00
Harry Ramsey fb6cea508f Remove duplicate mbedtls/build_info.h include
This commit removes duplicate includes for mbedtls/build_info.h where
the file already includes common.h.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-14 08:41:31 +01:00
Harry Ramsey b81cd1af64 Update includes for generated files
This commit replaces the include of "common.h" with "ssl_misc.h" for
generated files.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-14 08:41:23 +01:00
Bence Szépkúti d9a70c758a Merge pull request #48 from valeriosetti/enhance-config-py
enhance common_config.py and generate_test_code.py
2024-10-11 15:46:17 +02:00
Valerio Setti c9d6bf4534 generate_test_code.py: simplify regex expression
"\w" already matches "[a-zA-Z0-9_]" so CONDITION_VALUE_REGEX
can be simplified as proposed in this commit.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-10-11 15:12:02 +02:00
Harry Ramsey e8e23fb519 Include ssl_misc.h for additional SSL helper files
This commit replaces #include "common.h" in favour of #include
"ssl_misc.h".

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-11 12:21:30 +01:00
Harry Ramsey 4d432d6ea5 Remove mbedtls/build_info from pkcs7.c
This commit removes #include "mbedtls/buildinfo.h" from pkcs7.c as it is
not needed unlike other C modules.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-11 12:20:13 +01:00
Gilles Peskine 239c0d8d17 PSA_WANT_xxx is only meaningful when PSA crypto is enabled
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-10 21:38:26 +02:00
Tom Cosgrove 0b4ccdd7c9 Merge pull request #9674 from gergelykarm/development
Fix driver schema json default type requirements
2024-10-10 13:53:14 +00:00
Gilles Peskine 80352ac58c Merge pull request #9668 from gilles-peskine-arm/analyze_outcome-split-dev
Split check_test_cases.py and outcome_analysis.py
2024-10-10 13:45:49 +00:00
Gergely Korcsák a3c2a8f2a2 Fix driver schema json default type requirements
Signed-off-by: Gergely Korcsák <gergely.korcsak@arm.com>
2024-10-10 13:16:32 +02:00
Gilles Peskine 8fa4964830 Update framework to the branch with collect_test_cases.py and outcome_analysis.py
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-10 10:01:17 +02:00
Gilles Peskine 1de0641e78 Merge pull request #55 from Mbed-TLS/dev/gilles-peskine-arm/analyze_outcome-split-framework
Framework: Split check_test_cases.py and outcome_analysis.py
2024-10-10 09:59:52 +02:00
Gilles Peskine 96db2ccedd Default to allowing partial test coverage
Currently, many test cases are not executed. A follow-up pull request will
take care of that. In the meantime, continue allowing partial test coverage.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-09 14:12:59 +02:00
Gilles Peskine 041a84d1dc Downgrade mypy to a version that works with our code base
mypy >=0.960 rejects macro_collector.py.
https://github.com/Mbed-TLS/mbedtls-framework/issues/50

We currently need mypy >=0.940, <0.960. Pick 0.942, which works, and is the
system version on Ubuntu 22.04.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-09 14:12:59 +02:00
Gilles Peskine 1c5a252729 Upgrade mypy to the last version supporting Python 3.6
Upgrade mypy to 0.971, which is the last version that supports Python 3.6
(the oldest Python version that we currently run on the CI).

This fixes the error
```
framework/scripts/mbedtls_framework/outcome_analysis.py:119: error: Incompatible return value type (got "IO[Any]", expected "TextIO")
framework/scripts/mbedtls_framework/outcome_analysis.py:121: error: Incompatible return value type (got "IO[Any]", expected "TextIO")
```
As far as I can tell the fix is https://github.com/python/mypy/pull/9275
which was released in mypy 0.940.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-09 14:12:59 +02:00
Gilles Peskine 9f85399e7b Move test case analysis modules to framework repository
Move `collect_test_cases.py` (split from `check_test_cases.py`),
`check_test_cases.py`, and `outcome_analysis.py` (split from
`analyze_outcomes.py`) to the framework repository.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-09 14:12:05 +02:00
Gilles Peskine 6759e8012d Make open calls more uniform
Text mode ('t') is the default for the open builtin, but not for gzip.open
and its imitators. Always specify it explicitly to avoid making maintiners
wonder if there's an intended difference in behavior.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-09 13:53:57 +02:00
Gilles Peskine d63709d3db collect_test_cases.py is now a separate module
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-09 13:53:57 +02:00
Gilles Peskine 9c9d9fa5b0 Default to requiring full test coverage
Command-line options allow choosing whether a never-executed test results in
a warning or an error. Also, a consuming script can make the default
permissive by setting FULL_COVERAGE_BY_DEFAULT to False.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-09 13:53:57 +02:00
Gilles Peskine b111d9fe54 Support compressed outcome files transparently
Transparently read outcome files compressed with xz (which we currently use
on the CI) or with gzip.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-09 13:53:57 +02:00
Gilles Peskine 67e415fc6a Also write to a log file by default
Write the log of outcome analysis to a log file by default. This is a cheap
way of getting the outcome analysis log in an easy-to-access form on the CI:
with our current CI scripts, they are now automatically available as an
artifact called `analyze_outcomes.log`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-09 13:53:57 +02:00
Gilles Peskine 48c005f569 Adjust import path after script moves
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-09 13:53:57 +02:00
Gilles Peskine 4103f92134 Merge branch 'tmp-branch-move-files-to-framework' into move-files-into-framework 2024-10-09 13:49:41 +02:00
Gilles Peskine ce00cfe798 Move some files to framework repository
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-09 13:49:38 +02:00
Harry Ramsey 0f6bc41a22 Update includes for each library file
Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-09 11:18:50 +01:00
Harry Ramsey 91c6d4f819 Add include for common.h
Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-09 11:18:50 +01:00
Harry Ramsey 84f868ec53 Move library/common.h to tf-psa-crypto/core directory
This commit moves common.h from library to tf-psa-crypto/core.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-09 11:18:50 +01:00
Harry Ramsey f8983dc321 Remove common.h from tf-psa-crypto/core
This commit removes common.h from tf-psa-crypto/core directory.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-09 11:18:50 +01:00
Valerio Setti bf87497fdc generate_test_code.py: improve detection of ambiguous numerical values
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-10-09 10:21:10 +02:00
Valerio Setti f8025e4362 generate_test_code.py: allow bitwise operators in depends_on expressions
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-10-09 10:21:10 +02:00
Valerio Setti a6e9c083a1 generate_test_code.py: add check for numerical format
Do not allow values starting with a 0 because they can be either
accidentally octal or accidentally decimal. Hex values are not
affected by this change.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-10-09 10:21:10 +02:00
Valerio Setti b6dc14c3c8 generate_test_code: ease checks on the test data depends_on
In case of depends_on elements that include a conditional check
on some symbol's value, we allow the comparison element to
be anything and not just a fixed value as it was before.
This allows for more complex depends_on conditions where
build symbols and macros are used on both sides of the comparison.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-10-09 10:21:10 +02:00
Valerio Setti 6b04996bda config_common.py: remove unnecessary if statements
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-10-09 10:21:10 +02:00
Valerio Setti 40a28bd2af config_common.py: make get_matching() a generator
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-10-09 10:21:10 +02:00
Valerio Setti 9b987bd204 config.py: add get-all and get-all-enabled commands
Both commands use regex expressions to get a list of symbols.
The difference between the 2 is that:

- get-all returns both enabled and commented out symbols while
- get-all-enabled returns only enabled ones.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-10-09 10:21:10 +02:00
Ronald Cron e21e9c33c5 Merge pull request #9653 from Harry-Ramsey/revert-version-features-development
Revert move of version.h to tf-psa-crypto library
2024-10-09 08:05:38 +00:00
Gilles Peskine 2c17ec74be Default to allowing partial test coverage
Currently, many test cases are not executed. A follow-up pull request will
take care of that. In the meantime, continue allowing partial test coverage.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-08 19:54:43 +02:00
Gilles Peskine fecb9b916d Downgrade mypy to a version that works with our code base
mypy >=0.960 rejects macro_collector.py.
https://github.com/Mbed-TLS/mbedtls-framework/issues/50

We currently need mypy >=0.940, <0.960. Pick 0.942, which works, and is the
system version on Ubuntu 22.04.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-08 19:54:43 +02:00