buildtest.buildsystem.builders

This module implements the Builder class that is responsible for getting builders from a buildspec file. The Builder class is invoked once buildspec file has parsed validation via buildtest.buildsystem.parser.BuildspecParser.

Module Contents

Classes

Builder

The Builder class creates builder objects based on parsed buildspecs.

class buildtest.buildsystem.builders.Builder(bp, buildtest_compilers, buildexecutor, filters, testdir, configuration, buildtest_system, rebuild=1, numprocs=None, numnodes=None, executor_type=None, exclude_tags=None)[source]

The Builder class creates builder objects based on parsed buildspecs.

The builder class is created based on the ‘type’ field in the test. If test contains type: script we will create builder by calling buildtest.builders.script.ScriptBuilder. Likewise for type: spack we will call buildtest.builders.spack.SpackBuilder.

Based on a loaded Buildspec file, return the correct builder for each based on the type. Each type is associated with a known Builder class.

Parameters:
  • bp (buildtest.buildsystem.parser.BuildspecParser) – Instance of BuildspecParser class

  • buildexecutor (buildtest.executors.setup.BuildExecutor) – Instance of BuildExecutor class

  • filters (dict) – List of filter fields specified via buildtest build --filter for filtering tests

  • testdir (str) – Test directory where tests will be written which could be specified via buildtest build --testdir or configuration file

  • configuration (buildtest.config.SiteConfiguration) – Instance of SiteConfiguration class

  • buildtest_system (buildtest.system.BuildTestSystem) – Instance of BuildTestSystem class

  • rebuild (int, option) – Number of rebuild for test. This is specified via buildtest build --rebuild. Defaults to 1

  • numprocs (list, optional) – List of processor values to create builder objects specified via buildtest build --procs

  • numnodes (list, optional) – List of processor values to create builder objects specified via buildtest build --nodes

  • executor_type (str, optional) – Filter test by executor type (local, batch)

  • exclude_tags (list, optional) – List of tags to exclude tests from buildspec file

filter_by_executor_type()[source]

This method will filter test by executor type when using buildtest build --executor-type. The filter can be made based on local or batch executors

create_script_builders(name, recipe, executor, nodes=None, procs=None, compiler_name=None)[source]

Create builder objects by calling buildtest.builders.script.ScriptBuilder class.

Parameters:
  • name (str) – Name of test

  • recipe (dict) – Loaded test recipe from buildtest

  • executor (str) – Name of executor

  • nodes (list, optional) – A list of node configuration

  • procs (list, optional) – A list of process configuration

  • compiler_name (str, optional) – Name of resolved compiler instance

create_spack_builders(name, recipe, executor, nodes=None, procs=None)[source]

Create builder objects by calling buildtest.builders.spack.SpackBuilder class.

Parameters:
  • name (str) – Name of test

  • recipe (dict) – Loaded test recipe from buildtest

  • executor (str) – Name of executor

  • nodes (list, optional) – A list of node configuration

  • procs (list, optional) – A list of process configuration

generate_builders(recipe, name, compiler_name=None)[source]

This method is responsible for generating builders by applying regular expression specified by executor field in buildspec with list of executors. If their is a match we generate a builder.

Parameters:
  • name (str) – Name of test in buildspec file

  • recipe (dict) – Loaded test recipe from buildspec file

  • compiler_name (str, optional) – Name of compiler

Returns:

List of builder objects

build(name, recipe)[source]

This method will generate a list of builders by invoking method buildtest.buildsystem.builders.Builder.generate_builders(). If compilers is specified in buildspec we will perform regular expression to search for compilers based on name and retrieve one or more compiler that were defined in buildtest configuration. If any compilers were retrieved we return one or more builder objects based on compiler name.

Parameters:
  • name (str) – name of test

  • recipe (dict) – Loaded test recipe from buildspec

_skip_tests_by_exclude_tags(recipe, name)[source]

This method determines if test should be skipped based on tag names specified in exclude field that is specified on command line via buildtest build --exclude tags=<TAGNAME>

Parameters:
  • recipe (dict) – Loaded test recipe from buildspec

  • name (str) – Name of test

Returns:

False if buildtest build --exclude tags is not specified. If specified we return True if tags field is not in test recipe or there is a matching tag.

Return type:

bool

_skip_tests_by_tags(recipe, name)[source]

This method determines if test should be skipped based on tag names specified in filter field that is specified on command line via buildtest build --filter tags=<TAGNAME>

Parameters:
  • recipe (dict) – Loaded test recipe from buildspec

  • name (str) – Name of test

Returns:

False if buildtest build --filter tags is not specified. If specified we return True if tags field is not in test recipe or there is a matching tag.

Return type:

bool

_skip_tests_by_type(recipe, name)[source]

This method determines if test should be skipped based on type field specified in filter field that is specified on command line via buildtest build --filter type=<SCHEMATYPE>

Parameters:
  • recipe (dict) – Loaded test recipe from buildspec

  • name (str) – Name of test

Returns:

False if buildtest build --filter type is not specified. If there is a match with input filter and type field in test we return True

Return type:

bool

get_builders()[source]

Return a list of builder objects

get_filtered_buildspec()[source]

Return a list of buildspec that were filtered out