buildtest.builders.compiler
¶
Module Contents¶
Classes¶
This is a subclass of BuilderBase used for building test that uses |
- class buildtest.builders.compiler.CompilerBuilder(name, recipe, buildspec, buildexecutor, executor, configuration, compiler=None, testdir=None, numprocs=None, numnodes=None)[source]¶
Bases:
buildtest.builders.base.BuilderBase
This is a subclass of BuilderBase used for building test that uses
type: compiler
in the buildspec.The BuilderBase provides common functions for any builder. The builder is an instance of BuilderBase. The initializer method will setup the builder attributes based on input test by
name
parameter.- Parameters
name (str) – Name of test in buildspec recipe
recipe (str) – The loaded test section from the buildspec file
buildspec (str) – Full path to buildspec file
buildexecutor (
buildtest.executors.setup.BuildExecutor
) – An instance of BuildExecutor class used for accessing executorstestdir (str) – Test directory where tests are written. Must be full path on filesystem.
- type = compiler¶
- lang_ext_table¶
- cc¶
- cxx¶
- fc¶
- ldflags¶
- cflags¶
- cxxflags¶
- fflags¶
- cppflags¶
- setup()[source]¶
The setup method is responsible for process compiler section, getting modules pre_build, post_build, pre_run, post_run section and generate compilation and run command. This method invokes other methods and set values in class variables. This method is called by self.generate_script method.
- generate_script()[source]¶
This method is responsible for generating test script for compiler schema. The method
generate_script
is implemented in each subclass because implementation on test generation differs across schema types.This method will add the lines into list which comprise content of test. The method will return a list containing lines of test script.
- _resolve_source()[source]¶
This method resolves full path to source file, it checks for absolute path first before checking relative path that is relative to Buildspec recipe.
- _detect_lang(sourcefile)[source]¶
This method will return the Programming Language based by looking up file extension of source file.
- _compile_cmd()[source]¶
This method generates the compilation line and returns the output as a list. The compilation line depends on the the language detected that is stored in variable
self.lang
.
- _run_cmd()[source]¶
This method builds the run command which refers to how to run the generated binary after compilation.
- _process_compiler_config()[source]¶
This method is responsible for setting cc, fc, cxx class variables based on compiler selection. The order of precedence is
config
,default
, then buildtest setting. Compiler settings in ‘config’ takes highest precedence, this overrides any configuration in ‘default’. Finally we resort to compiler configuration in buildtest setting if none defined. This method is responsible for setting cc, fc, cxx, cflags, cxxflags, fflags, ldflags, and cppflags.