Skip to content

ReFrame crashes if sourcesdir is set to None in class body #1869

@vkarak

Description

@vkarak

The following test fails:

import reframe as rfm
import reframe.utility.sanity as sn


class Base(rfm.RunOnlyRegressionTest):
    valid_systems = ['*']
    valid_prog_environs = ['*']
    sourcesdir = None
    executable = 'echo'

    @rfm.run_before('run')
    def set_exec_opts(self):
        self.executable_opts = [self.name]

    @rfm.run_before('sanity')
    def set_sanity_check(self):
        self.sanity_patterns = sn.assert_found(rf'{self.name}', self.stdout)


@rfm.simple_test
class T0(Base):
    pass

Stacktrace:

Traceback (most recent call last):
  File "/Users/karakasv/Repositories/reframe/reframe/core/decorators.py", line 56, in _instantiate_all
    ret.append(_instantiate(cls, args))
  File "/Users/karakasv/Repositories/reframe/reframe/core/decorators.py", line 43, in _instantiate
    return cls(_rfm_use_params=True)
  File "/Users/karakasv/Repositories/reframe/reframe/core/meta.py", line 199, in __call__
    obj = cls.__new__(cls, *args, **kwargs)
  File "/Users/karakasv/Repositories/reframe/reframe/core/pipeline.py", line 790, in __new__
    obj._rfm_init(name, prefix)
  File "/Users/karakasv/Repositories/reframe/reframe/core/pipeline.py", line 834, in _rfm_init
    if not os.path.isdir(os.path.join(self._prefix, self.sourcesdir)):
  File "/usr/local/Cellar/python@3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/posixpath.py", line 90, in join
    genericpath._check_arg_types('join', a, *p)
  File "/usr/local/Cellar/python@3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/genericpath.py", line 152, in _check_arg_types
    raise TypeError(f'{funcname}() argument must be str, bytes, or '
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'

The fix seems to be easy.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions