blob: bc99a043f80535f5ca3dd564e3bf9221c6c29c3f [file] [log] [blame]
Valerio Setti8d178be2023-10-17 12:23:55 +02001#!/usr/bin/env python3
Gilles Peskine15c2cbf2020-06-25 18:36:28 +02002
3"""Analyze the test outcomes from a full CI run.
4
5This script can also run on outcomes from a partial run, but the results are
6less likely to be useful.
7"""
8
9import argparse
10import sys
11import traceback
Przemek Stekiel85c54ea2022-11-17 11:50:23 +010012import re
Valerio Settia2663322023-03-24 08:20:18 +010013import subprocess
14import os
Gilles Peskine15c2cbf2020-06-25 18:36:28 +020015
Gilles Peskine8d3c70a2020-06-25 18:37:43 +020016import check_test_cases
17
Valerio Settif075e472023-10-17 11:03:16 +020018class Results:
Gilles Peskine15c2cbf2020-06-25 18:36:28 +020019 """Process analysis results."""
20
21 def __init__(self):
22 self.error_count = 0
23 self.warning_count = 0
Valerio Settiaaef0bc2023-10-10 09:42:13 +020024
Valerio Setti2cff8202023-10-18 14:36:47 +020025 def new_section(self, fmt, *args, **kwargs):
26 self._print_line('\n*** ' + fmt + ' ***\n', *args, **kwargs)
27
Valerio Settiaaef0bc2023-10-10 09:42:13 +020028 def info(self, fmt, *args, **kwargs):
Valerio Setti8070dbe2023-10-17 12:29:30 +020029 self._print_line('Info: ' + fmt, *args, **kwargs)
Gilles Peskine15c2cbf2020-06-25 18:36:28 +020030
31 def error(self, fmt, *args, **kwargs):
Gilles Peskine15c2cbf2020-06-25 18:36:28 +020032 self.error_count += 1
Valerio Setti8070dbe2023-10-17 12:29:30 +020033 self._print_line('Error: ' + fmt, *args, **kwargs)
Gilles Peskine15c2cbf2020-06-25 18:36:28 +020034
35 def warning(self, fmt, *args, **kwargs):
Gilles Peskine15c2cbf2020-06-25 18:36:28 +020036 self.warning_count += 1
Valerio Setti8070dbe2023-10-17 12:29:30 +020037 self._print_line('Warning: ' + fmt, *args, **kwargs)
Gilles Peskine15c2cbf2020-06-25 18:36:28 +020038
Valerio Setti3f339892023-10-17 10:42:11 +020039 @staticmethod
Valerio Setti8070dbe2023-10-17 12:29:30 +020040 def _print_line(fmt, *args, **kwargs):
Valerio Setti735794c2023-10-18 08:05:15 +020041 sys.stderr.write((fmt + '\n').format(*args, **kwargs))
Valerio Settiaaef0bc2023-10-10 09:42:13 +020042
Gilles Peskine15c2cbf2020-06-25 18:36:28 +020043class TestCaseOutcomes:
44 """The outcomes of one test case across many configurations."""
45 # pylint: disable=too-few-public-methods
46
47 def __init__(self):
Gilles Peskine3d863f22020-06-26 13:02:30 +020048 # Collect a list of witnesses of the test case succeeding or failing.
49 # Currently we don't do anything with witnesses except count them.
50 # The format of a witness is determined by the read_outcome_file
51 # function; it's the platform and configuration joined by ';'.
Gilles Peskine15c2cbf2020-06-25 18:36:28 +020052 self.successes = []
53 self.failures = []
54
55 def hits(self):
56 """Return the number of times a test case has been run.
57
58 This includes passes and failures, but not skips.
59 """
60 return len(self.successes) + len(self.failures)
61
Valerio Settif075e472023-10-17 11:03:16 +020062def execute_reference_driver_tests(results: Results, ref_component, driver_component, \
Valerio Setti781c2342023-10-17 12:47:35 +020063 outcome_file):
Valerio Setti22992a02023-03-29 11:15:28 +020064 """Run the tests specified in ref_component and driver_component. Results
65 are stored in the output_file and they will be used for the following
Valerio Settia2663322023-03-24 08:20:18 +010066 coverage analysis"""
67 # If the outcome file already exists, we assume that the user wants to
68 # perform the comparison analysis again without repeating the tests.
69 if os.path.exists(outcome_file):
Valerio Setti39d4b9d2023-10-18 14:30:03 +020070 results.info("Outcome file ({}) already exists. Tests will be skipped.", outcome_file)
Valerio Setti781c2342023-10-17 12:47:35 +020071 return
Valerio Settia2663322023-03-24 08:20:18 +010072
73 shell_command = "tests/scripts/all.sh --outcome-file " + outcome_file + \
74 " " + ref_component + " " + driver_component
Valerio Setti39d4b9d2023-10-18 14:30:03 +020075 results.info("Running: {}", shell_command)
Valerio Settia2663322023-03-24 08:20:18 +010076 ret_val = subprocess.run(shell_command.split(), check=False).returncode
77
78 if ret_val != 0:
Valerio Settif075e472023-10-17 11:03:16 +020079 results.error("failed to run reference/driver components")
Valerio Settiaaef0bc2023-10-10 09:42:13 +020080
Tomás Gonzálezb401e112023-08-11 15:22:04 +010081def analyze_coverage(results, outcomes, allow_list, full_coverage):
Gilles Peskine8d3c70a2020-06-25 18:37:43 +020082 """Check that all available test cases are executed at least once."""
Gilles Peskine686c2922022-01-07 15:58:38 +010083 available = check_test_cases.collect_available_test_cases()
Gilles Peskine8d3c70a2020-06-25 18:37:43 +020084 for key in available:
85 hits = outcomes[key].hits() if key in outcomes else 0
Tomás González07bdcc22023-08-11 14:59:03 +010086 if hits == 0 and key not in allow_list:
Tomás Gonzálezb401e112023-08-11 15:22:04 +010087 if full_coverage:
88 results.error('Test case not executed: {}', key)
89 else:
90 results.warning('Test case not executed: {}', key)
Tomás González07bdcc22023-08-11 14:59:03 +010091 elif hits != 0 and key in allow_list:
92 # Test Case should be removed from the allow list.
Tomás González7ebb18f2023-08-22 09:40:23 +010093 if full_coverage:
Tomás Gonzáleza0631442023-08-22 12:17:57 +010094 results.error('Allow listed test case was executed: {}', key)
Tomás González7ebb18f2023-08-22 09:40:23 +010095 else:
96 results.warning('Allow listed test case was executed: {}', key)
Gilles Peskine8d3c70a2020-06-25 18:37:43 +020097
Valerio Settif075e472023-10-17 11:03:16 +020098def analyze_driver_vs_reference(results: Results, outcomes,
Valerio Settiaaef0bc2023-10-10 09:42:13 +020099 component_ref, component_driver,
Valerio Setti3002c992023-01-18 17:28:36 +0100100 ignored_suites, ignored_test=None):
Przemek Stekiel4e955902022-10-21 13:42:08 +0200101 """Check that all tests executed in the reference component are also
102 executed in the corresponding driver component.
Valerio Setti3002c992023-01-18 17:28:36 +0100103 Skip:
104 - full test suites provided in ignored_suites list
105 - only some specific test inside a test suite, for which the corresponding
106 output string is provided
Przemek Stekiel4e955902022-10-21 13:42:08 +0200107 """
Przemek Stekiel4e955902022-10-21 13:42:08 +0200108 available = check_test_cases.collect_available_test_cases()
Przemek Stekiel4e955902022-10-21 13:42:08 +0200109
110 for key in available:
Przemek Stekiel4e955902022-10-21 13:42:08 +0200111 # Continue if test was not executed by any component
112 hits = outcomes[key].hits() if key in outcomes else 0
Przemek Stekielc86dedf2022-10-24 09:16:04 +0200113 if hits == 0:
Przemek Stekiel4e955902022-10-21 13:42:08 +0200114 continue
Valerio Setti00c1ccb2023-02-02 11:33:31 +0100115 # Skip ignored test suites
116 full_test_suite = key.split(';')[0] # retrieve full test suite name
117 test_string = key.split(';')[1] # retrieve the text string of this test
118 test_suite = full_test_suite.split('.')[0] # retrieve main part of test suite name
Manuel Pégourié-Gonnard7d381f52023-03-17 15:13:08 +0100119 if test_suite in ignored_suites or full_test_suite in ignored_suites:
Valerio Setti00c1ccb2023-02-02 11:33:31 +0100120 continue
Valerio Setti3002c992023-01-18 17:28:36 +0100121 if ((full_test_suite in ignored_test) and
122 (test_string in ignored_test[full_test_suite])):
123 continue
Przemek Stekiel4e955902022-10-21 13:42:08 +0200124 # Search for tests that run in reference component and not in driver component
125 driver_test_passed = False
126 reference_test_passed = False
127 for entry in outcomes[key].successes:
Przemek Stekiel51f30ff2022-11-09 12:07:29 +0100128 if component_driver in entry:
Przemek Stekiel4e955902022-10-21 13:42:08 +0200129 driver_test_passed = True
Przemek Stekiel51f30ff2022-11-09 12:07:29 +0100130 if component_ref in entry:
Przemek Stekiel4e955902022-10-21 13:42:08 +0200131 reference_test_passed = True
Manuel Pégourié-Gonnardc6967d22022-12-30 13:40:34 +0100132 if(reference_test_passed and not driver_test_passed):
Valerio Setti39d4b9d2023-10-18 14:30:03 +0200133 results.error("Did not pass with driver: {}", key)
Przemek Stekiel4e955902022-10-21 13:42:08 +0200134
Valerio Setti781c2342023-10-17 12:47:35 +0200135def analyze_outcomes(results: Results, outcomes, args):
Gilles Peskine15c2cbf2020-06-25 18:36:28 +0200136 """Run all analyses on the given outcome collection."""
Valerio Settif075e472023-10-17 11:03:16 +0200137 analyze_coverage(results, outcomes, args['allow_list'],
Tomás Gonzálezb401e112023-08-11 15:22:04 +0100138 args['full_coverage'])
Gilles Peskine15c2cbf2020-06-25 18:36:28 +0200139
140def read_outcome_file(outcome_file):
141 """Parse an outcome file and return an outcome collection.
142
143An outcome collection is a dictionary mapping keys to TestCaseOutcomes objects.
144The keys are the test suite name and the test case description, separated
145by a semicolon.
146"""
147 outcomes = {}
148 with open(outcome_file, 'r', encoding='utf-8') as input_file:
149 for line in input_file:
150 (platform, config, suite, case, result, _cause) = line.split(';')
151 key = ';'.join([suite, case])
152 setup = ';'.join([platform, config])
153 if key not in outcomes:
154 outcomes[key] = TestCaseOutcomes()
155 if result == 'PASS':
156 outcomes[key].successes.append(setup)
157 elif result == 'FAIL':
158 outcomes[key].failures.append(setup)
159 return outcomes
160
Valerio Setti781c2342023-10-17 12:47:35 +0200161def do_analyze_coverage(results: Results, outcome_file, args):
Przemek Stekiel6856f4c2022-11-09 10:50:29 +0100162 """Perform coverage analysis."""
Valerio Setti2cff8202023-10-18 14:36:47 +0200163 results.new_section("Analyze coverage")
Gilles Peskine15c2cbf2020-06-25 18:36:28 +0200164 outcomes = read_outcome_file(outcome_file)
Valerio Setti781c2342023-10-17 12:47:35 +0200165 analyze_outcomes(results, outcomes, args)
Przemek Stekiel4e955902022-10-21 13:42:08 +0200166
Valerio Setti781c2342023-10-17 12:47:35 +0200167def do_analyze_driver_vs_reference(results: Results, outcome_file, args):
Przemek Stekiel4e955902022-10-21 13:42:08 +0200168 """Perform driver vs reference analyze."""
Valerio Setti2cff8202023-10-18 14:36:47 +0200169 results.new_section("Analyze driver {} vs reference {}",
170 args['component_driver'], args['component_ref'])
Valerio Settib0c618e2023-10-16 14:19:49 +0200171
Valerio Setti781c2342023-10-17 12:47:35 +0200172 execute_reference_driver_tests(results, args['component_ref'], \
173 args['component_driver'], outcome_file)
Valerio Settia2663322023-03-24 08:20:18 +0100174
Valerio Setti3002c992023-01-18 17:28:36 +0100175 ignored_suites = ['test_suite_' + x for x in args['ignored_suites']]
Przemek Stekiel51f30ff2022-11-09 12:07:29 +0100176
Przemek Stekiel4e955902022-10-21 13:42:08 +0200177 outcomes = read_outcome_file(outcome_file)
Valerio Settiaaef0bc2023-10-10 09:42:13 +0200178
Valerio Setti781c2342023-10-17 12:47:35 +0200179 analyze_driver_vs_reference(results, outcomes,
180 args['component_ref'], args['component_driver'],
181 ignored_suites, args['ignored_tests'])
Gilles Peskine15c2cbf2020-06-25 18:36:28 +0200182
Przemek Stekiel6856f4c2022-11-09 10:50:29 +0100183# List of tasks with a function that can handle this task and additional arguments if required
Valerio Settidfd7ca62023-10-09 16:30:11 +0200184KNOWN_TASKS = {
Przemek Stekiel4d13c832022-10-26 16:11:26 +0200185 'analyze_coverage': {
186 'test_function': do_analyze_coverage,
Tomás González07bdcc22023-08-11 14:59:03 +0100187 'args': {
Tomás González358c6c62023-08-14 15:43:46 +0100188 'allow_list': [
Tomás González50223112023-08-22 09:52:06 +0100189 # Algorithm not supported yet
190 'test_suite_psa_crypto_metadata;Asymmetric signature: pure EdDSA',
191 # Algorithm not supported yet
192 'test_suite_psa_crypto_metadata;Cipher: XTS',
Tomás Gonzálezd43cab32023-08-24 09:12:40 +0100193 ],
Tomás Gonzálezb401e112023-08-11 15:22:04 +0100194 'full_coverage': False,
Tomás González07bdcc22023-08-11 14:59:03 +0100195 }
Tomás Gonzálezd43cab32023-08-24 09:12:40 +0100196 },
Valerio Settia2663322023-03-24 08:20:18 +0100197 # There are 2 options to use analyze_driver_vs_reference_xxx locally:
198 # 1. Run tests and then analysis:
199 # - tests/scripts/all.sh --outcome-file "$PWD/out.csv" <component_ref> <component_driver>
200 # - tests/scripts/analyze_outcomes.py out.csv analyze_driver_vs_reference_xxx
201 # 2. Let this script run both automatically:
202 # - tests/scripts/analyze_outcomes.py out.csv analyze_driver_vs_reference_xxx
Przemek Stekiel4d13c832022-10-26 16:11:26 +0200203 'analyze_driver_vs_reference_hash': {
204 'test_function': do_analyze_driver_vs_reference,
205 'args': {
Przemek Stekiel51f30ff2022-11-09 12:07:29 +0100206 'component_ref': 'test_psa_crypto_config_reference_hash_use_psa',
207 'component_driver': 'test_psa_crypto_config_accel_hash_use_psa',
Manuel Pégourié-Gonnard10e39632022-12-29 12:29:09 +0100208 'ignored_suites': [
209 'shax', 'mdx', # the software implementations that are being excluded
Manuel Pégourié-Gonnard7d381f52023-03-17 15:13:08 +0100210 'md.psa', # purposefully depends on whether drivers are present
Gilles Peskine35b49c42023-10-04 12:28:41 +0200211 'psa_crypto_low_hash.generated', # testing the builtins
Valerio Setti3002c992023-01-18 17:28:36 +0100212 ],
213 'ignored_tests': {
214 }
215 }
216 },
Valerio Settib6b301f2023-10-04 12:05:05 +0200217 'analyze_driver_vs_reference_cipher_aead': {
218 'test_function': do_analyze_driver_vs_reference,
219 'args': {
220 'component_ref': 'test_psa_crypto_config_reference_cipher_aead',
221 'component_driver': 'test_psa_crypto_config_accel_cipher_aead',
Valerio Setti7448cee2023-10-04 15:46:42 +0200222 # Ignore suites that are being accelerated
Valerio Settib6b301f2023-10-04 12:05:05 +0200223 'ignored_suites': [
Valerio Setti7448cee2023-10-04 15:46:42 +0200224 'aes.cbc',
225 'aes.cfb',
226 'aes.ecb',
227 'aes.ofb',
228 'aes.rest',
229 'aes.xts',
230 'aria',
231 'camellia',
232 'ccm',
233 'chacha20',
234 'chachapoly',
235 'cipher.aes',
236 'cipher.aria',
237 'cipher.camellia',
238 'cipher.ccm',
239 'cipher.chacha20',
240 'cipher.chachapoly',
241 'cipher.des',
242 'cipher.gcm',
243 'cipher.nist_kw',
244 'cipher.padding',
245 'des',
246 'gcm.aes128_de',
247 'gcm.aes128_en',
248 'gcm.aes192_de',
249 'gcm.aes192_en',
250 'gcm.aes256_de',
251 'gcm.aes256_en',
252 'gcm.camellia',
253 'gcm.misc',
Valerio Settib6b301f2023-10-04 12:05:05 +0200254 ],
255 'ignored_tests': {
Valerio Setti7448cee2023-10-04 15:46:42 +0200256 # Following tests depends on AES_C/DES_C
257 'test_suite_pem': [
258 'PEM read (AES-128-CBC + invalid iv)'
259 'PEM read (DES-CBC + invalid iv)',
260 'PEM read (DES-EDE3-CBC + invalid iv)',
261 'PEM read (malformed PEM AES-128-CBC)',
262 'PEM read (malformed PEM DES-CBC)',
263 'PEM read (malformed PEM DES-EDE3-CBC)',
264 'PEM read (unknown encryption algorithm)',
265 'PEM read (AES-128-CBC + invalid iv)',
266 'PEM read (DES-CBC + invalid iv)',
267 ],
268 # Following tests depends on AES_C/DES_C
269 'test_suite_error': [
270 'Low and high error',
271 'Single low error'
272 ],
273 # Following tests depends on AES_C/DES_C/GCM_C/CTR
274 'test_suite_psa_crypto': [
275 'PSA AEAD encrypt/decrypt: DES-CCM not supported',
276 'PSA AEAD encrypt/decrypt: invalid algorithm (CTR)',
277 'PSA cipher setup: bad algorithm (unknown cipher algorithm)',
278 'PSA cipher setup: incompatible key ChaCha20 for CTR',
279 'PSA cipher setup: invalid key type, CTR',
280 'PSA symmetric decrypt: CCM*-no-tag, input too short (15 bytes)',
281 ],
282 # Following test depends on AES_C
283 'test_suite_version': [
284 'Check for MBEDTLS_AES_C when already present',
285 ]
Valerio Settib6b301f2023-10-04 12:05:05 +0200286 }
287 }
288 },
Valerio Setti4d25a8d2023-06-14 10:33:10 +0200289 'analyze_driver_vs_reference_ecp_light_only': {
Valerio Setti42d5f192023-03-20 13:54:41 +0100290 'test_function': do_analyze_driver_vs_reference,
291 'args': {
Valerio Setti4d25a8d2023-06-14 10:33:10 +0200292 'component_ref': 'test_psa_crypto_config_reference_ecc_ecp_light_only',
293 'component_driver': 'test_psa_crypto_config_accel_ecc_ecp_light_only',
Valerio Setti42d5f192023-03-20 13:54:41 +0100294 'ignored_suites': [
295 'ecdsa',
296 'ecdh',
297 'ecjpake',
298 ],
299 'ignored_tests': {
300 'test_suite_random': [
301 'PSA classic wrapper: ECDSA signature (SECP256R1)',
302 ],
Valerio Setti0c477d32023-04-07 15:54:20 +0200303 # In the accelerated test ECP_C is not set (only ECP_LIGHT is)
304 # so we must ignore disparities in the tests for which ECP_C
305 # is required.
306 'test_suite_ecp': [
307 'ECP check public-private #1 (OK)',
308 'ECP check public-private #2 (group none)',
309 'ECP check public-private #3 (group mismatch)',
310 'ECP check public-private #4 (Qx mismatch)',
311 'ECP check public-private #5 (Qy mismatch)',
312 'ECP check public-private #6 (wrong Qx)',
313 'ECP check public-private #7 (wrong Qy)',
314 'ECP gen keypair [#1]',
315 'ECP gen keypair [#2]',
316 'ECP gen keypair [#3]',
317 'ECP gen keypair wrapper',
318 'ECP point muladd secp256r1 #1',
319 'ECP point muladd secp256r1 #2',
320 'ECP point multiplication Curve25519 (element of order 2: origin) #3',
321 'ECP point multiplication Curve25519 (element of order 4: 1) #4',
322 'ECP point multiplication Curve25519 (element of order 8) #5',
323 'ECP point multiplication Curve25519 (normalized) #1',
324 'ECP point multiplication Curve25519 (not normalized) #2',
325 'ECP point multiplication rng fail Curve25519',
326 'ECP point multiplication rng fail secp256r1',
327 'ECP test vectors Curve25519',
328 'ECP test vectors Curve448 (RFC 7748 6.2, after decodeUCoordinate)',
329 'ECP test vectors brainpoolP256r1 rfc 7027',
330 'ECP test vectors brainpoolP384r1 rfc 7027',
331 'ECP test vectors brainpoolP512r1 rfc 7027',
332 'ECP test vectors secp192k1',
333 'ECP test vectors secp192r1 rfc 5114',
334 'ECP test vectors secp224k1',
335 'ECP test vectors secp224r1 rfc 5114',
336 'ECP test vectors secp256k1',
337 'ECP test vectors secp256r1 rfc 5114',
338 'ECP test vectors secp384r1 rfc 5114',
339 'ECP test vectors secp521r1 rfc 5114',
Valerio Settie50a75f2023-05-19 17:43:06 +0200340 ],
Valerio Setti482a0b92023-08-18 15:55:10 +0200341 'test_suite_psa_crypto': [
342 'PSA key derivation: HKDF-SHA-256 -> ECC secp256r1',
343 'PSA key derivation: HKDF-SHA-256 -> ECC secp256r1 (1 redraw)',
344 'PSA key derivation: HKDF-SHA-256 -> ECC secp256r1, exercise ECDSA',
345 'PSA key derivation: HKDF-SHA-256 -> ECC secp384r1',
346 'PSA key derivation: HKDF-SHA-256 -> ECC secp521r1 #0',
347 'PSA key derivation: HKDF-SHA-256 -> ECC secp521r1 #1',
348 ],
Manuel Pégourié-Gonnardf07ce3b2023-09-22 11:53:41 +0200349 'test_suite_ssl': [
350 'Test configuration of groups for DHE through mbedtls_ssl_conf_curves()',
351 ],
Valerio Setti5f540202023-06-30 17:20:49 +0200352 }
Valerio Setti42d5f192023-03-20 13:54:41 +0100353 }
354 },
Valerio Setti4d25a8d2023-06-14 10:33:10 +0200355 'analyze_driver_vs_reference_no_ecp_at_all': {
Valerio Settie618cb02023-04-12 14:59:16 +0200356 'test_function': do_analyze_driver_vs_reference,
357 'args': {
Valerio Setti4d25a8d2023-06-14 10:33:10 +0200358 'component_ref': 'test_psa_crypto_config_reference_ecc_no_ecp_at_all',
359 'component_driver': 'test_psa_crypto_config_accel_ecc_no_ecp_at_all',
Valerio Settie618cb02023-04-12 14:59:16 +0200360 'ignored_suites': [
361 # Ignore test suites for the modules that are disabled in the
362 # accelerated test case.
363 'ecp',
364 'ecdsa',
365 'ecdh',
366 'ecjpake',
367 ],
368 'ignored_tests': {
369 'test_suite_random': [
370 'PSA classic wrapper: ECDSA signature (SECP256R1)',
371 ],
372 'test_suite_psa_crypto': [
373 'PSA key derivation: HKDF-SHA-256 -> ECC secp256r1',
374 'PSA key derivation: HKDF-SHA-256 -> ECC secp256r1 (1 redraw)',
375 'PSA key derivation: HKDF-SHA-256 -> ECC secp256r1, exercise ECDSA',
376 'PSA key derivation: HKDF-SHA-256 -> ECC secp384r1',
377 'PSA key derivation: HKDF-SHA-256 -> ECC secp521r1 #0',
378 'PSA key derivation: HKDF-SHA-256 -> ECC secp521r1 #1',
379 'PSA key derivation: bits=7 invalid for ECC BRAINPOOL_P_R1 (ECC enabled)',
380 'PSA key derivation: bits=7 invalid for ECC SECP_K1 (ECC enabled)',
381 'PSA key derivation: bits=7 invalid for ECC SECP_R1 (ECC enabled)',
382 'PSA key derivation: bits=7 invalid for ECC SECP_R2 (ECC enabled)',
383 'PSA key derivation: bits=7 invalid for ECC SECT_K1 (ECC enabled)',
384 'PSA key derivation: bits=7 invalid for ECC SECT_R1 (ECC enabled)',
385 'PSA key derivation: bits=7 invalid for ECC SECT_R2 (ECC enabled)',
Valerio Settiaddeee42023-06-14 10:46:55 +0200386 ],
387 'test_suite_pkparse': [
Valerio Setti5bd25232023-06-19 19:32:14 +0200388 # When PK_PARSE_C and ECP_C are defined then PK_PARSE_EC_COMPRESSED
389 # is automatically enabled in build_info.h (backward compatibility)
390 # even if it is disabled in config_psa_crypto_no_ecp_at_all(). As a
391 # consequence compressed points are supported in the reference
392 # component but not in the accelerated one, so they should be skipped
393 # while checking driver's coverage.
394 'Parse EC Key #10a (SEC1 PEM, secp384r1, compressed)',
395 'Parse EC Key #11a (SEC1 PEM, secp521r1, compressed)',
396 'Parse EC Key #12a (SEC1 PEM, bp256r1, compressed)',
397 'Parse EC Key #13a (SEC1 PEM, bp384r1, compressed)',
398 'Parse EC Key #14a (SEC1 PEM, bp512r1, compressed)',
399 'Parse EC Key #2a (SEC1 PEM, secp192r1, compressed)',
400 'Parse EC Key #8a (SEC1 PEM, secp224r1, compressed)',
401 'Parse EC Key #9a (SEC1 PEM, secp256r1, compressed)',
402 'Parse Public EC Key #2a (RFC 5480, PEM, secp192r1, compressed)',
403 'Parse Public EC Key #3a (RFC 5480, secp224r1, compressed)',
404 'Parse Public EC Key #4a (RFC 5480, secp256r1, compressed)',
405 'Parse Public EC Key #5a (RFC 5480, secp384r1, compressed)',
406 'Parse Public EC Key #6a (RFC 5480, secp521r1, compressed)',
407 'Parse Public EC Key #7a (RFC 5480, brainpoolP256r1, compressed)',
408 'Parse Public EC Key #8a (RFC 5480, brainpoolP384r1, compressed)',
409 'Parse Public EC Key #9a (RFC 5480, brainpoolP512r1, compressed)',
Valerio Settiaddeee42023-06-14 10:46:55 +0200410 ],
Manuel Pégourié-Gonnardf07ce3b2023-09-22 11:53:41 +0200411 'test_suite_ssl': [
412 'Test configuration of groups for DHE through mbedtls_ssl_conf_curves()',
413 ],
Valerio Settie618cb02023-04-12 14:59:16 +0200414 }
415 }
416 },
Valerio Setti307810b2023-08-15 10:12:25 +0200417 'analyze_driver_vs_reference_ecc_no_bignum': {
Manuel Pégourié-Gonnardabd00d02023-06-12 17:51:33 +0200418 'test_function': do_analyze_driver_vs_reference,
419 'args': {
420 'component_ref': 'test_psa_crypto_config_reference_ecc_no_bignum',
421 'component_driver': 'test_psa_crypto_config_accel_ecc_no_bignum',
422 'ignored_suites': [
423 # Ignore test suites for the modules that are disabled in the
424 # accelerated test case.
425 'ecp',
426 'ecdsa',
427 'ecdh',
428 'ecjpake',
Valerio Setti9b3dbcc2023-07-26 18:00:31 +0200429 'bignum_core',
430 'bignum_random',
431 'bignum_mod',
432 'bignum_mod_raw',
433 'bignum.generated',
434 'bignum.misc',
Manuel Pégourié-Gonnardabd00d02023-06-12 17:51:33 +0200435 ],
436 'ignored_tests': {
437 'test_suite_random': [
438 'PSA classic wrapper: ECDSA signature (SECP256R1)',
439 ],
440 'test_suite_psa_crypto': [
441 'PSA key derivation: HKDF-SHA-256 -> ECC secp256r1',
442 'PSA key derivation: HKDF-SHA-256 -> ECC secp256r1 (1 redraw)',
443 'PSA key derivation: HKDF-SHA-256 -> ECC secp256r1, exercise ECDSA',
444 'PSA key derivation: HKDF-SHA-256 -> ECC secp384r1',
445 'PSA key derivation: HKDF-SHA-256 -> ECC secp521r1 #0',
446 'PSA key derivation: HKDF-SHA-256 -> ECC secp521r1 #1',
447 'PSA key derivation: bits=7 invalid for ECC BRAINPOOL_P_R1 (ECC enabled)',
448 'PSA key derivation: bits=7 invalid for ECC SECP_K1 (ECC enabled)',
449 'PSA key derivation: bits=7 invalid for ECC SECP_R1 (ECC enabled)',
450 'PSA key derivation: bits=7 invalid for ECC SECP_R2 (ECC enabled)',
451 'PSA key derivation: bits=7 invalid for ECC SECT_K1 (ECC enabled)',
452 'PSA key derivation: bits=7 invalid for ECC SECT_R1 (ECC enabled)',
453 'PSA key derivation: bits=7 invalid for ECC SECT_R2 (ECC enabled)',
454 ],
455 'test_suite_pkparse': [
456 # See the description provided above in the
457 # analyze_driver_vs_reference_no_ecp_at_all component.
458 'Parse EC Key #10a (SEC1 PEM, secp384r1, compressed)',
459 'Parse EC Key #11a (SEC1 PEM, secp521r1, compressed)',
460 'Parse EC Key #12a (SEC1 PEM, bp256r1, compressed)',
461 'Parse EC Key #13a (SEC1 PEM, bp384r1, compressed)',
462 'Parse EC Key #14a (SEC1 PEM, bp512r1, compressed)',
463 'Parse EC Key #2a (SEC1 PEM, secp192r1, compressed)',
464 'Parse EC Key #8a (SEC1 PEM, secp224r1, compressed)',
465 'Parse EC Key #9a (SEC1 PEM, secp256r1, compressed)',
466 'Parse Public EC Key #2a (RFC 5480, PEM, secp192r1, compressed)',
467 'Parse Public EC Key #3a (RFC 5480, secp224r1, compressed)',
468 'Parse Public EC Key #4a (RFC 5480, secp256r1, compressed)',
469 'Parse Public EC Key #5a (RFC 5480, secp384r1, compressed)',
470 'Parse Public EC Key #6a (RFC 5480, secp521r1, compressed)',
471 'Parse Public EC Key #7a (RFC 5480, brainpoolP256r1, compressed)',
472 'Parse Public EC Key #8a (RFC 5480, brainpoolP384r1, compressed)',
473 'Parse Public EC Key #9a (RFC 5480, brainpoolP512r1, compressed)',
474 ],
Valerio Setti9b3dbcc2023-07-26 18:00:31 +0200475 'test_suite_asn1parse': [
476 # This test depends on BIGNUM_C
477 'INTEGER too large for mpi',
478 ],
479 'test_suite_asn1write': [
480 # Following tests depends on BIGNUM_C
481 'ASN.1 Write mpi 0 (1 limb)',
482 'ASN.1 Write mpi 0 (null)',
483 'ASN.1 Write mpi 0x100',
484 'ASN.1 Write mpi 0x7f',
485 'ASN.1 Write mpi 0x7f with leading 0 limb',
486 'ASN.1 Write mpi 0x80',
487 'ASN.1 Write mpi 0x80 with leading 0 limb',
488 'ASN.1 Write mpi 0xff',
489 'ASN.1 Write mpi 1',
490 'ASN.1 Write mpi, 127*8 bits',
491 'ASN.1 Write mpi, 127*8+1 bits',
492 'ASN.1 Write mpi, 127*8-1 bits',
493 'ASN.1 Write mpi, 255*8 bits',
494 'ASN.1 Write mpi, 255*8-1 bits',
495 'ASN.1 Write mpi, 256*8-1 bits',
496 ],
Valerio Settie0be95e2023-08-01 09:07:43 +0200497 'test_suite_debug': [
498 # Following tests depends on BIGNUM_C
499 'Debug print mbedtls_mpi #2: 3 bits',
500 'Debug print mbedtls_mpi: 0 (empty representation)',
501 'Debug print mbedtls_mpi: 0 (non-empty representation)',
502 'Debug print mbedtls_mpi: 49 bits',
503 'Debug print mbedtls_mpi: 759 bits',
504 'Debug print mbedtls_mpi: 764 bits #1',
505 'Debug print mbedtls_mpi: 764 bits #2',
506 ],
Manuel Pégourié-Gonnardf07ce3b2023-09-22 11:53:41 +0200507 'test_suite_ssl': [
508 'Test configuration of groups for DHE through mbedtls_ssl_conf_curves()',
509 ],
Manuel Pégourié-Gonnardabd00d02023-06-12 17:51:33 +0200510 }
511 }
512 },
Valerio Setti307810b2023-08-15 10:12:25 +0200513 'analyze_driver_vs_reference_ecc_ffdh_no_bignum': {
514 'test_function': do_analyze_driver_vs_reference,
515 'args': {
516 'component_ref': 'test_psa_crypto_config_reference_ecc_ffdh_no_bignum',
517 'component_driver': 'test_psa_crypto_config_accel_ecc_ffdh_no_bignum',
518 'ignored_suites': [
519 # Ignore test suites for the modules that are disabled in the
520 # accelerated test case.
521 'ecp',
522 'ecdsa',
523 'ecdh',
524 'ecjpake',
525 'bignum_core',
526 'bignum_random',
527 'bignum_mod',
528 'bignum_mod_raw',
529 'bignum.generated',
530 'bignum.misc',
531 'dhm',
532 ],
533 'ignored_tests': {
534 'test_suite_random': [
535 'PSA classic wrapper: ECDSA signature (SECP256R1)',
536 ],
537 'test_suite_psa_crypto': [
538 'PSA key derivation: HKDF-SHA-256 -> ECC secp256r1',
539 'PSA key derivation: HKDF-SHA-256 -> ECC secp256r1 (1 redraw)',
540 'PSA key derivation: HKDF-SHA-256 -> ECC secp256r1, exercise ECDSA',
541 'PSA key derivation: HKDF-SHA-256 -> ECC secp384r1',
542 'PSA key derivation: HKDF-SHA-256 -> ECC secp521r1 #0',
543 'PSA key derivation: HKDF-SHA-256 -> ECC secp521r1 #1',
544 'PSA key derivation: bits=7 invalid for ECC BRAINPOOL_P_R1 (ECC enabled)',
545 'PSA key derivation: bits=7 invalid for ECC SECP_K1 (ECC enabled)',
546 'PSA key derivation: bits=7 invalid for ECC SECP_R1 (ECC enabled)',
547 'PSA key derivation: bits=7 invalid for ECC SECP_R2 (ECC enabled)',
548 'PSA key derivation: bits=7 invalid for ECC SECT_K1 (ECC enabled)',
549 'PSA key derivation: bits=7 invalid for ECC SECT_R1 (ECC enabled)',
550 'PSA key derivation: bits=7 invalid for ECC SECT_R2 (ECC enabled)',
551 ],
552 'test_suite_pkparse': [
553 # See the description provided above in the
554 # analyze_driver_vs_reference_no_ecp_at_all component.
555 'Parse EC Key #10a (SEC1 PEM, secp384r1, compressed)',
556 'Parse EC Key #11a (SEC1 PEM, secp521r1, compressed)',
557 'Parse EC Key #12a (SEC1 PEM, bp256r1, compressed)',
558 'Parse EC Key #13a (SEC1 PEM, bp384r1, compressed)',
559 'Parse EC Key #14a (SEC1 PEM, bp512r1, compressed)',
560 'Parse EC Key #2a (SEC1 PEM, secp192r1, compressed)',
561 'Parse EC Key #8a (SEC1 PEM, secp224r1, compressed)',
562 'Parse EC Key #9a (SEC1 PEM, secp256r1, compressed)',
563 'Parse Public EC Key #2a (RFC 5480, PEM, secp192r1, compressed)',
564 'Parse Public EC Key #3a (RFC 5480, secp224r1, compressed)',
565 'Parse Public EC Key #4a (RFC 5480, secp256r1, compressed)',
566 'Parse Public EC Key #5a (RFC 5480, secp384r1, compressed)',
567 'Parse Public EC Key #6a (RFC 5480, secp521r1, compressed)',
568 'Parse Public EC Key #7a (RFC 5480, brainpoolP256r1, compressed)',
569 'Parse Public EC Key #8a (RFC 5480, brainpoolP384r1, compressed)',
570 'Parse Public EC Key #9a (RFC 5480, brainpoolP512r1, compressed)',
571 ],
572 'test_suite_asn1parse': [
573 # This test depends on BIGNUM_C
574 'INTEGER too large for mpi',
575 ],
576 'test_suite_asn1write': [
577 # Following tests depends on BIGNUM_C
578 'ASN.1 Write mpi 0 (1 limb)',
579 'ASN.1 Write mpi 0 (null)',
580 'ASN.1 Write mpi 0x100',
581 'ASN.1 Write mpi 0x7f',
582 'ASN.1 Write mpi 0x7f with leading 0 limb',
583 'ASN.1 Write mpi 0x80',
584 'ASN.1 Write mpi 0x80 with leading 0 limb',
585 'ASN.1 Write mpi 0xff',
586 'ASN.1 Write mpi 1',
587 'ASN.1 Write mpi, 127*8 bits',
588 'ASN.1 Write mpi, 127*8+1 bits',
589 'ASN.1 Write mpi, 127*8-1 bits',
590 'ASN.1 Write mpi, 255*8 bits',
591 'ASN.1 Write mpi, 255*8-1 bits',
592 'ASN.1 Write mpi, 256*8-1 bits',
593 ],
594 'test_suite_debug': [
595 # Following tests depends on BIGNUM_C
596 'Debug print mbedtls_mpi #2: 3 bits',
597 'Debug print mbedtls_mpi: 0 (empty representation)',
598 'Debug print mbedtls_mpi: 0 (non-empty representation)',
599 'Debug print mbedtls_mpi: 49 bits',
600 'Debug print mbedtls_mpi: 759 bits',
601 'Debug print mbedtls_mpi: 764 bits #1',
602 'Debug print mbedtls_mpi: 764 bits #2',
603 ],
Manuel Pégourié-Gonnardf07ce3b2023-09-22 11:53:41 +0200604 'test_suite_ssl': [
605 'Test configuration of groups for DHE through mbedtls_ssl_conf_curves()',
606 ],
Valerio Setti307810b2023-08-15 10:12:25 +0200607 }
608 }
609 },
Przemek Stekiel85b64422023-05-26 09:55:23 +0200610 'analyze_driver_vs_reference_ffdh_alg': {
611 'test_function': do_analyze_driver_vs_reference,
612 'args': {
613 'component_ref': 'test_psa_crypto_config_reference_ffdh',
614 'component_driver': 'test_psa_crypto_config_accel_ffdh',
Przemek Stekiel84f4ff12023-07-04 12:35:31 +0200615 'ignored_suites': ['dhm'],
Przemek Stekiel565353e2023-07-05 11:07:07 +0200616 'ignored_tests': {}
Przemek Stekiel85b64422023-05-26 09:55:23 +0200617 }
618 },
Valerio Settif01d6482023-08-04 13:51:18 +0200619 'analyze_driver_vs_reference_tfm_config': {
620 'test_function': do_analyze_driver_vs_reference,
621 'args': {
622 'component_ref': 'test_tfm_config',
623 'component_driver': 'test_tfm_config_p256m_driver_accel_ec',
Manuel Pégourié-Gonnarde9d97972023-08-08 18:34:47 +0200624 'ignored_suites': [
625 # Ignore test suites for the modules that are disabled in the
626 # accelerated test case.
627 'ecp',
628 'ecdsa',
629 'ecdh',
630 'ecjpake',
631 'bignum_core',
632 'bignum_random',
633 'bignum_mod',
634 'bignum_mod_raw',
635 'bignum.generated',
636 'bignum.misc',
637 ],
Valerio Settif01d6482023-08-04 13:51:18 +0200638 'ignored_tests': {
639 # Ignore all tests that require DERIVE support which is disabled
640 # in the driver version
641 'test_suite_psa_crypto': [
642 'PSA key agreement setup: ECDH + HKDF-SHA-256: good',
643 ('PSA key agreement setup: ECDH + HKDF-SHA-256: good, key algorithm broader '
644 'than required'),
645 'PSA key agreement setup: ECDH + HKDF-SHA-256: public key not on curve',
646 'PSA key agreement setup: KDF instead of a key agreement algorithm',
647 'PSA key agreement setup: bad key agreement algorithm',
648 'PSA key agreement: ECDH SECP256R1 (RFC 5903) + HKDF-SHA-256: capacity=8160',
649 'PSA key agreement: ECDH SECP256R1 (RFC 5903) + HKDF-SHA-256: read 0+32',
650 'PSA key agreement: ECDH SECP256R1 (RFC 5903) + HKDF-SHA-256: read 1+31',
651 'PSA key agreement: ECDH SECP256R1 (RFC 5903) + HKDF-SHA-256: read 31+1',
652 'PSA key agreement: ECDH SECP256R1 (RFC 5903) + HKDF-SHA-256: read 32+0',
653 'PSA key agreement: ECDH SECP256R1 (RFC 5903) + HKDF-SHA-256: read 32+32',
654 'PSA key agreement: ECDH SECP256R1 (RFC 5903) + HKDF-SHA-256: read 64+0',
655 'PSA key derivation: ECDH on P256 with HKDF-SHA256, info first',
656 'PSA key derivation: ECDH on P256 with HKDF-SHA256, key output',
657 'PSA key derivation: ECDH on P256 with HKDF-SHA256, missing info',
658 'PSA key derivation: ECDH on P256 with HKDF-SHA256, omitted salt',
659 'PSA key derivation: ECDH on P256 with HKDF-SHA256, raw output',
660 'PSA key derivation: ECDH on P256 with HKDF-SHA256, salt after secret',
661 'PSA key derivation: ECDH with TLS 1.2 PRF SHA-256, good case',
662 'PSA key derivation: ECDH with TLS 1.2 PRF SHA-256, missing label',
663 'PSA key derivation: ECDH with TLS 1.2 PRF SHA-256, missing label and secret',
664 'PSA key derivation: ECDH with TLS 1.2 PRF SHA-256, no inputs',
665 'PSA key derivation: HKDF-SHA-256 -> ECC secp256r1',
666 'PSA key derivation: HKDF-SHA-256 -> ECC secp256r1 (1 redraw)',
667 'PSA key derivation: HKDF-SHA-256 -> ECC secp256r1, exercise ECDSA',
668 'PSA key derivation: TLS 1.2 Mix-PSK-to-MS, SHA-256, 0+48, ka',
669 'PSA key derivation: TLS 1.2 Mix-PSK-to-MS, SHA-256, 24+24, ka',
670 'PSA key derivation: TLS 1.2 Mix-PSK-to-MS, SHA-256, 48+0, ka',
671 'PSA key derivation: TLS 1.2 Mix-PSK-to-MS, bad state #1, ka',
672 'PSA key derivation: TLS 1.2 Mix-PSK-to-MS, bad state #3, ka',
673 'PSA key derivation: TLS 1.2 Mix-PSK-to-MS, bad state #4, ka',
674 'PSA key derivation: bits=7 invalid for ECC BRAINPOOL_P_R1 (ECC enabled)',
675 'PSA key derivation: bits=7 invalid for ECC MONTGOMERY (ECC enabled)',
676 'PSA key derivation: bits=7 invalid for ECC SECP_K1 (ECC enabled)',
677 'PSA key derivation: bits=7 invalid for ECC SECP_R1 (ECC enabled)',
678 'PSA key derivation: bits=7 invalid for ECC SECP_R2 (ECC enabled)',
679 'PSA key derivation: bits=7 invalid for ECC SECT_K1 (ECC enabled)',
680 'PSA key derivation: bits=7 invalid for ECC SECT_R1 (ECC enabled)',
681 'PSA key derivation: bits=7 invalid for ECC SECT_R2 (ECC enabled)',
682 'PSA raw key agreement: ECDH SECP256R1 (RFC 5903)',
683 ],
Manuel Pégourié-Gonnarde9d97972023-08-08 18:34:47 +0200684 'test_suite_random': [
685 'PSA classic wrapper: ECDSA signature (SECP256R1)',
686 ],
Valerio Settif01d6482023-08-04 13:51:18 +0200687 'test_suite_psa_crypto_pake': [
688 'PSA PAKE: ecjpake size macros',
Manuel Pégourié-Gonnarde9d97972023-08-08 18:34:47 +0200689 ],
690 'test_suite_asn1parse': [
691 # This test depends on BIGNUM_C
692 'INTEGER too large for mpi',
693 ],
694 'test_suite_asn1write': [
695 # Following tests depends on BIGNUM_C
696 'ASN.1 Write mpi 0 (1 limb)',
697 'ASN.1 Write mpi 0 (null)',
698 'ASN.1 Write mpi 0x100',
699 'ASN.1 Write mpi 0x7f',
700 'ASN.1 Write mpi 0x7f with leading 0 limb',
701 'ASN.1 Write mpi 0x80',
702 'ASN.1 Write mpi 0x80 with leading 0 limb',
703 'ASN.1 Write mpi 0xff',
704 'ASN.1 Write mpi 1',
705 'ASN.1 Write mpi, 127*8 bits',
706 'ASN.1 Write mpi, 127*8+1 bits',
707 'ASN.1 Write mpi, 127*8-1 bits',
708 'ASN.1 Write mpi, 255*8 bits',
709 'ASN.1 Write mpi, 255*8-1 bits',
710 'ASN.1 Write mpi, 256*8-1 bits',
711 ],
Valerio Settif01d6482023-08-04 13:51:18 +0200712 }
713 }
714 }
Przemek Stekiel4d13c832022-10-26 16:11:26 +0200715}
Przemek Stekiel4d13c832022-10-26 16:11:26 +0200716
Gilles Peskine15c2cbf2020-06-25 18:36:28 +0200717def main():
Valerio Settif075e472023-10-17 11:03:16 +0200718 main_results = Results()
Valerio Settiaaef0bc2023-10-10 09:42:13 +0200719
Gilles Peskine15c2cbf2020-06-25 18:36:28 +0200720 try:
721 parser = argparse.ArgumentParser(description=__doc__)
Przemek Stekiel58bbc232022-10-24 08:10:10 +0200722 parser.add_argument('outcomes', metavar='OUTCOMES.CSV',
Gilles Peskine15c2cbf2020-06-25 18:36:28 +0200723 help='Outcome file to analyze')
Valerio Settidfd7ca62023-10-09 16:30:11 +0200724 parser.add_argument('specified_tasks', default='all', nargs='?',
Przemek Stekiel992de3c2022-11-09 13:54:49 +0100725 help='Analysis to be done. By default, run all tasks. '
726 'With one or more TASK, run only those. '
727 'TASK can be the name of a single task or '
Przemek Stekiel85c54ea2022-11-17 11:50:23 +0100728 'comma/space-separated list of tasks. ')
Przemek Stekiel992de3c2022-11-09 13:54:49 +0100729 parser.add_argument('--list', action='store_true',
730 help='List all available tasks and exit.')
Tomás Gonzálezb401e112023-08-11 15:22:04 +0100731 parser.add_argument('--require-full-coverage', action='store_true',
732 dest='full_coverage', help="Require all available "
733 "test cases to be executed and issue an error "
734 "otherwise. This flag is ignored if 'task' is "
735 "neither 'all' nor 'analyze_coverage'")
Gilles Peskine15c2cbf2020-06-25 18:36:28 +0200736 options = parser.parse_args()
Przemek Stekiel4e955902022-10-21 13:42:08 +0200737
Przemek Stekiel992de3c2022-11-09 13:54:49 +0100738 if options.list:
Valerio Settidfd7ca62023-10-09 16:30:11 +0200739 for task in KNOWN_TASKS:
Valerio Setti5329ff02023-10-17 09:44:36 +0200740 print(task)
Przemek Stekiel992de3c2022-11-09 13:54:49 +0100741 sys.exit(0)
742
Valerio Settidfd7ca62023-10-09 16:30:11 +0200743 if options.specified_tasks == 'all':
744 tasks_list = KNOWN_TASKS.keys()
Przemek Stekiel992de3c2022-11-09 13:54:49 +0100745 else:
Valerio Settidfd7ca62023-10-09 16:30:11 +0200746 tasks_list = re.split(r'[, ]+', options.specified_tasks)
Valerio Settidfd7ca62023-10-09 16:30:11 +0200747 for task in tasks_list:
748 if task not in KNOWN_TASKS:
Valerio Settifb2750e2023-10-17 10:11:45 +0200749 sys.stderr.write('invalid task: {}'.format(task))
750 sys.exit(2)
Przemek Stekiel992de3c2022-11-09 13:54:49 +0100751
Valerio Settidfd7ca62023-10-09 16:30:11 +0200752 KNOWN_TASKS['analyze_coverage']['args']['full_coverage'] = options.full_coverage
Tomás Gonzálezb401e112023-08-11 15:22:04 +0100753
Valerio Settifb2750e2023-10-17 10:11:45 +0200754 for task in tasks_list:
755 test_function = KNOWN_TASKS[task]['test_function']
756 test_args = KNOWN_TASKS[task]['args']
Valerio Setti781c2342023-10-17 12:47:35 +0200757 test_function(main_results, options.outcomes, test_args)
Valerio Settidfd7ca62023-10-09 16:30:11 +0200758
Valerio Settif6f64cf2023-10-17 12:28:26 +0200759 main_results.info("Overall results: {} warnings and {} errors",
760 main_results.warning_count, main_results.error_count)
Valerio Settif075e472023-10-17 11:03:16 +0200761
Valerio Setti8d178be2023-10-17 12:23:55 +0200762 sys.exit(0 if (main_results.error_count == 0) else 1)
Valerio Settiaaef0bc2023-10-10 09:42:13 +0200763
Gilles Peskine15c2cbf2020-06-25 18:36:28 +0200764 except Exception: # pylint: disable=broad-except
765 # Print the backtrace and exit explicitly with our chosen status.
766 traceback.print_exc()
767 sys.exit(120)
768
769if __name__ == '__main__':
770 main()