pcvs.helpers.criterion module

class pcvs.helpers.criterion.Combination(crit_desc, dict_comb)[source]

Bases: object

A combination maps the actual concretization from multiple criterion.

For a given set of criterion, a Combination carries, for each kind, its associated value in order to generate the appropriate test

get(k, dflt=None)[source]

Retrieve the actual value for a given combination element :type k: :param k: value to retrieve :type k: str :type dflt: :param dflt: default value if k is not a valid key :type: object


Get the combination dict.


the whole combination dict.

Return type:



Translate the actual combination is tuple of three elements, based on the representation of each criterion in the test semantic. It builds tokens to provide to properly build the test command. It can either be:

  1. an environment variable to export before the test to run (gathering system-scope and program-scope elements)

  2. a runtime argument

  3. a program-level argument (through custom-made iterators)


Translate the combination into a dictionary.


configuration in the shape of a python dict

Return type:



Translate the actual combination in a pretty-format string. This is mainly used to generate actual test names

class pcvs.helpers.criterion.Criterion(name, description, local=False, numeric=False)[source]

Bases: object

A Criterion is the representation of a component each program (i.e. test binary) should be run against. A criterion comes with a range of possible values, each leading to a different test


Check if the given value has an alias for the current criterion. An alias is the value replacement to use instead of the one defined by test configuration. This allows to split test logic from runtime semantics.

For instance, TEs manipulate ‘ib’ as a value to depict the ‘infiniband’ network layer. But once the test has to be built, the term will change depending on the runtime carrying it, the value may be different from a runtime to another :type val: :param val: string with aliases to be replaced


Return the exact string mapping this criterion, according to the specification. (is it aliased ? should the option be put before/after the value?…) :type val: :param val: value to add with prefix :type val: str :return: values with aliases replaced :rtype: str


Browse values for the current criterion and make it ready to generate combinations

property expanded

Update the calling Criterion with the interesection of the current range of possible values with the one given as a parameters.

This is used to refine overriden per-TE criterion according to system-wide’s


Should this criterion be ignored from the current TE generaiton ?


Is the current set of values empty May lead to errors, as it may indicates no common values has been found between user and system specifications


Is this criterion targeting a component used as an env var ?


Is the criterion local ? (program-scoped)

property max_value
property min_value
property name

Get the name attribute of this criterion.


name of this criterion

Return type:


property numeric

Get the numeric attribute of this criterion.


numeric of this criterion

Return type:


Replace the value of the criterion using a descriptor containing the

said value


desc (dict) – descriptor supposedly containing a ``value``entry


Check for any inconsistent values in the current Criterion.

Currently, only scalar items or dict (=> sequence) are allowed. Will raise an exeption in case of inconsistency (Maybe this should be managed in another way through the error handling)

property subtitle

Get the subtitle attribute of this criterion.


subtitle of this criterion

Return type:


property values

Get the value attribute of this criterion.


values of this criterion

Return type:


class pcvs.helpers.criterion.Serie(dict_of_criterion)[source]

Bases: object

A serie ties a test expression (TEDescriptor) to the possible values which can be taken for each criterion to build test sets. A serie can be seen as the Combination generator for a given TEDescriptor


Generator to build each combination

classmethod register_sys_criterion(system_criterion)[source]

copy/inherit the system-defined criterion (shortcut to global config)


Initialise system-wide criterions

TODO: Move this function elsewhere.


Check if dict is a valid criterion combination .


dic (dict) – dict to check


True if dic is a valid combination

Return type: