Skip to content
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

[llvm-lit] Add REQUIRES: shell to BOLT permission test for lit internal shell #103012

Merged
merged 1 commit into from
Aug 14, 2024

Conversation

Harini0924
Copy link
Contributor

@Harini0924 Harini0924 commented Aug 13, 2024

This patch adds the REQUIRES: shell directive to the BOLT permission test to ensure it only runs in environments with a full-featured Unix-like shell. This change is necessary because the test relies on advanced shell capabilities that are not supported by lit's internal shell.

Reasoning: The BOLT permission test uses features like running commands in the background with &, performing arithmetic operations, and handling special number formats (octal). These features require a more capable shell than what lit's internal shell provides. Without a proper shell, the test could fail or behave unpredictably.

Previously, this test was causing an AttributeError due to incompatibilities with lit's internal shell. By enforcing the use of an external shell with the REQUIRES: shell directive, this patch addresses the issue temporarily. This approach fixes the problem for now, and when we later revisit and remove the REQUIRES: shell directive, we can implement a more robust solution to fully support these features in the internal shell.

This change is relevant for enabling the lit internal shell by default, as outlined in [RFC] Enabling the Lit Internal Shell by Default

fixes: #102399

This commit adds the `REQUIRES: shell` directive to the BOLT permission test,
ensuring it is only executed in environments with a full-featured Unix-like shell.
The test relies on advanced shell features such as arithmetic evaluation and
octal interpretation, which are not supported by lit's internal shell.
By adding this requirement, we prevent test failures and ensure accurate
test execution in appropriate environments.
@llvmbot
Copy link
Collaborator

llvmbot commented Aug 13, 2024

@llvm/pr-subscribers-bolt

Author: None (Harini0924)

Changes

This patch adds the REQUIRES: shell directive to the BOLT permission test to ensure it only runs in environments with a full-featured Unix-like shell. This change is necessary because the test relies on advanced shell capabilities that are not supported by lit's internal shell.

Reasoning: The BOLT permission test uses features like running commands in the background with &, performing arithmetic operations, and handling special number formats (octal). These features require a more capable shell than what lit's internal shell provides. Without a proper shell, the test could fail or behave unpredictably.

This change is relevant for enabling the lit internal shell by default, as outlined in [RFC] Enabling the Lit Internal Shell by Default


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

1 Files Affected:

  • (modified) bolt/test/permission.test (+1-1)
diff --git a/bolt/test/permission.test b/bolt/test/permission.test
index a5a98599eb83b4..f495e87e8c7da9 100644
--- a/bolt/test/permission.test
+++ b/bolt/test/permission.test
@@ -4,7 +4,7 @@
 # This test performs a logical AND operation on the results of the `stat -c %a
 # %t.bolt` and `umask` commands (both results are displayed in octal), and
 # checks whether the result is equal to 0.
-REQUIRES: system-linux
+REQUIRES: shell, system-linux
 
 RUN: %clang %cflags %p/Inputs/hello.c -o %t -Wl,-q
 RUN: llvm-bolt %t -o %t.bolt

@Harini0924 Harini0924 changed the title [llvm-lit] Add REQUIRES: shell to BOLT permission test [llvm-lit] Add REQUIRES: shell to BOLT permission test for lit internal shell Aug 13, 2024
Copy link
Contributor

@maksfb maksfb left a comment

Choose a reason for hiding this comment

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

Thanks!

@Harini0924
Copy link
Contributor Author

CC: @ilovepi @petrhosek

@ilovepi ilovepi merged commit 4f5d866 into llvm:main Aug 14, 2024
9 checks passed
bwendling pushed a commit to bwendling/llvm-project that referenced this pull request Aug 15, 2024
…al shell (llvm#103012)

This patch adds the `REQUIRES: shell` directive to the BOLT permission
test to ensure it only runs in environments with a full-featured
Unix-like shell. This change is necessary because the test relies on
advanced shell capabilities that are not supported by lit's internal
shell.

**Reasoning:** The BOLT permission test uses features like running
commands in the background with `&`, performing arithmetic operations,
and handling special number formats (octal). These features require a
more capable shell than what lit's internal shell provides. Without a
proper shell, the test could fail or behave unpredictably.

This change is relevant for enabling the lit internal shell by default,
as outlined in [[RFC] Enabling the Lit Internal Shell by
Default](https://discourse.llvm.org/t/rfc-enabling-the-lit-internal-shell-by-default/80179)
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.

[llvm-lit] Attribute Error in lit internal shell
4 participants