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 :param k: value to retrieve :type k: str :param dflt: default value if k is not a valid key :type: object

items()[source]

Get the combination dict.

Returns

the whole combination dict.

Return type

dict

translate_to_command()[source]

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_to_dict()[source]

Translate the combination into a dictionary.

Returns

configuration in the shape of a python dict

Return type

dict

translate_to_str()[source]

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

aliased_value(val)[source]

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 :param val: string with aliases to be replaced

concretize_value(val='')[source]

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

expand_values()[source]

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

intersect(other)[source]

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

is_discarded()[source]

Should this criterion be ignored from the current TE generaiton ?

is_empty()[source]

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_env()[source]

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

is_local()[source]

Is the criterion local ? (program-scoped)

property name

Get the name attribute of this criterion.

Returns

name of this criterion

Return type

str

property numeric

Get the numeric attribute of this criterion.

Returns

numeric of this criterion

Return type

str

override(desc)[source]
Replace the value of the criterion using a descriptor containing the

said value

Parameters

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

property subtitle

Get the subtitle attribute of this criterion.

Returns

subtitle of this criterion

Return type

str

property values

Get the value attribute of this criterion.

Returns

values of this criterion

Return type

list

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

generate()[source]

Generator to build each combination

classmethod register_sys_criterion(system_criterion)[source]

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

pcvs.helpers.criterion.initialize_from_system()[source]

Initialise system-wide criterions

TODO: Move this function elsewhere.

pcvs.helpers.criterion.valid_combination(dic)[source]

Check if dict is a valid criterion combination .

Parameters

dic (dict) – dict to check

Returns

True if dic is a valid combination

Return type

bool