Skip to content

Conversation

@boomanaiden154
Copy link
Contributor

This patch updates two LLD tests that were redirecting multiple commands
to the same FileCheck invocation to not use this strategy. This
construction is not supported by lit's internal shell and given its
rarirty, it does not make sense to add support. The workaround is to
dump the contents of multiple commands into a file and then run
FileCheck on that.

Towards #102700.

Created using spr 1.3.6
Created using spr 1.3.6

[skip ci]
Created using spr 1.3.6
@llvmbot
Copy link
Member

llvmbot commented Sep 3, 2025

@llvm/pr-subscribers-lld-elf

@llvm/pr-subscribers-lld-macho

Author: Aiden Grossman (boomanaiden154)

Changes

This patch updates two LLD tests that were redirecting multiple commands
to the same FileCheck invocation to not use this strategy. This
construction is not supported by lit's internal shell and given its
rarirty, it does not make sense to add support. The workaround is to
dump the contents of multiple commands into a file and then run
FileCheck on that.

Towards #102700.


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

2 Files Affected:

  • (modified) lld/test/ELF/lto/comdat-nodeduplicate.ll (+10-4)
  • (modified) lld/test/MachO/stabs.s (+50-39)
diff --git a/lld/test/ELF/lto/comdat-nodeduplicate.ll b/lld/test/ELF/lto/comdat-nodeduplicate.ll
index 13d4ab394813b..928da5c82e518 100644
--- a/lld/test/ELF/lto/comdat-nodeduplicate.ll
+++ b/lld/test/ELF/lto/comdat-nodeduplicate.ll
@@ -1,4 +1,4 @@
-; REQUIRES: x86, shell
+; REQUIRES: x86
 
 ;; Keep __profd_foo in a nodeduplicate comdat, despite a comdat of the same name
 ;; in a previous object file.
@@ -36,19 +36,25 @@
 
 ; RUN: ld.lld --thinlto-index-only --save-temps -u foo %t/a.bc %t/b.bc -o %t/ab
 ; RUN: FileCheck %s --check-prefix=RESOL_AB < %t/ab.resolution.txt
-; RUN: (llvm-dis < %t/b.bc && llvm-dis < %t/b.bc.thinlto.bc) | FileCheck %s --check-prefix=IR_AB
+; RUN: llvm-dis < %t/b.bc > %t.out
+; RUN: llvm-dis < %t/b.bc.thinlto.bc >> %t.out
+; RUN: FileCheck %s --check-prefix=IR_AB --input-file %t.out
 ; RUN: ld.lld -u foo %t/a.bc %t/b.bc -o %t/ab
 ; RUN: llvm-readelf -x .data %t/ab | FileCheck %s --check-prefix=DATA
 
 ; RUN: ld.lld --thinlto-index-only --save-temps -u foo %t/a.bc --start-lib %t/b.bc --end-lib -o %t/ab
 ; RUN: FileCheck %s --check-prefix=RESOL_AB < %t/ab.resolution.txt
-; RUN: (llvm-dis < %t/b.bc && llvm-dis < %t/b.bc.thinlto.bc) | FileCheck %s --check-prefix=IR_AB
+; RUN: llvm-dis < %t/b.bc > %t.out
+; RUN: llvm-dis < %t/b.bc.thinlto.bc >> %t.out
+; RUN: FileCheck %s --check-prefix=IR_AB --input-file %t.out
 ; RUN: ld.lld -u foo %t/a.bc --start-lib %t/b.bc --end-lib -o %t/ab
 ; RUN: llvm-readelf -x .data %t/ab | FileCheck %s --check-prefix=DATA
 
 ; RUN: ld.lld --thinlto-index-only --save-temps -u foo -u c %t/a.bc --start-lib %t/b.bc %t/c.bc --end-lib -o %t/abc
 ; RUN: FileCheck %s --check-prefix=RESOL_ABC < %t/abc.resolution.txt
-; RUN: (llvm-dis < %t/b.bc && llvm-dis < %t/b.bc.thinlto.bc) | FileCheck %s --check-prefix=IR_ABC
+; RUN: llvm-dis < %t/b.bc > %t.out
+; RUN: llvm-dis < %t/b.bc.thinlto.bc >> %t.out
+; RUN: FileCheck %s --check-prefix=IR_ABC --input-file %t.out
 ; RUN: ld.lld -u foo %t/a.bc --start-lib %t/b.bc %t/c.bc --end-lib -o %t/abc
 ; RUN: llvm-readelf -x .data %t/abc | FileCheck %s --check-prefix=DATA
 
diff --git a/lld/test/MachO/stabs.s b/lld/test/MachO/stabs.s
index e32b9fc5b50d6..065dccbe72b41 100644
--- a/lld/test/MachO/stabs.s
+++ b/lld/test/MachO/stabs.s
@@ -1,4 +1,4 @@
-# REQUIRES: x86, shell
+# REQUIRES: x86
 # UNSUPPORTED: system-windows
 # RUN: rm -rf %t; split-file %s %t
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o
@@ -9,61 +9,69 @@
 # RUN: env TZ=GMT touch -t "197001010000.32" %t/foo.o
 # RUN: llvm-ar rcsU %t/foo.a %t/foo.o
 
-# RUN: ZERO_AR_DATE=0 %lld -lSystem %t/test.o %t/foo.o %t/no-debug.o -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
-# RUN:   FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
-# RUN:       -D#TEST_TIME=0x10 -D#FOO_TIME=0x20
+# RUN: env ZERO_AR_DATE=0 %lld -lSystem %t/test.o %t/foo.o %t/no-debug.o -o %t/test
+# RUN: llvm-objdump --section-headers %t/test > %t.out
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
+# RUN:   -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --input-file %t.out
 
 ## Check that we emit the right modtime even when the object file is in an
 ## archive.
-# RUN: ZERO_AR_DATE=0 %lld -lSystem %t/test.o %t/foo.a %t/no-debug.o -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
-# RUN:   FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
-# RUN:       -D#TEST_TIME=0x10 -D#FOO_TIME=0x20
+# RUN: env ZERO_AR_DATE=0 %lld -lSystem %t/test.o %t/foo.a %t/no-debug.o -o %t/test
+# RUN: llvm-objdump --section-headers %t/test > %t.out
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
+# RUN:   -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --input-file %t.out
 
 ## Check that we don't emit modtimes if ZERO_AR_DATE is set.
 # RUN: env ZERO_AR_DATE=1 %lld -lSystem %t/test.o %t/foo.o %t/no-debug.o \
 # RUN:     -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
-# RUN:   FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
-# RUN:       -D#TEST_TIME=0 -D#FOO_TIME=0
+# RUN: llvm-objdump --section-headers %t/test > %t.out
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
+# RUN:   -D#TEST_TIME=0 -D#FOO_TIME=0 --input-file %t.out
 # RUN: env %lld -lSystem %t/test.o %t/foo.a %t/no-debug.o \
 # RUN:     -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
-# RUN:   FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
-# RUN:       -D#TEST_TIME=0 -D#FOO_TIME=0
+# RUN: llvm-objdump --section-headers %t/test > %t.out
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
+# RUN:   -D#TEST_TIME=0 -D#FOO_TIME=0 --input-file %t.out
 # RUN: env %lld -lSystem %t/test.o %t/no-debug.o \
 # RUN:     -all_load %t/foo.a -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
-# RUN:   FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
-# RUN:       -D#TEST_TIME=0 -D#FOO_TIME=0
+# RUN: llvm-objdump --section-headers %t/test > %t.out
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
+# RUN:   -D#TEST_TIME=0 -D#FOO_TIME=0 --input-file %t.out
 # RUN: env %lld -lSystem %t/test.o %t/no-debug.o \
 # RUN:     -force_load %t/foo.a -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
-# RUN:   FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
-# RUN:       -D#TEST_TIME=0 -D#FOO_TIME=0
+# RUN: llvm-objdump --section-headers %t/test > %t.out
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
+# RUN:   -D#TEST_TIME=0 -D#FOO_TIME=0 --input-file %t.out
 # RUN: env ZERO_AR_DATE=0 %lld -lSystem -reproducible %t/test.o %t/foo.o \
 # RUN:     %t/no-debug.o -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
-# RUN:   FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
-# RUN:       -D#TEST_TIME=0 -D#FOO_TIME=0
+# RUN: llvm-objdump --section-headers %t/test > %t.out 
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
+# RUN:   -D#TEST_TIME=0 -D#FOO_TIME=0 --input-file %t.out
 
 ## Check that we emit absolute paths to the object files in our OSO entries
 ## even if our inputs are relative paths.
-# RUN: cd %t && ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -o test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
-# RUN:   FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
-# RUN:       -D#TEST_TIME=0x10 -D#FOO_TIME=0x20
+# RUN: cd %t && env ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -o test
+# RUN: llvm-objdump --section-headers %t/test > %t.out
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
+# RUN:   -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --input-file %t.out
 
 ## Check that we emit relative path to object files in OSO entries
 ## when -oso_prefix <path> is used.
-# RUN: cd %t && ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "%t" -o %t/test-rel
+# RUN: cd %t && env ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "%t" -o %t/test-rel
 # RUN: dsymutil -s  %t/test-rel | grep 'N_OSO' | FileCheck %s  -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-PATH
-# RUN: cd %t && ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "%t/" -o %t/test-rel
+# RUN: cd %t && env ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "%t/" -o %t/test-rel
 # RUN: dsymutil -s  %t/test-rel | grep 'N_OSO' | FileCheck %s  -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-PATH-NO-SLASH
-# RUN: cd %t && ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "." -o %t/test-rel-dot
+# RUN: cd %t && env ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "." -o %t/test-rel-dot
 # RUN: dsymutil -s  %t/test-rel-dot | grep 'N_OSO' | FileCheck %s  -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-DOT
-# RUN: cd %t && ZERO_AR_DATE=0 %lld -lSystem ./test.o ./foo.o ./no-debug.o -oso_prefix "." -o %t/test-rel-dot
+# RUN: cd %t && env ZERO_AR_DATE=0 %lld -lSystem ./test.o ./foo.o ./no-debug.o -oso_prefix "." -o %t/test-rel-dot
 # RUN: dsymutil -s  %t/test-rel-dot | grep 'N_OSO' | FileCheck %s  -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-DOT-EXPLICIT
 
 ## Check that symlinks are not expanded when -oso_prefix . is used.
@@ -71,9 +79,9 @@
 # RUN: cp %t/test.o %t/foo.o %t/no-debug.o %t/private/var/folders/tmp
 # RUN: env TZ=GMT touch -t "197001010000.16" %t/private/var/folders/tmp/test.o
 # RUN: env TZ=GMT touch -t "197001010000.32" %t/private/var/folders/tmp/foo.o
-# RUN: cd %t/var/folders/tmp && ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "." -o test-rel-symlink
+# RUN: cd %t/var/folders/tmp && env ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "." -o test-rel-symlink
 # RUN: dsymutil -s  %t/private/var/folders/tmp/test-rel-symlink | grep 'N_OSO' | FileCheck %s  -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-DOT
-# RUN: cd %t/var/folders/tmp && ZERO_AR_DATE=0 %lld -lSystem ./test.o ./foo.o ./no-debug.o -oso_prefix "." -o test-rel-symlink
+# RUN: cd %t/var/folders/tmp && env ZERO_AR_DATE=0 %lld -lSystem ./test.o ./foo.o ./no-debug.o -oso_prefix "." -o test-rel-symlink
 # RUN: dsymutil -s  %t/private/var/folders/tmp/test-rel-symlink | grep 'N_OSO' | FileCheck %s  -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-DOT-EXPLICIT
 
 ## Check that we don't emit DWARF or stabs when -S is used
@@ -82,10 +90,11 @@
 ## expect to not find any entries which requires the exit code to be negated.
 # RUN: llvm-nm -ap %t/test-no-debug | not grep -e ' - '
 
-# RUN: cd %t && ZERO_AR_DATE=0 %lld -lSystem test.o foo.a no-debug.o -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
-# RUN:   FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
-# RUN:       -D#TEST_TIME=0x10 -D#FOO_TIME=0x20
+# RUN: cd %t && env ZERO_AR_DATE=0 %lld -lSystem test.o foo.a no-debug.o -o %t/test
+# RUN: llvm-objdump --section-headers %t/test > %t.out
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
+# RUN:     -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --input-file %t.out
 
 # CHECK:       Sections:
 # CHECK-NEXT:  Idx                Name
@@ -159,7 +168,9 @@
 ## when forming N_SO.
 # RUN: llvm-mc -filetype obj -triple=x86_64-apple-darwin %t/abs-path.s -o %t/abs-path.o
 # RUN: %lld %t/abs-path.o -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | FileCheck %s --check-prefix=ABS-PATH
+# RUN: llvm-objdump --section-headers %t/test > %t.out
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s --check-prefix=ABS-PATH --input-file %t.out
 # ABS-PATH:      (N_SO         ) 00      0000   0000000000000000   '/foo.cpp'
 
 #--- test.s

@llvmbot
Copy link
Member

llvmbot commented Sep 3, 2025

@llvm/pr-subscribers-lld

Author: Aiden Grossman (boomanaiden154)

Changes

This patch updates two LLD tests that were redirecting multiple commands
to the same FileCheck invocation to not use this strategy. This
construction is not supported by lit's internal shell and given its
rarirty, it does not make sense to add support. The workaround is to
dump the contents of multiple commands into a file and then run
FileCheck on that.

Towards #102700.


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

2 Files Affected:

  • (modified) lld/test/ELF/lto/comdat-nodeduplicate.ll (+10-4)
  • (modified) lld/test/MachO/stabs.s (+50-39)
diff --git a/lld/test/ELF/lto/comdat-nodeduplicate.ll b/lld/test/ELF/lto/comdat-nodeduplicate.ll
index 13d4ab394813b..928da5c82e518 100644
--- a/lld/test/ELF/lto/comdat-nodeduplicate.ll
+++ b/lld/test/ELF/lto/comdat-nodeduplicate.ll
@@ -1,4 +1,4 @@
-; REQUIRES: x86, shell
+; REQUIRES: x86
 
 ;; Keep __profd_foo in a nodeduplicate comdat, despite a comdat of the same name
 ;; in a previous object file.
@@ -36,19 +36,25 @@
 
 ; RUN: ld.lld --thinlto-index-only --save-temps -u foo %t/a.bc %t/b.bc -o %t/ab
 ; RUN: FileCheck %s --check-prefix=RESOL_AB < %t/ab.resolution.txt
-; RUN: (llvm-dis < %t/b.bc && llvm-dis < %t/b.bc.thinlto.bc) | FileCheck %s --check-prefix=IR_AB
+; RUN: llvm-dis < %t/b.bc > %t.out
+; RUN: llvm-dis < %t/b.bc.thinlto.bc >> %t.out
+; RUN: FileCheck %s --check-prefix=IR_AB --input-file %t.out
 ; RUN: ld.lld -u foo %t/a.bc %t/b.bc -o %t/ab
 ; RUN: llvm-readelf -x .data %t/ab | FileCheck %s --check-prefix=DATA
 
 ; RUN: ld.lld --thinlto-index-only --save-temps -u foo %t/a.bc --start-lib %t/b.bc --end-lib -o %t/ab
 ; RUN: FileCheck %s --check-prefix=RESOL_AB < %t/ab.resolution.txt
-; RUN: (llvm-dis < %t/b.bc && llvm-dis < %t/b.bc.thinlto.bc) | FileCheck %s --check-prefix=IR_AB
+; RUN: llvm-dis < %t/b.bc > %t.out
+; RUN: llvm-dis < %t/b.bc.thinlto.bc >> %t.out
+; RUN: FileCheck %s --check-prefix=IR_AB --input-file %t.out
 ; RUN: ld.lld -u foo %t/a.bc --start-lib %t/b.bc --end-lib -o %t/ab
 ; RUN: llvm-readelf -x .data %t/ab | FileCheck %s --check-prefix=DATA
 
 ; RUN: ld.lld --thinlto-index-only --save-temps -u foo -u c %t/a.bc --start-lib %t/b.bc %t/c.bc --end-lib -o %t/abc
 ; RUN: FileCheck %s --check-prefix=RESOL_ABC < %t/abc.resolution.txt
-; RUN: (llvm-dis < %t/b.bc && llvm-dis < %t/b.bc.thinlto.bc) | FileCheck %s --check-prefix=IR_ABC
+; RUN: llvm-dis < %t/b.bc > %t.out
+; RUN: llvm-dis < %t/b.bc.thinlto.bc >> %t.out
+; RUN: FileCheck %s --check-prefix=IR_ABC --input-file %t.out
 ; RUN: ld.lld -u foo %t/a.bc --start-lib %t/b.bc %t/c.bc --end-lib -o %t/abc
 ; RUN: llvm-readelf -x .data %t/abc | FileCheck %s --check-prefix=DATA
 
diff --git a/lld/test/MachO/stabs.s b/lld/test/MachO/stabs.s
index e32b9fc5b50d6..065dccbe72b41 100644
--- a/lld/test/MachO/stabs.s
+++ b/lld/test/MachO/stabs.s
@@ -1,4 +1,4 @@
-# REQUIRES: x86, shell
+# REQUIRES: x86
 # UNSUPPORTED: system-windows
 # RUN: rm -rf %t; split-file %s %t
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o
@@ -9,61 +9,69 @@
 # RUN: env TZ=GMT touch -t "197001010000.32" %t/foo.o
 # RUN: llvm-ar rcsU %t/foo.a %t/foo.o
 
-# RUN: ZERO_AR_DATE=0 %lld -lSystem %t/test.o %t/foo.o %t/no-debug.o -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
-# RUN:   FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
-# RUN:       -D#TEST_TIME=0x10 -D#FOO_TIME=0x20
+# RUN: env ZERO_AR_DATE=0 %lld -lSystem %t/test.o %t/foo.o %t/no-debug.o -o %t/test
+# RUN: llvm-objdump --section-headers %t/test > %t.out
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
+# RUN:   -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --input-file %t.out
 
 ## Check that we emit the right modtime even when the object file is in an
 ## archive.
-# RUN: ZERO_AR_DATE=0 %lld -lSystem %t/test.o %t/foo.a %t/no-debug.o -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
-# RUN:   FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
-# RUN:       -D#TEST_TIME=0x10 -D#FOO_TIME=0x20
+# RUN: env ZERO_AR_DATE=0 %lld -lSystem %t/test.o %t/foo.a %t/no-debug.o -o %t/test
+# RUN: llvm-objdump --section-headers %t/test > %t.out
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
+# RUN:   -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --input-file %t.out
 
 ## Check that we don't emit modtimes if ZERO_AR_DATE is set.
 # RUN: env ZERO_AR_DATE=1 %lld -lSystem %t/test.o %t/foo.o %t/no-debug.o \
 # RUN:     -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
-# RUN:   FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
-# RUN:       -D#TEST_TIME=0 -D#FOO_TIME=0
+# RUN: llvm-objdump --section-headers %t/test > %t.out
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
+# RUN:   -D#TEST_TIME=0 -D#FOO_TIME=0 --input-file %t.out
 # RUN: env %lld -lSystem %t/test.o %t/foo.a %t/no-debug.o \
 # RUN:     -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
-# RUN:   FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
-# RUN:       -D#TEST_TIME=0 -D#FOO_TIME=0
+# RUN: llvm-objdump --section-headers %t/test > %t.out
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
+# RUN:   -D#TEST_TIME=0 -D#FOO_TIME=0 --input-file %t.out
 # RUN: env %lld -lSystem %t/test.o %t/no-debug.o \
 # RUN:     -all_load %t/foo.a -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
-# RUN:   FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
-# RUN:       -D#TEST_TIME=0 -D#FOO_TIME=0
+# RUN: llvm-objdump --section-headers %t/test > %t.out
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
+# RUN:   -D#TEST_TIME=0 -D#FOO_TIME=0 --input-file %t.out
 # RUN: env %lld -lSystem %t/test.o %t/no-debug.o \
 # RUN:     -force_load %t/foo.a -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
-# RUN:   FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
-# RUN:       -D#TEST_TIME=0 -D#FOO_TIME=0
+# RUN: llvm-objdump --section-headers %t/test > %t.out
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
+# RUN:   -D#TEST_TIME=0 -D#FOO_TIME=0 --input-file %t.out
 # RUN: env ZERO_AR_DATE=0 %lld -lSystem -reproducible %t/test.o %t/foo.o \
 # RUN:     %t/no-debug.o -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
-# RUN:   FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
-# RUN:       -D#TEST_TIME=0 -D#FOO_TIME=0
+# RUN: llvm-objdump --section-headers %t/test > %t.out 
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
+# RUN:   -D#TEST_TIME=0 -D#FOO_TIME=0 --input-file %t.out
 
 ## Check that we emit absolute paths to the object files in our OSO entries
 ## even if our inputs are relative paths.
-# RUN: cd %t && ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -o test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
-# RUN:   FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
-# RUN:       -D#TEST_TIME=0x10 -D#FOO_TIME=0x20
+# RUN: cd %t && env ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -o test
+# RUN: llvm-objdump --section-headers %t/test > %t.out
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
+# RUN:   -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --input-file %t.out
 
 ## Check that we emit relative path to object files in OSO entries
 ## when -oso_prefix <path> is used.
-# RUN: cd %t && ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "%t" -o %t/test-rel
+# RUN: cd %t && env ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "%t" -o %t/test-rel
 # RUN: dsymutil -s  %t/test-rel | grep 'N_OSO' | FileCheck %s  -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-PATH
-# RUN: cd %t && ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "%t/" -o %t/test-rel
+# RUN: cd %t && env ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "%t/" -o %t/test-rel
 # RUN: dsymutil -s  %t/test-rel | grep 'N_OSO' | FileCheck %s  -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-PATH-NO-SLASH
-# RUN: cd %t && ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "." -o %t/test-rel-dot
+# RUN: cd %t && env ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "." -o %t/test-rel-dot
 # RUN: dsymutil -s  %t/test-rel-dot | grep 'N_OSO' | FileCheck %s  -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-DOT
-# RUN: cd %t && ZERO_AR_DATE=0 %lld -lSystem ./test.o ./foo.o ./no-debug.o -oso_prefix "." -o %t/test-rel-dot
+# RUN: cd %t && env ZERO_AR_DATE=0 %lld -lSystem ./test.o ./foo.o ./no-debug.o -oso_prefix "." -o %t/test-rel-dot
 # RUN: dsymutil -s  %t/test-rel-dot | grep 'N_OSO' | FileCheck %s  -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-DOT-EXPLICIT
 
 ## Check that symlinks are not expanded when -oso_prefix . is used.
@@ -71,9 +79,9 @@
 # RUN: cp %t/test.o %t/foo.o %t/no-debug.o %t/private/var/folders/tmp
 # RUN: env TZ=GMT touch -t "197001010000.16" %t/private/var/folders/tmp/test.o
 # RUN: env TZ=GMT touch -t "197001010000.32" %t/private/var/folders/tmp/foo.o
-# RUN: cd %t/var/folders/tmp && ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "." -o test-rel-symlink
+# RUN: cd %t/var/folders/tmp && env ZERO_AR_DATE=0 %lld -lSystem test.o foo.o no-debug.o -oso_prefix "." -o test-rel-symlink
 # RUN: dsymutil -s  %t/private/var/folders/tmp/test-rel-symlink | grep 'N_OSO' | FileCheck %s  -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-DOT
-# RUN: cd %t/var/folders/tmp && ZERO_AR_DATE=0 %lld -lSystem ./test.o ./foo.o ./no-debug.o -oso_prefix "." -o test-rel-symlink
+# RUN: cd %t/var/folders/tmp && env ZERO_AR_DATE=0 %lld -lSystem ./test.o ./foo.o ./no-debug.o -oso_prefix "." -o test-rel-symlink
 # RUN: dsymutil -s  %t/private/var/folders/tmp/test-rel-symlink | grep 'N_OSO' | FileCheck %s  -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --check-prefix=REL-DOT-EXPLICIT
 
 ## Check that we don't emit DWARF or stabs when -S is used
@@ -82,10 +90,11 @@
 ## expect to not find any entries which requires the exit code to be negated.
 # RUN: llvm-nm -ap %t/test-no-debug | not grep -e ' - '
 
-# RUN: cd %t && ZERO_AR_DATE=0 %lld -lSystem test.o foo.a no-debug.o -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
-# RUN:   FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
-# RUN:       -D#TEST_TIME=0x10 -D#FOO_TIME=0x20
+# RUN: cd %t && env ZERO_AR_DATE=0 %lld -lSystem test.o foo.a no-debug.o -o %t/test
+# RUN: llvm-objdump --section-headers %t/test > %t.out
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
+# RUN:     -D#TEST_TIME=0x10 -D#FOO_TIME=0x20 --input-file %t.out
 
 # CHECK:       Sections:
 # CHECK-NEXT:  Idx                Name
@@ -159,7 +168,9 @@
 ## when forming N_SO.
 # RUN: llvm-mc -filetype obj -triple=x86_64-apple-darwin %t/abs-path.s -o %t/abs-path.o
 # RUN: %lld %t/abs-path.o -o %t/test
-# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | FileCheck %s --check-prefix=ABS-PATH
+# RUN: llvm-objdump --section-headers %t/test > %t.out
+# RUN: dsymutil -s %t/test >> %t.out
+# RUN: FileCheck %s --check-prefix=ABS-PATH --input-file %t.out
 # ABS-PATH:      (N_SO         ) 00      0000   0000000000000000   '/foo.cpp'
 
 #--- test.s

Created using spr 1.3.6

[skip ci]
Created using spr 1.3.6
@boomanaiden154 boomanaiden154 changed the base branch from users/boomanaiden154/main.lld-update-tests-redirecting-multiple-commands-to-filecheck to main September 3, 2025 16:13
@boomanaiden154 boomanaiden154 merged commit 55ec637 into main Sep 3, 2025
12 of 15 checks passed
@boomanaiden154 boomanaiden154 deleted the users/boomanaiden154/lld-update-tests-redirecting-multiple-commands-to-filecheck branch September 3, 2025 16:21
@MaskRay
Copy link
Member

MaskRay commented Sep 3, 2025

It's a shame that the internal shell doesn't support (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | FileCheck %s. The split form is more verbose and less readable. env XXX=1 changes look good.

@boomanaiden154
Copy link
Contributor Author

It's a shame that the internal shell doesn't support (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | FileCheck %s. The split form is more verbose and less readable. env XXX=1 changes look good.

Yeah, it's definitely not as nice. Given there are very few tests that use this construction and rewriting them to do without isn't that much worse, I think it's hard to justify the complexity in adding support to lit's internal shell to support this construction. It might be good to revisit that at some point though.

llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Sep 3, 2025
This patch updates two LLD tests that were redirecting multiple commands
to the same FileCheck invocation to not use this strategy. This
construction is not supported by lit's internal shell and given its
rarirty, it does not make sense to add support. The workaround is to
dump the contents of multiple commands into a file and then run
FileCheck on that.

Towards #102700.

Reviewers: petrhosek, mysterymath, cmtice, ilovepi, carlocab, MaskRay

Reviewed By: carlocab, cmtice

Pull Request: llvm/llvm-project#156526
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.

6 participants