2993 Commits

Author SHA1 Message Date
Gilles Peskine
1fac371ebe In PSA generated tests, ignore patterns for which an issue has been raised
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 <Gilles.Peskine@arm.com>
2024-10-10 17:58:26 +02:00
Gilles Peskine
72396da267 In PSA generated tests, don't ignore not-implemented in some negative 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 <Gilles.Peskine@arm.com>
2024-10-10 17:58:21 +02:00
Gilles Peskine
d8da2fcc7a In PSA generated tests, ignore mechanisms that are not implemented
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 <Gilles.Peskine@arm.com>
2024-10-10 17:58:16 +02:00
Gilles Peskine
1171697235
Merge pull request #9669 from gilles-peskine-arm/analyze_outcome-split-3.6
Backport 3.6: Split check_test_cases.py and outcome_analysis.py
2024-10-10 12:23:50 +00:00
Gilles Peskine
5d633ff745 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:19:31 +02:00
Gilles Peskine
8981203aaa 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:19:31 +02:00
Gilles Peskine
738a597953 Adjust paths for impending moves to the framework
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-09 14:19:31 +02:00
Manuel Pégourié-Gonnard
8536c3c792
Merge pull request #9161 from mpg/doc-guards
[3.6 only] Document transitional feature macros / guards
2024-10-09 10:30:50 +00:00
Gilles Peskine
45a32b1549 Separate code and data of outcome analysis
Place the code of outcome analysis (auxiliary functions, tasks, command line
entry point) into a separate module, which will be moved to the
version-independent framework repository so that it can be shared between
maintained branches. Keep the branch-specific list of driver components and
ignore lists in the per-repository script.

We keep the executable script at `tests/scripts/analyze_outcomes.py`. It's
simpler that way, because that path is hard-coded in CI scripts.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:13:18 +02:00
Gilles Peskine
39f5d796ae Pass KNOWN_TASKS as an argument to main
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:13:18 +02:00
Gilles Peskine
4d557d8b76 Typecheck main
Always have tasks_list be a list, not potentially some fancier iterable.

Bypass mypy's somewhat legitimate complaint about REFERENCE and DRIVER in
task_class: they could potentially be instance attributes, but we rely on
them being class attributes. Python does normally guarantee their existence
as class attributes (unless a derived class explicitly deletes them), but
they could be overridden by an instance attribute; that's just something
we don't do, so the class attribute's value is legitimate. We can't
expect mypy to know that, so work around its complaint.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:13:18 +02:00
Gilles Peskine
c2df8d4e9b Don't reuse a variable name inside a function
Use different names for task name, a task class and a task instance. The
interpreter doesn't care, but it's less confusing for both humans and type
checkers.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:13:18 +02:00
Gilles Peskine
40a98a4b64 Missing NotImplementedError in abstract method
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:13:18 +02:00
Gilles Peskine
38de3e5de1 Remove sample ignore list elements for coverage
The ignore list for coverage only has two test cases out of ~10000 that are
currently reported as not executed. This is a drop in the sea and not
useful. Remove them so that the class can be used generically. A follow-up
will construct a comprehensive ignore list.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:13:18 +02:00
Gilles Peskine
efe084b2ee Create a module to split branch-independent code out of analyze_outcomes.py
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:13:18 +02:00
Gilles Peskine
eba00974d6 Split test case collection from checks
Move the test case collection code out of check_test_cases.py and into its
own module. This allows outcome analysis to depend only on the new module
and not on check_test_cases.py.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:13:18 +02:00
Gilles Peskine
31e31523ad Create a module to split test case collection from checks
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:13:18 +02:00
Gilles Peskine
13985566e7 check_test_cases.py: make 3.6 identical with development
To prepare for the move of check_test_cases.py to the version-independent
framework repository, make the file in mbedtls-3.6 identical to the file
in development.

In development, check_test_cases.py now looks for tests under tf-psa-crypto.
This is useless but harmless in mbedtls-3.6.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:11:27 +02:00
Gilles Peskine
e9603cb00f Don't use the "allow list" terminology any longer
What was formerly called an allow list is now an ignore table.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
7960b7661a Switch coverage analysis to IGNORE_TESTS for its allowlist
No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
5ef96c6809 Simplify sub-test-suite handling in is_test_case_ignored
No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
9b7cdd91dc Move test case ignore list to the master Task class
No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
0a7d96d266 Remove now-useless level of method call indirection
No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
95b2b0c160 Move analysis functions into their respective classes
No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
0e5e57b34c Remove dead code that was handling stringly typed data
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
92cc8dba27 Replace stringly typed data by class: driver vs reference (data)
Work on the stringly typed KNOWN_TASKS by classes for each category
of tasks, with a structure that matches the behavior.

This commit migrates the data for driver-vs-reference analysis and gets rid
of the transitional code that was using the old form of the data.

No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
17e071b0ab Replace stringly typed data by class: driver vs reference (code)
Work on the stringly typed KNOWN_TASKS by classes for each category
of tasks, with a structure that matches the behavior.

This commit migrates the code for driver-vs-reference analysis. To
facilitate review, this commit preserves the layout of the data that
parametrizes each task. The next commit will migrate the data.

