[llvm] [NFC][bolt][test] Change '|&' to '2>&1 |' for lit internal shell support (PR #102402)

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 16:11:33 PDT 2024


https://github.com/connieyzhu created https://github.com/llvm/llvm-project/pull/102402

This patches changes all references to '|&' in bolt tests to instead use the '2>&1 |' syntax for better consistency across testing and so that the internal shell can be used for these tests.

>From 20287accda5a78bb64d30bca7eb6126e1fc4e6c4 Mon Sep 17 00:00:00 2001
From: Connie Zhu <connieyzhu at google.com>
Date: Wed, 7 Aug 2024 23:07:24 +0000
Subject: [PATCH] [NFC][bolt][test] Change '|&' to '2>&1 |' for lit internal
 shell support

This patches changes all references to '|&' in bolt tests to instead use
the '2>&1 |' syntax for better consistency across testing and so that
the internal shell can be used for these tests.
---
 bolt/test/X86/encoding-validation.s          | 2 +-
 bolt/test/X86/gotpcrelx.s                    | 6 +++---
 bolt/test/X86/icf-jump-tables.test           | 2 +-
 bolt/test/X86/indirect-goto-pie.test         | 2 +-
 bolt/test/X86/jump-table-func-entry.s        | 2 +-
 bolt/test/X86/keep-nops.s                    | 2 +-
 bolt/test/X86/linux-bug-table.s              | 2 +-
 bolt/test/X86/linux-orc.s                    | 8 ++++----
 bolt/test/X86/linux-pci-fixup.s              | 2 +-
 bolt/test/X86/linux-smp-locks.s              | 4 ++--
 bolt/test/X86/linux-static-calls.s           | 4 ++--
 bolt/test/X86/linux-static-keys.s            | 8 ++++----
 bolt/test/X86/pt_gnu_relro.s                 | 2 +-
 bolt/test/X86/unclaimed-jt-entries.s         | 2 +-
 bolt/test/X86/vararg.test                    | 2 +-
 bolt/test/runtime/X86/unclaimed-jt-entries.s | 2 +-
 16 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/bolt/test/X86/encoding-validation.s b/bolt/test/X86/encoding-validation.s
index 0c716abc4cc0c..c013612964895 100644
--- a/bolt/test/X86/encoding-validation.s
+++ b/bolt/test/X86/encoding-validation.s
@@ -2,7 +2,7 @@
 
 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t.o
 # RUN: ld.lld %t.o -o %t.exe -q
-# RUN: llvm-bolt %t.exe --relocs -o %t.out --check-encoding |& FileCheck %s
+# RUN: llvm-bolt %t.exe --relocs -o %t.out --check-encoding 2>&1 | FileCheck %s
 
   .text
   .globl _start
diff --git a/bolt/test/X86/gotpcrelx.s b/bolt/test/X86/gotpcrelx.s
index 6dec125c6a72b..c5bc7ac7d0d47 100644
--- a/bolt/test/X86/gotpcrelx.s
+++ b/bolt/test/X86/gotpcrelx.s
@@ -10,11 +10,11 @@
 # RUN: ld.lld %t.o -o %t.pie.exe -q -pie
 # RUN: ld.lld %t.o -o %t.no-relax.exe -q --no-relax
 # RUN: llvm-bolt %t.exe --relocs -o %t.out --print-cfg --print-only=_start \
-# RUN:   |& FileCheck --check-prefix=BOLT %s
+# RUN:   2>&1 | FileCheck --check-prefix=BOLT %s
 # RUN: llvm-bolt %t.pie.exe -o %t.null --print-cfg --print-only=_start \
-# RUN:   |& FileCheck --check-prefix=PIE-BOLT %s
+# RUN:   2>&1 | FileCheck --check-prefix=PIE-BOLT %s
 # RUN: llvm-bolt %t.no-relax.exe -o %t.null --print-cfg --print-only=_start \
-# RUN:   |& FileCheck --check-prefix=NO-RELAX-BOLT %s
+# RUN:   2>&1 | FileCheck --check-prefix=NO-RELAX-BOLT %s
 # RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex \
 # RUN:   %t.out | FileCheck --check-prefix=DISASM %s
 
diff --git a/bolt/test/X86/icf-jump-tables.test b/bolt/test/X86/icf-jump-tables.test
index 41820008b0133..57137b79bc317 100644
--- a/bolt/test/X86/icf-jump-tables.test
+++ b/bolt/test/X86/icf-jump-tables.test
@@ -4,7 +4,7 @@
 # REQUIRES: system-linux
 
 # RUN: %clang %cflags -O1 -g %p/../Inputs/icf-jump-tables.c -o %t.exe -Wl,-q
-# RUN: llvm-bolt %t.exe --icf -o %t.bolt |& FileCheck %s
+# RUN: llvm-bolt %t.exe --icf -o %t.bolt 2>&1 | FileCheck %s
 
 ## Check that BOLT successfully folded a function with jump table:
 # CHECK: ICF folded {{.*}}. {{[^0]}} functions had jump tables.
diff --git a/bolt/test/X86/indirect-goto-pie.test b/bolt/test/X86/indirect-goto-pie.test
index 81cff9a32fbbd..3311c1aec061c 100644
--- a/bolt/test/X86/indirect-goto-pie.test
+++ b/bolt/test/X86/indirect-goto-pie.test
@@ -6,7 +6,7 @@ REQUIRES: x86_64-linux
 
 RUN: %clang %S/Inputs/indirect_goto.c -o %t -fpic -pie -Wl,-q
 RUN: not llvm-bolt %t -o %t.bolt --relocs=1 --print-cfg --print-only=main \
-RUN:   |& FileCheck %s
+RUN:   2>&1 | FileCheck %s
 
 ## Check that processing works if main() is skipped.
 RUN: llvm-bolt %t -o %t.bolt --relocs=1 --skip-funcs=main
diff --git a/bolt/test/X86/jump-table-func-entry.s b/bolt/test/X86/jump-table-func-entry.s
index 77b444d520a1f..b34e7142785d4 100644
--- a/bolt/test/X86/jump-table-func-entry.s
+++ b/bolt/test/X86/jump-table-func-entry.s
@@ -7,7 +7,7 @@
 # RUN: %clang %cflags %t.o -o %t.exe -no-pie -Wl,-q
 
 # RUN: llvm-bolt %t.exe --print-normalized --print-only=foo -o %t.out \
-# RUN:   |& FileCheck %s
+# RUN:   2>&1 | FileCheck %s
 
 
 
diff --git a/bolt/test/X86/keep-nops.s b/bolt/test/X86/keep-nops.s
index 37da2ff07b9b7..ddd34ce61d620 100644
--- a/bolt/test/X86/keep-nops.s
+++ b/bolt/test/X86/keep-nops.s
@@ -5,7 +5,7 @@
 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t.o
 # RUN: ld.lld %t.o -o %t.exe -q
 # RUN: llvm-bolt %t.exe -o %t.bolt.exe --keep-nops --relocs --print-finalized \
-# RUN:   |& FileCheck --check-prefix=CHECK-BOLT %s
+# RUN:   2>&1 | FileCheck --check-prefix=CHECK-BOLT %s
 # RUN: llvm-objdump -d %t.bolt.exe | FileCheck %s
 
   .text
diff --git a/bolt/test/X86/linux-bug-table.s b/bolt/test/X86/linux-bug-table.s
index 63f70a0b35d9f..07a4729ade737 100644
--- a/bolt/test/X86/linux-bug-table.s
+++ b/bolt/test/X86/linux-bug-table.s
@@ -15,7 +15,7 @@
 ## Verify bug entry bindings again after unreachable code elimination.
 
 # RUN: llvm-bolt %t.out -o %t.out.1 --print-only=_start --print-normalized \
-# RUN:   |& FileCheck --check-prefix=CHECK-REOPT %s
+# RUN:   2>&1 | FileCheck --check-prefix=CHECK-REOPT %s
 
 # CHECK:      BOLT-INFO: Linux kernel binary detected
 # CHECK:      BOLT-INFO: parsed 2 bug table entries
diff --git a/bolt/test/X86/linux-orc.s b/bolt/test/X86/linux-orc.s
index 5f2096278e92d..1b0e681b1dbf9 100644
--- a/bolt/test/X86/linux-orc.s
+++ b/bolt/test/X86/linux-orc.s
@@ -9,7 +9,7 @@
 
 ## Verify reading contents of ORC sections.
 
-# RUN: llvm-bolt %t.exe --dump-orc -o /dev/null |& FileCheck %s \
+# RUN: llvm-bolt %t.exe --dump-orc -o /dev/null 2>&1 | FileCheck %s \
 # RUN:   --check-prefix=CHECK-ORC
 
 # CHECK-ORC: 	    BOLT-INFO: ORC unwind information:
@@ -27,19 +27,19 @@
 ## Verify ORC bindings to instructions.
 
 # RUN: llvm-bolt %t.exe --print-normalized --dump-orc --print-orc -o %t.out \
-# RUN:   --keep-nops=0 --bolt-info=0 |& FileCheck %s
+# RUN:   --keep-nops=0 --bolt-info=0 2>&1 | FileCheck %s
 
 
 ## Verify ORC bindings after rewrite.
 
 # RUN: llvm-bolt %t.out -o %t.out.1 --print-normalized --print-orc \
-# RUN:   |& FileCheck %s
+# RUN:   2>&1 | FileCheck %s
 
 ## Verify ORC binding after rewrite when some of the functions are skipped.
 
 # RUN: llvm-bolt %t.exe -o %t.out --skip-funcs=bar --bolt-info=0 --keep-nops=0
 # RUN: llvm-bolt %t.out -o %t.out.1 --print-normalized --print-orc \
-# RUN:   |& FileCheck %s
+# RUN:   2>&1 | FileCheck %s
 
 # CHECK:      BOLT-INFO: Linux kernel binary detected
 # CHECK:      BOLT-INFO: parsed 9 ORC entries
diff --git a/bolt/test/X86/linux-pci-fixup.s b/bolt/test/X86/linux-pci-fixup.s
index a574ba84c4df1..42504c108d339 100644
--- a/bolt/test/X86/linux-pci-fixup.s
+++ b/bolt/test/X86/linux-pci-fixup.s
@@ -3,7 +3,7 @@
 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
 # RUN: %clang %cflags -nostdlib %t.o -o %t.exe \
 # RUN:   -Wl,--image-base=0xffffffff80000000,--no-dynamic-linker,--no-eh-frame-hdr,--no-pie
-# RUN: llvm-bolt %t.exe --print-normalized -o %t.out |& FileCheck %s
+# RUN: llvm-bolt %t.exe --print-normalized -o %t.out 2>&1 | FileCheck %s
 
 ## Check that BOLT correctly parses the Linux kernel .pci_fixup section and
 ## verify that PCI fixup hook in the middle of a function is detected.
diff --git a/bolt/test/X86/linux-smp-locks.s b/bolt/test/X86/linux-smp-locks.s
index 5f4410d14fc6b..50d9e632b1172 100644
--- a/bolt/test/X86/linux-smp-locks.s
+++ b/bolt/test/X86/linux-smp-locks.s
@@ -7,11 +7,11 @@
 # RUN: %clang %cflags -nostdlib %t.o -o %t.exe \
 # RUN:   -Wl,--image-base=0xffffffff80000000,--no-dynamic-linker,--no-eh-frame-hdr,--no-pie
 # RUN: llvm-bolt %t.exe --print-normalized --keep-nops=0 --bolt-info=0 -o %t.out \
-# RUN:   |& FileCheck %s
+# RUN:   2>&1 | FileCheck %s
 
 ## Check the output of BOLT with NOPs removed.
 
-# RUN: llvm-bolt %t.out -o %t.out.1 --print-normalized |& FileCheck %s
+# RUN: llvm-bolt %t.out -o %t.out.1 --print-normalized 2>&1 | FileCheck %s
 
 # CHECK:      BOLT-INFO: Linux kernel binary detected
 # CHECK:      BOLT-INFO: parsed 2 SMP lock entries
diff --git a/bolt/test/X86/linux-static-calls.s b/bolt/test/X86/linux-static-calls.s
index caf95e1c03227..ce90f4bb79c09 100644
--- a/bolt/test/X86/linux-static-calls.s
+++ b/bolt/test/X86/linux-static-calls.s
@@ -9,11 +9,11 @@
 ## Verify static calls bindings to instructions.
 
 # RUN: llvm-bolt %t.exe --print-normalized -o %t.out --keep-nops=0 \
-# RUN:   --bolt-info=0 |& FileCheck %s
+# RUN:   --bolt-info=0 2>&1 | FileCheck %s
 
 ## Verify the bindings again on the rewritten binary with nops removed.
 
-# RUN: llvm-bolt %t.out -o %t.out.1 --print-normalized |& FileCheck %s
+# RUN: llvm-bolt %t.out -o %t.out.1 --print-normalized 2>&1 | FileCheck %s
 
 # CHECK:      BOLT-INFO: Linux kernel binary detected
 # CHECK:      BOLT-INFO: parsed 2 static call entries
diff --git a/bolt/test/X86/linux-static-keys.s b/bolt/test/X86/linux-static-keys.s
index fb419e0f76275..0bd17a375d882 100644
--- a/bolt/test/X86/linux-static-keys.s
+++ b/bolt/test/X86/linux-static-keys.s
@@ -11,17 +11,17 @@
 ## Verify static keys jump bindings to instructions.
 
 # RUN: llvm-bolt %t.exe --print-normalized -o %t.out --keep-nops=0 \
-# RUN:   --bolt-info=0 |& FileCheck %s
+# RUN:   --bolt-info=0 2>&1 | FileCheck %s
 
 ## Verify that profile is matched correctly.
 
 # RUN: llvm-bolt %t.exe --print-normalized -o %t.out --keep-nops=0 \
-# RUN:   --bolt-info=0 --data %t.fdata |& \
-# RUN:   FileCheck --check-prefix=CHECK-FDATA %s
+# RUN:   --bolt-info=0 --data %t.fdata 2>&1 \
+# RUN:   | FileCheck --check-prefix=CHECK-FDATA %s
 
 ## Verify the bindings again on the rewritten binary with nops removed.
 
-# RUN: llvm-bolt %t.out -o %t.out.1 --print-normalized |& FileCheck %s
+# RUN: llvm-bolt %t.out -o %t.out.1 --print-normalized 2>&1 | FileCheck %s
 
 # CHECK:      BOLT-INFO: Linux kernel binary detected
 # CHECK:      BOLT-INFO: parsed 2 static keys jump entries
diff --git a/bolt/test/X86/pt_gnu_relro.s b/bolt/test/X86/pt_gnu_relro.s
index d7cfad5f954be..ff897b96e0909 100644
--- a/bolt/test/X86/pt_gnu_relro.s
+++ b/bolt/test/X86/pt_gnu_relro.s
@@ -22,7 +22,7 @@
 # READELF: 04 .got
 
 # RUN: llvm-bolt %t.exe --relocs -o %t.null -v=1 \
-# RUN:   |& FileCheck --check-prefix=BOLT %s
+# RUN:   2>&1 | FileCheck --check-prefix=BOLT %s
 # BOLT: BOLT-INFO: marking .got as GNU_RELRO
 
   .globl _start
diff --git a/bolt/test/X86/unclaimed-jt-entries.s b/bolt/test/X86/unclaimed-jt-entries.s
index 2d56167286c36..1102e4ae413e2 100644
--- a/bolt/test/X86/unclaimed-jt-entries.s
+++ b/bolt/test/X86/unclaimed-jt-entries.s
@@ -18,7 +18,7 @@
 
 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
 # RUN: %clang %cflags -no-pie %t.o -o %t.exe -Wl,-q
-# RUN: llvm-bolt %t.exe -v=1 -o %t.out |& FileCheck %s
+# RUN: llvm-bolt %t.exe -v=1 -o %t.out 2>&1 | FileCheck %s
 
 # CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in main
 # CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in main
diff --git a/bolt/test/X86/vararg.test b/bolt/test/X86/vararg.test
index 0b8668a842ed4..296c739c6e113 100644
--- a/bolt/test/X86/vararg.test
+++ b/bolt/test/X86/vararg.test
@@ -5,7 +5,7 @@
 REQUIRES: x86_64-linux
 
 RUN: %clangxx %cxxflags -no-pie %p/../Inputs/vararg.s -o %t -Wl,-q
-RUN: llvm-bolt %t -o %t.null --print-cfg --print-only=.*printf.* |& FileCheck %s
+RUN: llvm-bolt %t -o %t.null --print-cfg --print-only=.*printf.* 2>&1 | FileCheck %s
 
 CHECK: IsSimple    : 0
 CHECK: Entry Point
diff --git a/bolt/test/runtime/X86/unclaimed-jt-entries.s b/bolt/test/runtime/X86/unclaimed-jt-entries.s
index d0691d256ba04..1725fb808efbf 100644
--- a/bolt/test/runtime/X86/unclaimed-jt-entries.s
+++ b/bolt/test/runtime/X86/unclaimed-jt-entries.s
@@ -18,7 +18,7 @@
 
 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
 # RUN: %clang %cflags %S/Inputs/unclaimed-jt-entries.c -no-pie %t.o -o %t.exe -Wl,-q
-# RUN: llvm-bolt %t.exe -v=1 -o %t.out --sequential-disassembly |& FileCheck %s
+# RUN: llvm-bolt %t.exe -v=1 -o %t.out --sequential-disassembly 2>&1 | FileCheck %s
 
 # CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in func
 # CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in func



More information about the llvm-commits mailing list