buildtest.buildsystem.compilerbuilder
¶
Module Contents¶
Classes¶
The BuilderBase is an abstract class that implements common functions for |
- class buildtest.buildsystem.compilerbuilder.CompilerBuilder(name, recipe, buildspec, buildexecutor, executor, configuration, compiler=None, testdir=None)¶
Bases:
buildtest.buildsystem.base.BuilderBase
The BuilderBase is an abstract class that implements common functions for any kind of builder.
- cc¶
- cflags¶
- cppflags¶
- cxx¶
- cxxflags¶
- fc¶
- fflags¶
- lang_ext_table¶
- ldflags¶
- type = compiler¶
- _compile_cmd(self)¶
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
.
- _detect_lang(self, sourcefile)¶
This method will return the Programming Language based by looking up file extension of source file.
- _get_modules(self, modules)¶
Return a list of module command as a list of instructions based on
module
property.- param modules
‘module’ property specified in buildspec used for loading/swapping modules
- type modules
object
- _process_compiler_config(self)¶
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.
- _resolve_source(self)¶
This method resolves full path to source file, it checks for absolute path first before checking relative path that is relative to Buildspec recipe.
- _run_cmd(self)¶
This method builds the run command which refers to how to run the generated binary after compilation.
- generate_script(self)¶
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.
- get_cc(self)¶
- get_cflags(self)¶
- get_cppfilags(self)¶
- get_cxx(self)¶
- get_cxxflags(self)¶
- get_fc(self)¶
- get_fflags(self)¶
- get_ldflags(self)¶
- get_path(self)¶
This method returns the full path for C, C++, Fortran compilers
- set_cc(self, cc)¶
- set_cflags(self, cflags)¶
- set_cppflags(self, cppflags)¶
- set_cxx(self, cxx)¶
- set_cxxflags(self, cxxflags)¶
- set_fc(self, fc)¶
- set_fflags(self, fflags)¶
- set_ldflags(self, ldflags)¶
- setup(self)¶
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.