Skip to content

update_test_checks: recognize %if in RUN line #108972

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

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

ElvinaYakubova
Copy link
Contributor

Recognize %if for target-specific cases in RUN line and keep only tool command with options

@llvmbot
Copy link
Member

llvmbot commented Sep 17, 2024

@llvm/pr-subscribers-testing-tools

Author: Elvina Yakubova (ElvinaYakubova)

Changes

Recognize %if for target-specific cases in RUN line and keep only tool command with options


Full diff: https://github.com/llvm/llvm-project/pull/108972.diff

1 Files Affected:

  • (modified) llvm/utils/update_test_checks.py (+7-1)
diff --git a/llvm/utils/update_test_checks.py b/llvm/utils/update_test_checks.py
index 16f3e618770b20..4bcc501f4d04a3 100755
--- a/llvm/utils/update_test_checks.py
+++ b/llvm/utils/update_test_checks.py
@@ -123,7 +123,13 @@ def main():
                 common.warn("Skipping unparsable RUN line: " + l)
                 continue
 
-            commands = [cmd.strip() for cmd in l.split("|")]
+            cropped_content = l
+            if "%if" in l:
+                match = re.search(r'%{\s*(.*?)\s*%}', l)
+                if match:
+                    cropped_content = match.group(1)
+
+            commands = [cmd.strip() for cmd in cropped_content.split("|")]
             assert len(commands) >= 2
             preprocess_cmd = None
             if len(commands) > 2:

Copy link

github-actions bot commented Sep 17, 2024

✅ With the latest revision this PR passed the Python code formatter.

Copy link
Collaborator

@RKSimon RKSimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test case?

@arichardson
Copy link
Member

It would be good to move any of this parsing to common so that the other update scripts also benfit from this (cc_test_checks, llc_test_checks, mir_test_checks).

I think the ideal solution would be to reuse lit code parse the RUN lines instead of re-implementing most of the syntax in these scripts. I started working on that a while ago but never got around to finishing it.

Recognize %if for target-specific cases in RUN line and keep only
tool command with options
@ElvinaYakubova
Copy link
Contributor Author

test case?

added test case

@ElvinaYakubova
Copy link
Contributor Author

It would be good to move any of this parsing to common so that the other update scripts also benfit from this (cc_test_checks, llc_test_checks, mir_test_checks).

I think the ideal solution would be to reuse lit code parse the RUN lines instead of re-implementing most of the syntax in these scripts. I started working on that a while ago but never got around to finishing it.

do you have an open PR or branch in your fork repo for that?

@ElvinaYakubova
Copy link
Contributor Author

gentle ping @RKSimon
Can I merge these changes now, and work on moving parsing to the common level as a separate task?

@ElvinaYakubova ElvinaYakubova merged commit c35ea62 into llvm:main Sep 23, 2024
8 checks passed
@ElvinaYakubova ElvinaYakubova deleted the fixScript branch September 23, 2024 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants