Rework depends.py to run more tests with hashes
The test coverage reduction introduced in dc25cee lowered the coverage of hash tests due to intertwining dependencies. This commit introduces a new class for building a domain using both the complementary and exclusive classes. Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
parent
fe46949686
commit
228b12ce54
1 changed files with 21 additions and 8 deletions
|
@ -278,7 +278,13 @@ An option O is turned off if config_settings[O] is False."""
|
||||||
for dep in REVERSE_DEPENDENCIES.get(key, []):
|
for dep in REVERSE_DEPENDENCIES.get(key, []):
|
||||||
config_settings[dep] = False
|
config_settings[dep] = False
|
||||||
|
|
||||||
class ExclusiveDomain: # pylint: disable=too-few-public-methods
|
class BaseDomain: # pylint: disable=too-few-public-methods, unused-argument
|
||||||
|
"""A base class for all domains."""
|
||||||
|
def __init__(self, symbols, commands, exclude):
|
||||||
|
"""Initialize the jobs container"""
|
||||||
|
self.jobs = []
|
||||||
|
|
||||||
|
class ExclusiveDomain(BaseDomain): # pylint: disable=too-few-public-methods
|
||||||
"""A domain consisting of a set of conceptually-equivalent settings.
|
"""A domain consisting of a set of conceptually-equivalent settings.
|
||||||
Establish a list of configuration symbols. For each symbol, run a test job
|
Establish a list of configuration symbols. For each symbol, run a test job
|
||||||
with this symbol set and the others unset."""
|
with this symbol set and the others unset."""
|
||||||
|
@ -289,7 +295,7 @@ of symbols and disable the others.
|
||||||
Each job runs the specified commands.
|
Each job runs the specified commands.
|
||||||
If exclude is a regular expression, skip generated jobs whose description
|
If exclude is a regular expression, skip generated jobs whose description
|
||||||
would match this regular expression."""
|
would match this regular expression."""
|
||||||
self.jobs = []
|
super().__init__(symbols, commands, exclude)
|
||||||
base_config_settings = {}
|
base_config_settings = {}
|
||||||
for symbol in symbols:
|
for symbol in symbols:
|
||||||
base_config_settings[symbol] = False
|
base_config_settings[symbol] = False
|
||||||
|
@ -304,22 +310,29 @@ would match this regular expression."""
|
||||||
job = Job(description, config_settings, commands)
|
job = Job(description, config_settings, commands)
|
||||||
self.jobs.append(job)
|
self.jobs.append(job)
|
||||||
|
|
||||||
class ComplementaryDomain: # pylint: disable=too-few-public-methods
|
class ComplementaryDomain(BaseDomain): # pylint: disable=too-few-public-methods
|
||||||
"""A domain consisting of a set of loosely-related settings.
|
"""A domain consisting of a set of loosely-related settings.
|
||||||
Establish a list of configuration symbols. For each symbol, run a test job
|
Establish a list of configuration symbols. For each symbol, run a test job
|
||||||
with this symbol unset."""
|
with this symbol unset."""
|
||||||
def __init__(self, symbols, commands):
|
def __init__(self, symbols, commands, exclude=None):
|
||||||
"""Build a domain for the specified list of configuration symbols.
|
"""Build a domain for the specified list of configuration symbols.
|
||||||
Each job in the domain disables one of the specified symbols.
|
Each job in the domain disables one of the specified symbols.
|
||||||
Each job runs the specified commands."""
|
Each job runs the specified commands."""
|
||||||
self.jobs = []
|
super().__init__(symbols, commands, exclude)
|
||||||
for symbol in symbols:
|
for symbol in symbols:
|
||||||
description = '!' + symbol
|
description = '!' + symbol
|
||||||
|
if exclude and re.match(exclude, description):
|
||||||
|
continue
|
||||||
config_settings = {symbol: False}
|
config_settings = {symbol: False}
|
||||||
turn_off_dependencies(config_settings)
|
turn_off_dependencies(config_settings)
|
||||||
job = Job(description, config_settings, commands)
|
job = Job(description, config_settings, commands)
|
||||||
self.jobs.append(job)
|
self.jobs.append(job)
|
||||||
|
|
||||||
|
class DualDomain(ExclusiveDomain, ComplementaryDomain): # pylint: disable=too-few-public-methods
|
||||||
|
"""A domain that contains both the ExclusiveDomain and BaseDomain tests"""
|
||||||
|
def __init__(self, symbols, commands, exclude=None):
|
||||||
|
super().__init__(symbols=symbols, commands=commands, exclude=exclude)
|
||||||
|
|
||||||
class CipherInfo: # pylint: disable=too-few-public-methods
|
class CipherInfo: # pylint: disable=too-few-public-methods
|
||||||
"""Collect data about cipher.h."""
|
"""Collect data about cipher.h."""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -369,9 +382,9 @@ class DomainData:
|
||||||
# Hash algorithms. Exclude configurations with only one
|
# Hash algorithms. Exclude configurations with only one
|
||||||
# hash which is obsolete. Run the test suites. Exclude
|
# hash which is obsolete. Run the test suites. Exclude
|
||||||
# SHA512 and SHA256, as these are tested with SHA384 and SHA224.
|
# SHA512 and SHA256, as these are tested with SHA384 and SHA224.
|
||||||
'hashes': ExclusiveDomain(hash_symbols, build_and_test,
|
'hashes': DualDomain(hash_symbols, build_and_test,
|
||||||
exclude=r'MBEDTLS_(MD|RIPEMD|SHA1_|SHA256_|SHA512_)\
|
exclude=r'MBEDTLS_(MD|RIPEMD|SHA1_|SHA256_|SHA512_)' \
|
||||||
|!MBEDTLS_(SHA256_|SHA512_)'),
|
'|!MBEDTLS_(SHA256_|SHA512_)'),
|
||||||
# Key exchange types. Only build the library and the sample
|
# Key exchange types. Only build the library and the sample
|
||||||
# programs.
|
# programs.
|
||||||
'kex': ExclusiveDomain(key_exchange_symbols,
|
'kex': ExclusiveDomain(key_exchange_symbols,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue