Skip to content

[mlir][polly][llvm-lit] Fixed logic for turning on external shell in lit #106458

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 3 commits into from
Aug 30, 2024

Conversation

connieyzhu
Copy link
Contributor

@connieyzhu connieyzhu commented Aug 28, 2024

For both mlir and polly, the lit internal shell is the default shell for running lit tests. However, if the user wanted to switch back to the external shell by setting LIT_USE_INTERNAL_SHELL=0, the not used in the body of the if conditional changes use_lit_shell to be True instead of the intended False. Removing not allows for this lit config to work as intended.

Fixes #106459.

For both mlir and polly, the lit internal shell is the default shell for
running lit tests. However, if the user wanted to switch back to the
external shell by setting LIT_USE_INTERNAL_SHELL=0, the "not" used in
the body of the if conditional changes use_lit_shell to be True instead
of the intended False. Removing "not" allows for this lit config to work
as intended.
@llvmbot
Copy link
Member

llvmbot commented Aug 28, 2024

@llvm/pr-subscribers-mlir

Author: Connie Zhu (connieyzhu)

Changes

For both mlir and polly, the lit internal shell is the default shell for running lit tests. However, if the user wanted to switch back to the external shell by setting LIT_USE_INTERNAL_SHELL=0, the not used in the body of the if conditional changes use_lit_shell to be True instead of the intended False. Removing not allows for this lit config to work as intended.


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

3 Files Affected:

  • (modified) mlir/test/lit.cfg.py (+1-1)
  • (modified) polly/test/UnitIsl/lit.cfg (+1-1)
  • (modified) polly/test/lit.cfg (+1-1)
diff --git a/mlir/test/lit.cfg.py b/mlir/test/lit.cfg.py
index 98d0ddd9a2be11..930e4eb0aed68f 100644
--- a/mlir/test/lit.cfg.py
+++ b/mlir/test/lit.cfg.py
@@ -23,7 +23,7 @@
 use_lit_shell = True
 lit_shell_env = os.environ.get("LIT_USE_INTERNAL_SHELL")
 if lit_shell_env:
-  use_lit_shell = not lit.util.pythonize_bool(lit_shell_env)
+    use_lit_shell = lit.util.pythonize_bool(lit_shell_env)
 
 config.test_format = lit.formats.ShTest(execute_external=not use_lit_shell)
 
diff --git a/polly/test/UnitIsl/lit.cfg b/polly/test/UnitIsl/lit.cfg
index 0944d543572d86..d91edfbaf4f944 100644
--- a/polly/test/UnitIsl/lit.cfg
+++ b/polly/test/UnitIsl/lit.cfg
@@ -22,7 +22,7 @@ config.name = 'Polly - isl unit tests'
 use_lit_shell = True
 lit_shell_env = os.environ.get("LIT_USE_INTERNAL_SHELL")
 if lit_shell_env:
-  use_lit_shell = not lit.util.pythonize_bool(lit_shell_env)
+	use_lit_shell = lit.util.pythonize_bool(lit_shell_env)
 
 config.test_format = lit.formats.ShTest(execute_external=not use_lit_shell)
 
diff --git a/polly/test/lit.cfg b/polly/test/lit.cfg
index 156c1f97f5d3ae..c3f984b5c7f127 100644
--- a/polly/test/lit.cfg
+++ b/polly/test/lit.cfg
@@ -25,7 +25,7 @@ config.name = 'Polly'
 use_lit_shell = True
 lit_shell_env = os.environ.get("LIT_USE_INTERNAL_SHELL")
 if lit_shell_env:
-  use_lit_shell = not lit.util.pythonize_bool(lit_shell_env)
+    use_lit_shell = lit.util.pythonize_bool(lit_shell_env)
 
 config.test_format = lit.formats.ShTest(execute_external=not use_lit_shell)
 

Copy link
Contributor

@boomanaiden154 boomanaiden154 left a comment

Choose a reason for hiding this comment

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

LGTM.

It seems like the two instances in polly were copied from the MLIR one and the MLIR version was inverted for whatever reason?

Given this seems to impact all the test suites where the internal shell is getting enabled, is it possible/a good idea to move the use of the environment variable to within lit (maybe as a follow up)?

@ilovepi
Copy link
Contributor

ilovepi commented Aug 29, 2024

The current RFC and plans are to incrementally adopt the internal shell as the default. The main lit config in llvm handles this correctly, but there is usually some special handling for Windows duplicated across the various subprojects. MLIR already had set it’s default for the internal shell, but this is rare for any of the subprojects to do outside of Windows. Polly had no tests with either non-portable syntax or REQUIRES: shell, so it wasn’t noticed that it didn’t work as intended when we adopted/copied the MLIR implementation.

I’m not sure there’s a good way to share the implementation settings between subprojects without using the same settings for all of them. Using the shared implementation may need to wait until we’re ready to switch them all.

@boomanaiden154
Copy link
Contributor

I’m not sure there’s a good way to share the implementation settings between subprojects without using the same settings for all of them. Using the shared implementation may need to wait until we’re ready to switch them all.

Ack. Maybe some TODOs so it's more likely to get picked up in the future?

@ilovepi
Copy link
Contributor

ilovepi commented Aug 29, 2024

Yeah that’s likely the best idea. Or at least a tracking issue.

@connieyzhu
Copy link
Contributor Author

Yeah that’s likely the best idea. Or at least a tracking issue.

@boomanaiden154 @ilovepi I added TODOs in my most recent commit and created an issue for this.

Copy link
Contributor

@ilovepi ilovepi left a comment

Choose a reason for hiding this comment

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

Thanks for filing the issue. LGTM.

@connieyzhu connieyzhu merged commit 18e5505 into llvm:main Aug 30, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[mlir][polly][llvm-lit] External shell unable to be turned on for lit tests
4 participants