Skip to content

Commit

Permalink
[SYCL][E2E][NFC] Fix NameError if directive fails to parse (#16767)
Browse files Browse the repository at this point in the history
Currently if a test contains a malformed directive, the following
exception is raised along with the original parsing error:
```plaintext
Exception during script execution:
(original error)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "llvm/llvm/utils/lit/lit/worker.py", line 76, in _execute_test_handle_errors
    result = test.config.test_format.execute(test, lit_config)
  File "llvm/sycl/test-e2e/format.py", line 232, in execute
    script = self.parseTestScript(test)
  File "llvm/sycl/test-e2e/format.py", line 105, in parseTestScript
    return lit.Test.Result(Test.UNRESOLVED, str(e))
NameError: name 'Test' is not defined
```
The test ends up as UNRESOLVED either way, but fixing it is easy and
improves the error message greatly.
  • Loading branch information
Maetveis authored Jan 27, 2025
1 parent 4f829bd commit 367f355
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sycl/test-e2e/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def parseTestScript(self, test):
require_script=True,
)
except ValueError as e:
return lit.Test.Result(Test.UNRESOLVED, str(e))
return lit.Test.Result(lit.Test.UNRESOLVED, str(e))
script = parsed["RUN:"] or []
assert parsed["DEFINE:"] == script
assert parsed["REDEFINE:"] == script
Expand Down

0 comments on commit 367f355

Please sign in to comment.