Skip to content

Filename information on syntax errors in user test files is missed #267

@vkarak

Description

@vkarak

Example traceback:

/apps/common/UES/jenkins/SLES12/easybuild/software/reframe/2.11/bin/reframe: unexpected error: invalid syntax (<unknown>, line 47)
Traceback (most recent call last):
  File "/apps/common/UES/jenkins/SLES12/easybuild/software/reframe/2.11/reframe/frontend/cli.py", line 339, in main
    checks_found = loader.load_all(system=system, resources=resources)
  File "/apps/common/UES/jenkins/SLES12/easybuild/software/reframe/2.11/reframe/frontend/loader.py", line 135, in load_all
    checks.extend(self.load_from_file(d, **check_args))
  File "/apps/common/UES/jenkins/SLES12/easybuild/software/reframe/2.11/reframe/frontend/loader.py", line 99, in load_from_file
    if not self._validate_source(filename):
  File "/apps/common/UES/jenkins/SLES12/easybuild/software/reframe/2.11/reframe/frontend/loader.py", line 64, in _validate_source
    source_tree = ast.parse(f.read())
  File "/apps/common/UES/jenkins/SLES12/easybuild/software/Python-bare/3.6.2/lib/python3.6/ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 47
    'MPICH_RDMA_ENABLED_CUDA': '1'
                             ^
SyntaxError: invalid syntax

The problems comes from how we do the AST parsing in frontend/loader.py:

        with open(filename, 'r') as f:
            source_tree = ast.parse(f.read())

        validator = RegressionCheckValidator()
        validator.visit(source_tree)
        return validator.valid

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions