buildtest.buildsystem.builders

This file 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 BuildspecParser.

Module Contents

Classes

Builder

class buildtest.buildsystem.builders.Builder(bp, buildexecutor, filters, testdir, configuration, buildtest_system=None, rebuild=1)
_build_compilers(self, name, recipe)

This method will perform regular expression with ‘name’ field in compilers section and retrieve one or more compiler that were defined in buildtest configuration. If any compilers were retrieved we return one or more builder objects that call CompilerBuilder

Parameters
  • bp (BuildspecParser) – an instance of BuilderspecParser class

  • recipe (dict) – loaded test recipe

_generate_builders(self, recipe, name, compiler_name=None)

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 (object) – Loaded test recipe from a test section.

  • compiler_name (str, optional) – Name of compiler

Returns

A list of builder objects

_skip_tests_by_tags(self, recipe, name)

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 --tags

Parameters
  • recipe (dict) – loaded buildspec recipe as dictionary

  • name (str) – An instance of test from buildspec file

Returns

Returns a boolean True/False which determines if test is skipped.

Return type

bool

_skip_tests_run_only(self, recipe, name)

This method will skip tests based on run_only field from buildspec. Checks are performed based on conditionals and if any conditional is not met we skip test.

Parameters
  • recipe (dict, required) – loaded buildspec recipe as dictionary

  • name (str, required) – name of test from buildspec file

Returns

Returns a boolean to see if test is skipped based on run_only property

Return type

bool

get_builders(self)
get_test_names(self)

Return the list of test names for the loaded Buildspec recipe. This can be retrieved by returning a list of keys under ‘buildspecs’ property

Returns

A list of test names in buildspec file

Return type

list