Skip to content

[BOLT][test] Removed the use of parentheses in BOLT tests with lit internal shell #105720

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
Aug 23, 2024

Conversation

Harini0924
Copy link
Contributor

This patch addresses compatibility issues with the lit internal shell by removing the use of subshell execution (parentheses and subshell syntax) in the BOLT tests. The lit internal shell does not support parentheses, so the tests have been refactored to use separate command invocations, with outputs redirected to temporary files where necessary.

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

fixes: #102401

Replaced the use of subshell execution with separate command invocations in the `bolt` tests. Ensured compatibility with the lit internal shell by avoiding parentheses and subshell syntax. Updated tests to use temporary files for simplified command structures.
@llvmbot
Copy link
Member

llvmbot commented Aug 22, 2024

@llvm/pr-subscribers-bolt

Author: None (Harini0924)

Changes

This patch addresses compatibility issues with the lit internal shell by removing the use of subshell execution (parentheses and subshell syntax) in the BOLT tests. The lit internal shell does not support parentheses, so the tests have been refactored to use separate command invocations, with outputs redirected to temporary files where necessary.

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

fixes: #102401


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

2 Files Affected:

  • (modified) bolt/test/X86/end-symbol.test (+4-2)
  • (modified) bolt/test/X86/instrumentation-eh_frame_hdr.cpp (+3-2)
diff --git a/bolt/test/X86/end-symbol.test b/bolt/test/X86/end-symbol.test
index 18c11a8a749fc4..69087b7f2597e0 100644
--- a/bolt/test/X86/end-symbol.test
+++ b/bolt/test/X86/end-symbol.test
@@ -1,7 +1,9 @@
 # RUN: yaml2obj %p/Inputs/plt-sec.yaml &> %t.exe
 # RUN: llvm-bolt %t.exe -o %t.out
-# RUN: (llvm-readelf --program-headers %t.out | grep LOAD | tail -n 1 ; llvm-nm %t.out) \
-# RUN:   | FileCheck %s
+
+# RUN: llvm-readelf --program-headers %t.out | grep LOAD | tail -n 1 > %t.load
+# RUN: llvm-nm %t.out >> %t.load
+# RUN: FileCheck %s < %t.load
 
 ## Check that llvm-bolt correctly updates _end symbol to match the end of the
 ## last loadable segment.
diff --git a/bolt/test/X86/instrumentation-eh_frame_hdr.cpp b/bolt/test/X86/instrumentation-eh_frame_hdr.cpp
index 4ed8be42cd0f37..b360530099ce32 100644
--- a/bolt/test/X86/instrumentation-eh_frame_hdr.cpp
+++ b/bolt/test/X86/instrumentation-eh_frame_hdr.cpp
@@ -6,8 +6,9 @@
 // RUN: %clangxx %cxxflags -static -Wl,-q %s -o %t.exe -Wl,--entry=_start
 // RUN: llvm-bolt %t.exe -o %t.instr -instrument \
 // RUN:   --instrumentation-file=%t.fdata -instrumentation-sleep-time=1
-// RUN: (llvm-readelf -SW %t.instr | grep -v bolt; llvm-readelf -lW %t.instr | \
-// RUN:   grep LOAD | tail -n 1) | FileCheck %s
+// RUN: llvm-readelf -SW %t.instr | grep -v bolt > %t.sections
+// RUN: llvm-readelf -lW %t.instr | grep LOAD | tail -n 1 >> %t.sections
+// RUN: FileCheck %s < %t.sections
 
 // CHECK: {{.*}} .eh_frame_hdr PROGBITS [[#%x, EH_ADDR:]]
 // CHECK: LOAD 0x[[#%x, LD_OFFSET:]] 0x[[#%x, LD_VADDR:]] 0x[[#%x, LD_FSIZE:]]

@Harini0924
Copy link
Contributor Author

CC: @ilovepi @petrhosek

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 Harini0924 merged commit 7f37932 into llvm:main Aug 23, 2024
9 checks passed
cjdb pushed a commit to cjdb/llvm-project that referenced this pull request Aug 23, 2024
…ternal shell (llvm#105720)

This patch addresses compatibility issues with the lit internal shell by
removing the use of subshell execution (parentheses and subshell syntax)
in the `BOLT` tests. The lit internal shell does not support
parentheses, so the tests have been refactored to use separate command
invocations, with outputs redirected to temporary files where necessary.

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)

fixes: llvm#102401
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] lit internal shell fail to execute parentheses syntax
3 participants