-
Notifications
You must be signed in to change notification settings - Fork 756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SYCL][E2E][NFC] Fix NameError if directive fails to parse #16767
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Maetveis
temporarily deployed
to
WindowsCILock
January 24, 2025 14:04 — with
GitHub Actions
Inactive
Maetveis
temporarily deployed
to
WindowsCILock
January 24, 2025 14:27 — with
GitHub Actions
Inactive
what does the improved error message look like? |
With the following change to show the error: diff --git a/sycl/test-e2e/AbiNeutral/catch-exception.cpp b/sycl/test-e2e/AbiNeutral/catch-exception.cpp
index b2c30cabe5fe..ec8bf902243f 100644
--- a/sycl/test-e2e/AbiNeutral/catch-exception.cpp
+++ b/sycl/test-e2e/AbiNeutral/catch-exception.cpp
@@ -2,7 +2,7 @@
// RUN: %{run} %t.out
// RUN: %if preview-breaking-changes-supported %{ %{build} -fpreview-breaking-changes -D_GLIBCXX_USE_CXX11_ABI=0 -o %t2.out %}
// RUN: %if preview-breaking-changes-supported %{ %{run} %t2.out %}
-// REQUIRES: level_zero && gpu
+// REQUIRES: level_zero && gpu ||
// This test case tests if compiling works with or without
// _GLIBCXX_USE_CXX11_ABI=0. Error message before the PR> build/bin/llvm-lit sycl/test-e2e/AbiNeutral/catch-exception.cpp -a
(...)
-- Testing: 1 tests, 1 workers --
UNRESOLVED: SYCL :: AbiNeutral/catch-exception.cpp (1 of 1)
******************** TEST 'SYCL :: AbiNeutral/catch-exception.cpp' FAILED ********************
Exception during script execution:
Traceback (most recent call last):
File "intel-llvm/llvm/llvm/utils/lit/lit/BooleanExpression.py", line 32, in evaluate
return parser.parseAll()
File "intel-llvm/llvm/llvm/utils/lit/lit/BooleanExpression.py", line 152, in parseAll
self.parseOR()
File "intel-llvm/llvm/llvm/utils/lit/lit/BooleanExpression.py", line 144, in parseOR
self.parseAND()
File "intel-llvm/llvm/llvm/utils/lit/lit/BooleanExpression.py", line 131, in parseAND
self.parseNOT()
File "intel-llvm/llvm/llvm/utils/lit/lit/BooleanExpression.py", line 123, in parseNOT
raise ValueError(
ValueError: expected: '!', '(', '{{', or identifier
have: <end of expression>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "intel-llvm/llvm/llvm/utils/lit/lit/TestRunner.py", line 1973, in parseLine
self.value = self.parser(line_number, line, self.value)
File "intel-llvm/llvm/llvm/utils/lit/lit/TestRunner.py", line 2061, in _handleBooleanExpr
BooleanExpression.evaluate(s, [])
File "intel-llvm/llvm/llvm/utils/lit/lit/BooleanExpression.py", line 34, in evaluate
raise ValueError(str(e) + ("\nin expression: %r" % string))
ValueError: expected: '!', '(', '{{', or identifier
have: <end of expression>
in expression: 'level_zero && gpu ||'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "intel-llvm/llvm/sycl/test-e2e/format.py", line 63, in parseTestScript
parsed = lit.TestRunner._parseKeywords(
File "intel-llvm/llvm/llvm/utils/lit/lit/TestRunner.py", line 2121, in _parseKeywords
parser.parseLine(line_number, ln)
File "intel-llvm/llvm/llvm/utils/lit/lit/TestRunner.py", line 1975, in parseLine
raise ValueError(
ValueError: expected: '!', '(', '{{', or identifier
have: <end of expression>
in expression: 'level_zero && gpu ||'
in REQUIRES: directive on test line 5
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "intel-llvm/llvm/llvm/utils/lit/lit/worker.py", line 76, in _execute_test_handle_errors
result = test.config.test_format.execute(test, lit_config)
File "intel-llvm/llvm/sycl/test-e2e/format.py", line 150, in execute
script = self.parseTestScript(test)
File "intel-llvm/llvm/sycl/test-e2e/format.py", line 75, in parseTestScript
return lit.Test.Result(Test.UNRESOLVED, str(e))
NameError: name 'Test' is not defined
********************
********************
Unresolved Tests (1):
SYCL :: AbiNeutral/catch-exception.cpp Error message with the PR> build/bin/llvm-lit sycl/test-e2e/AbiNeutral/catch-exception.cpp -a
(...)
-- Testing: 1 tests, 1 workers --
UNRESOLVED: SYCL :: AbiNeutral/catch-exception.cpp (1 of 1)
******************** TEST 'SYCL :: AbiNeutral/catch-exception.cpp' FAILED ********************
expected: '!', '(', '{{', or identifier
have: <end of expression>
in expression: 'level_zero && gpu ||'
in REQUIRES: directive on test line 5
********************
********************
Unresolved Tests (1):
SYCL :: AbiNeutral/catch-exception.cpp |
sergey-semenov
approved these changes
Jan 27, 2025
@intel/llvm-gatekeepers please merge :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently if a test contains a malformed directive, the following exception is raised along with the original parsing error:
The test ends up as UNRESOLVED either way, but fixing it is easy and improves the error message greatly.