:py:mod:`buildtest.buildsystem.builders` ======================================== .. py:module:: buildtest.buildsystem.builders .. autoapi-nested-parse:: 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 :class:`buildtest.buildsystem.parser.BuildspecParser`. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: buildtest.buildsystem.builders.Builder .. py:class:: Builder(bp, buildtest_compilers, buildexecutor, filters, testdir, configuration, rebuild=1, numprocs=None, numnodes=None, executor_type=None, exclude_tags=None, strict=None, display=None) 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 :class:`buildtest.builders.script.ScriptBuilder`. Likewise for ``type: spack`` we will call :class:`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. :param bp: Instance of BuildspecParser class :type bp: buildtest.buildsystem.parser.BuildspecParser :param buildexecutor: Instance of BuildExecutor class :type buildexecutor: buildtest.executors.setup.BuildExecutor :param filters: List of filter fields specified via ``buildtest build --filter`` for filtering tests :type filters: dict :param testdir: Test directory where tests will be written which could be specified via ``buildtest build --testdir`` or configuration file :type testdir: str :param configuration: Instance of SiteConfiguration class :type configuration: buildtest.config.SiteConfiguration :param rebuild: Number of rebuild for test. This is specified via ``buildtest build --rebuild``. Defaults to 1 :type rebuild: int, option :param numprocs: List of processor values to create builder objects specified via ``buildtest build --procs`` :type numprocs: list, optional :param numnodes: List of processor values to create builder objects specified via ``buildtest build --nodes`` :type numnodes: list, optional :param executor_type: Filter test by executor type (local, batch) :type executor_type: str, optional :param exclude_tags: List of tags to exclude tests from buildspec file :type exclude_tags: list, optional :param strict: This is a boolean used for enable strict mode for test that will run the 'set' command in test. :type strict: bool, optional :param display: Show content of test or output via ``buildtest build --display`` :type display: list, optional .. py:method:: filter_by_executor_type() 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 .. py:method:: create_script_builders(name, recipe, executor, nodes=None, procs=None, compiler_name=None) Create builder objects by calling :class:`buildtest.builders.script.ScriptBuilder` class. :param name: Name of test :type name: str :param recipe: Loaded test recipe from buildtest :type recipe: dict :param executor: Name of executor :type executor: str :param nodes: A list of node configuration :type nodes: list, optional :param procs: A list of process configuration :type procs: list, optional :param compiler_name: Name of resolved compiler instance :type compiler_name: str, optional .. py:method:: create_spack_builders(name, recipe, executor, nodes=None, procs=None) Create builder objects by calling :class:`buildtest.builders.spack.SpackBuilder` class. :param name: Name of test :type name: str :param recipe: Loaded test recipe from buildtest :type recipe: dict :param executor: Name of executor :type executor: str :param nodes: A list of node configuration :type nodes: list, optional :param procs: A list of process configuration :type procs: list, optional .. py:method:: generate_builders(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. :param name: Name of test in buildspec file :type name: str :param recipe: Loaded test recipe from buildspec file :type recipe: dict :param compiler_name: Name of compiler :type compiler_name: str, optional :returns: List of builder objects .. py:method:: build(name, recipe) This method will generate a list of builders by invoking method :func:`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. :param name: name of test :type name: str :param recipe: Loaded test recipe from buildspec :type recipe: dict .. py:method:: _skip_tests_by_exclude_tags(recipe, name) 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=`` :param recipe: Loaded test recipe from buildspec :type recipe: dict :param name: Name of test :type name: str :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. :rtype: bool .. py:method:: _skip_tests_by_tags(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 --filter tags=`` :param recipe: Loaded test recipe from buildspec :type recipe: dict :param name: Name of test :type name: str :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. :rtype: bool .. py:method:: _skip_tests_by_type(recipe, name) 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=`` :param recipe: Loaded test recipe from buildspec :type recipe: dict :param name: Name of test :type name: str :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`` :rtype: bool .. py:method:: get_builders() Return a list of builder objects .. py:method:: get_filtered_buildspec() Return a list of buildspec that were filtered out