-
Notifications
You must be signed in to change notification settings - Fork 117
Description
The current way of building source codes from within ReFrame is very restrictive, since it was designed for very simple codes. If ReFrame is to be used as a proper CI tool for HPC apps, we need to better support the classic build systems. Here's a proposed class hierarchy for the new design:
+-----------------+ +-------------------+
| Environment | | BuildSystem |
+-----------------+ uses +-------------------+
| modules | +-----+ environ |
| variables | | | prebuild_cmd |
| | | | postbuild_cmd |
+--------+--------+ | | |
^ | +-------------------+
|inherits | | build() |
| | +---+-----+-----+---+
+--------+--------+ | ^ ^ ^
| ProgEnvironment <-------+ | | +-----------------------------------------------+
+-----------------+ | +--------------------------+ |
| cxxflags | | | |
| ... | +---+---------------+ +---------+---------+ +---------+--------+
| | | CMake | | ConfigureMake | | Make |
+-----------------+ +-------------------+ +-------------------+ +------------------+
| config_opts | | | | |
| ... | | | | |
| | | | | |
+-------------------+ +-------------------+ +------------------+
The key change here is that the responsibility of building is moved from the programming environment to a new abstract class, called BuildSystem. This will provide a build() (perhaps also a prebuild() and postbuild()) that the framework will use to build the code of the test. Concrete subclasses will implement different build system by taking care of the different steps. Subclasses may provide additional fields for configuring their build process. The desired user interface is the following:
self.sourcepath = 'mycode/'
self.build_system = 'CMake'
self.build_system.config_opts = '-DUSE_MYLIB'Using Python descriptors we can do the magic to create a build system instance by directly assigning a string to it.
Backward compatibility
The framework internally will only use a build system to build a test's code. The current building process can be implemented with two different build systems:
- A
SingleSourcebuild system that would simply compile a single source file. - A
Makebuild system that would use make to compile a directory.
The prebuild_cmd and postbuild_cmd RegressionTest attributes can be used to set the corresponding attributes from the BuildSystem.