From f32ef78d8d7c8ed40c81effcb4d91c9a977bf2e9 Mon Sep 17 00:00:00 2001 From: rafael Date: Thu, 25 Mar 2021 09:01:17 +0100 Subject: [PATCH 1/4] add path to build-stdout --- reframe/core/buildsystems.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reframe/core/buildsystems.py b/reframe/core/buildsystems.py index ab387049f2..d48c445967 100644 --- a/reframe/core/buildsystems.py +++ b/reframe/core/buildsystems.py @@ -766,7 +766,8 @@ def post_build(self, buildjob): # Store the modules generated by EasyBuild modulesdir = os.path.join(self._prefix_save, 'modules', 'all') - with open(buildjob.stdout) as fp: + with open(os.path.join(self._prefix_save, '..', + buildjob.stdout)) as fp: out = fp.read() self._eb_modules = [ From 750fec44c108148925d0d9db34df88d42bce2e9f Mon Sep 17 00:00:00 2001 From: rafael Date: Thu, 25 Mar 2021 09:24:15 +0100 Subject: [PATCH 2/4] refactor --- reframe/core/buildsystems.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/reframe/core/buildsystems.py b/reframe/core/buildsystems.py index d48c445967..a615321700 100644 --- a/reframe/core/buildsystems.py +++ b/reframe/core/buildsystems.py @@ -753,9 +753,9 @@ def emit_build_commands(self, environ): for key, val in self.package_opts.items(): self.options.append(f'--package-{key}={val}') - prefix = os.path.join(os.getcwd(), self.prefix) + self._prefix_save = os.getcwd() + prefix = os.path.join(self._prefix_save, 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,9 +765,9 @@ 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') - with open(os.path.join(self._prefix_save, '..', - buildjob.stdout)) as fp: + modulesdir = os.path.join(self._prefix_save, self.prefix, + 'modules', 'all') + with open(os.path.join(self._prefix_save, buildjob.stdout)) as fp: out = fp.read() self._eb_modules = [ From bfc78b35b7a120d3cbbd386f8237c0273a68c305 Mon Sep 17 00:00:00 2001 From: rafael Date: Fri, 2 Apr 2021 13:22:38 +0200 Subject: [PATCH 3/4] change dir before post_build --- reframe/core/buildsystems.py | 8 +++----- reframe/core/pipeline.py | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/reframe/core/buildsystems.py b/reframe/core/buildsystems.py index a615321700..58ae0ef24c 100644 --- a/reframe/core/buildsystems.py +++ b/reframe/core/buildsystems.py @@ -741,7 +741,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: @@ -753,8 +752,7 @@ def emit_build_commands(self, environ): for key, val in self.package_opts.items(): self.options.append(f'--package-{key}={val}') - self._prefix_save = os.getcwd() - prefix = os.path.join(self._prefix_save, self.prefix) + prefix = os.path.join(os.getcwd(), self.prefix) options = ' '.join(self.options) return [f'export EASYBUILD_BUILDPATH={prefix}/build', f'export EASYBUILD_INSTALLPATH={prefix}', @@ -765,9 +763,9 @@ def emit_build_commands(self, environ): def post_build(self, buildjob): # Store the modules generated by EasyBuild - modulesdir = os.path.join(self._prefix_save, self.prefix, + modulesdir = os.path.join(os.getcwd(), self.prefix, 'modules', 'all') - with open(os.path.join(self._prefix_save, buildjob.stdout)) as fp: + with open(buildjob.stdout) as fp: out = fp.read() self._eb_modules = [ diff --git a/reframe/core/pipeline.py b/reframe/core/pipeline.py index e38365b171..c0a66c7296 100644 --- a/reframe/core/pipeline.py +++ b/reframe/core/pipeline.py @@ -1297,7 +1297,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 From d85d55a16e4c9c87a9fd41347093aded80e13744 Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Fri, 2 Apr 2021 15:51:46 +0200 Subject: [PATCH 4/4] Update internal documentation --- reframe/core/buildsystems.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/reframe/core/buildsystems.py b/reframe/core/buildsystems.py index 58ae0ef24c..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: