From 367f35573e2d93651256486783b8f2c8c547cd8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9sz=C3=A1ros=20Gergely?= Date: Mon, 27 Jan 2025 17:28:39 +0100 Subject: [PATCH] [SYCL][E2E][NFC] Fix NameError if directive fails to parse (#16767) 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. --- sycl/test-e2e/format.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/test-e2e/format.py b/sycl/test-e2e/format.py index a9e98a4ed8037..812fec75ab732 100644 --- a/sycl/test-e2e/format.py +++ b/sycl/test-e2e/format.py @@ -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