diff --git a/reframe/core/buildsystems.py b/reframe/core/buildsystems.py index ab387049f2..8d5cf6e37e 100644 --- a/reframe/core/buildsystems.py +++ b/reframe/core/buildsystems.py @@ -147,7 +147,11 @@ def post_build(self, buildjob): Build systems may use this information to do some post processing and provide additional, build system-specific, functionality to the users. + This function will always be executed from the test's stage directory. + .. versionadded:: 3.5.0 + .. versionchanged:: 3.5.2 + The function is executed from the stage directory. :meta private: @@ -741,7 +745,6 @@ def __init__(self): self.package_opts = {} self.prefix = 'easybuild' self._eb_modules = [] - self._prefix_save = None def emit_build_commands(self, environ): if not self.easyconfigs: @@ -755,7 +758,6 @@ def emit_build_commands(self, environ): prefix = os.path.join(os.getcwd(), self.prefix) options = ' '.join(self.options) - self._prefix_save = prefix return [f'export EASYBUILD_BUILDPATH={prefix}/build', f'export EASYBUILD_INSTALLPATH={prefix}', f'export EASYBUILD_PREFIX={prefix}', @@ -765,7 +767,8 @@ def emit_build_commands(self, environ): def post_build(self, buildjob): # Store the modules generated by EasyBuild - modulesdir = os.path.join(self._prefix_save, 'modules', 'all') + modulesdir = os.path.join(os.getcwd(), self.prefix, + 'modules', 'all') with open(buildjob.stdout) as fp: out = fp.read() diff --git a/reframe/core/pipeline.py b/reframe/core/pipeline.py index 0113945e04..017c029a8e 100644 --- a/reframe/core/pipeline.py +++ b/reframe/core/pipeline.py @@ -1300,7 +1300,8 @@ def compile_wait(self): raise BuildError(self._build_job.stdout, self._build_job.stderr, self._stagedir) - self.build_system.post_build(self._build_job) + with osext.change_dir(self._stagedir): + self.build_system.post_build(self._build_job) @_run_hooks('pre_run') @final