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)¶
The BuilderBase is an abstract class that implements common functions for any kind of builder.
- type = compiler¶
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
- _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
- param modules
‘module’ property specified in buildspec used for loading/swapping modules
- type modules
This method is responsible for setting cc, fc, cxx class variables based on compiler selection. The order of precedence is
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.
This method resolves full path to source file, it checks for absolute path first before checking relative path that is relative to Buildspec recipe.
This method builds the run command which refers to how to run the generated binary after compilation.
This method is responsible for generating test script for compiler schema. The method
generate_scriptis 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.
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)¶
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.