From bb86c7a4cf025aeb2fee2592fea80fb3f68c97d1 Mon Sep 17 00:00:00 2001 From: Javier Otero Date: Wed, 17 Mar 2021 17:32:59 +0100 Subject: [PATCH 1/3] Fix sourcesdir reset --- reframe/core/pipeline.py | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/reframe/core/pipeline.py b/reframe/core/pipeline.py index 6545f97aea..78586ea91e 100644 --- a/reframe/core/pipeline.py +++ b/reframe/core/pipeline.py @@ -842,8 +842,6 @@ def _rfm_init(self, name=None, prefix=None): # Static directories of the regression check self._prefix = os.path.abspath(prefix) - if not os.path.isdir(os.path.join(self._prefix, self.sourcesdir)): - self.sourcesdir = None # Runtime information of the test self._current_partition = None @@ -1186,7 +1184,7 @@ def compile(self): raise PipelineError('no programming environment set') # Copy the check's resources to the stage directory - if self.sourcesdir: + if os.path.isdir(os.path.join(self._prefix, self.sourcesdir)): try: commonpath = os.path.commonpath([self.sourcesdir, self.sourcepath]) @@ -1200,11 +1198,10 @@ def compile(self): f'interpreted as relative to it' ) - if osext.is_url(self.sourcesdir): - self._clone_to_stagedir(self.sourcesdir) - else: - self._copy_to_stagedir(os.path.join(self._prefix, - self.sourcesdir)) + self._copy_to_stagedir(os.path.join(self._prefix, + self.sourcesdir)) + elif osext.is_url(self.sourcesdir): + self._clone_to_stagedir(self.sourcesdir) # Verify the sourcepath and determine the sourcepath in the stagedir if (os.path.isabs(self.sourcepath) or @@ -1899,12 +1896,12 @@ def run(self): The resources of the test are copied to the stage directory and the rest of execution is delegated to the :func:`RegressionTest.run()`. ''' - if self.sourcesdir: - if osext.is_url(self.sourcesdir): - self._clone_to_stagedir(self.sourcesdir) - else: - self._copy_to_stagedir(os.path.join(self._prefix, - self.sourcesdir)) + + if os.path.isdir(os.path.join(self._prefix, self.sourcesdir)): + self._copy_to_stagedir(os.path.join(self._prefix, + self.sourcesdir)) + elif osext.is_url(self.sourcesdir): + self._clone_to_stagedir(self.sourcesdir) super().run.__wrapped__(self) From bc62e0ff15abfdaf78bcb58163e553c84fd5fba6 Mon Sep 17 00:00:00 2001 From: Javier Otero Date: Wed, 17 Mar 2021 17:49:20 +0100 Subject: [PATCH 2/3] Make the unit tests happy again --- reframe/core/pipeline.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reframe/core/pipeline.py b/reframe/core/pipeline.py index 6545f97aea..881a7609fb 100644 --- a/reframe/core/pipeline.py +++ b/reframe/core/pipeline.py @@ -842,7 +842,8 @@ def _rfm_init(self, name=None, prefix=None): # Static directories of the regression check self._prefix = os.path.abspath(prefix) - if not os.path.isdir(os.path.join(self._prefix, self.sourcesdir)): + if (not os.path.isdir(os.path.join(self._prefix, self.sourcesdir)) and + not osext.is_url(self.sourcesdir)): self.sourcesdir = None # Runtime information of the test From ae2566edd157081d9a9e16d9be8033dd021d015e Mon Sep 17 00:00:00 2001 From: Javier Otero Date: Wed, 17 Mar 2021 18:04:29 +0100 Subject: [PATCH 3/3] Do revert the changes for real now. --- reframe/core/pipeline.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/reframe/core/pipeline.py b/reframe/core/pipeline.py index 07ef3f1bb6..881a7609fb 100644 --- a/reframe/core/pipeline.py +++ b/reframe/core/pipeline.py @@ -1187,7 +1187,7 @@ def compile(self): raise PipelineError('no programming environment set') # Copy the check's resources to the stage directory - if os.path.isdir(os.path.join(self._prefix, self.sourcesdir)): + if self.sourcesdir: try: commonpath = os.path.commonpath([self.sourcesdir, self.sourcepath]) @@ -1201,10 +1201,11 @@ def compile(self): f'interpreted as relative to it' ) - self._copy_to_stagedir(os.path.join(self._prefix, - self.sourcesdir)) - elif osext.is_url(self.sourcesdir): - self._clone_to_stagedir(self.sourcesdir) + if osext.is_url(self.sourcesdir): + self._clone_to_stagedir(self.sourcesdir) + else: + self._copy_to_stagedir(os.path.join(self._prefix, + self.sourcesdir)) # Verify the sourcepath and determine the sourcepath in the stagedir if (os.path.isabs(self.sourcepath) or @@ -1899,12 +1900,12 @@ def run(self): The resources of the test are copied to the stage directory and the rest of execution is delegated to the :func:`RegressionTest.run()`. ''' - - if os.path.isdir(os.path.join(self._prefix, self.sourcesdir)): - self._copy_to_stagedir(os.path.join(self._prefix, - self.sourcesdir)) - elif osext.is_url(self.sourcesdir): - self._clone_to_stagedir(self.sourcesdir) + if self.sourcesdir: + if osext.is_url(self.sourcesdir): + self._clone_to_stagedir(self.sourcesdir) + else: + self._copy_to_stagedir(os.path.join(self._prefix, + self.sourcesdir)) super().run.__wrapped__(self)