No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
0316f1006c Replace stringly typed data by class: coverage
Work on replacing the stringly typed KNOWN_TASKS by classes for each category
of tasks, with a structure that matches the behavior.

This commit migrates test coverage analysis.

No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
00ed057738 Replace stringly typed data by class: prepare
Start replacing the stringly typed KNOWN_TASKS by classes for each category
of tasks, with a structure that matches the behavior.

This commit introduces some transition code.

No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
02f0f9f1ff Merge remote-tracking branch 'mbedtls-3.6' into tls13-middlebox-compat-disabled-3.6 2024-09-25 09:52:14 +02:00
Gilles Peskine
f0d2eb5828
Merge pull request #9603 from gilles-peskine-arm/test-ref-configs-go-away-3.6
Backport 3.6: Switch from test-ref-configs.pl to separate components
2024-09-24 13:00:54 +00:00
Ronald Cron
cbacb065f3
Merge pull request #9511 from gabor-mezei-arm/9325_bp36_move_config.py_to_framework
[Backport 3.6] Move `config.py` functionalities to the framework
2024-09-20 16:07:47 +00:00
Gilles Peskine
2cdcec942c Remove obsolete requirement for GnuTLS %DISABLE_TLS13_COMPAT_MODE
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-20 07:44:36 +02:00
Gilles Peskine
4daaafebe0 Fix sensitivity of tls13-compat.sh to the exact generation method
Fix `tls13-compat.sh` changing based on exactly how
`generate_tls13_compat_tests.py` was run (e.g. from which directory). This
made `check-generated-files.sh` behave differently from `make`. The script
has no official variations of the content of its output file, so we don't
need to record the full command line.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-20 07:44:36 +02:00
Gilles Peskine
0e9ba089b9 Automatically generate tests/opt-testcases/tls13-compat.sh
`tests/opt-testcases/tls13-compat.sh` is supposed to be automatically
generated by `tests/scripts/generate_tls13_compat_tests.py`. So far, the
output has been updated by running the script manually and committing the
output. Switch to using our framework for generated files.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-20 07:44:36 +02:00
Gilles Peskine
dfede5a5b4 generate_tls13_compat_tests: change default mode to all
With no options, update the output file (former behavior with -a).
Pass -1 to generate a single test case.

Also have the intended output file location as the default.

This way, you can just run the script after updating it, without having to
know the details of the directory structure.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-20 07:44:36 +02:00
Gilles Peskine
0fadf43410 Remove obsolete requirements on middlebox compatibility mode: generated
MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE is no longer required, except in test
cases that are specifically about it. This commit removes the requirement in
tls13-compat.sh (which does not have test cases that actually depend on the
feature).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-20 07:44:36 +02:00
Gilles Peskine
fde24b85ae Remove test-ref-configs.pl, which no longer does anything
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-19 18:57:18 +02:00
Gilles Peskine
ced0edc43e Move config-tfm.h testing to separate all.sh component
Rename the existing component_test_tfm_config which tests a modified version
of config-tfm.h for the sake of driver-vs-reference comparison.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-19 18:57:11 +02:00
Gilles Peskine
dbd0f424b0 Move config-symmetric-only.h testing to separate all.sh components
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-19 18:57:03 +02:00
Gilles Peskine
e62925f1e6 Move config-thread.h testing to separate all.sh components
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-19 18:56:01 +02:00
Gilles Peskine
e9cd6a7011 Move config-suite-b.h testing to separate all.sh components
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-19 18:55:53 +02:00
Gilles Peskine
9929237537 Move config-ccm-psk-dtls1_2.h testing to separate all.sh components
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-19 18:55:49 +02:00
Gilles Peskine
f3d5019191 Move config-ccm-psk-tls1_2.h testing to separate all.sh components
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-19 18:55:44 +02:00
Gilles Peskine
4d347aa433 Move config-no-entropy.h testing to separate all.sh component
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-19 18:55:08 +02:00
Gabor Mezei
6f90e79ae5
Update old class names
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:51:59 +02:00
Elena Uziunaite
fbab4f88dc Add missing ALG_SHA_1
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-09-16 12:34:11 +01:00
Gilles Peskine
ab84fe8052 opt-testcases/*.sh are not executable
The *.sh files in opt-testcases cannot be executed directly: they can only
be sourced by ssl-opt.sh. So don't make them executable and don't give them
a shebang line.

Also make sure that the first paragraph of each file is a short description.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-13 16:30:57 +02:00
Paul Elliott
d3d586bf5f
Merge pull request #9174 from billatarm/3.6-add-pc-test
[BACKPORT 3.6] tests: add a test for pkg-config files
2024-09-11 21:14:29 +00:00
Bill Roberts
3cc48e4de7
tests: add a test for pkg-config files
Add a test that does some basic validation of the pkg-config files.

Example run:
./tests/scripts/all.sh test_cmake_as_package
<snip>
******************************************************************
* test_cmake_as_package: build: cmake 'as-package' build
* Wed Sep 11 16:22:09 UTC 2024
******************************************************************
cmake .
make
Built against Mbed TLS 3.6.1
testing package config file: mbedtls ... passed
testing package config file: mbedx509 ... passed
testing package config file: mbedcrypto ... passed
make clean

Signed-off-by: Bill Roberts <bill.roberts@arm.com>
2024-09-11 09:24:20 -07:00