[lld] d1e57ee - [lld-macho] Avoid requiring shell in tests

Jez Ng via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 11 10:28:47 PST 2021


Author: Jez Ng
Date: 2021-03-11T13:28:14-05:00
New Revision: d1e57ee99aa815e51bf2541fa4d3e965d7f4b8de

URL: https://github.com/llvm/llvm-project/commit/d1e57ee99aa815e51bf2541fa4d3e965d7f4b8de
DIFF: https://github.com/llvm/llvm-project/commit/d1e57ee99aa815e51bf2541fa4d3e965d7f4b8de.diff

LOG: [lld-macho] Avoid requiring shell in tests

There are 3 remaining tests that still have `REQUIRE: shell`:
* color-diagnostics.test -- seems necessary for ANSI escape sequence support
* stabs.s -- the shell part could be removed, but I don't think we can support
  the test on Windows anyway due to its reliance on `touch` to set the modtime
* framework.s -- uses symlinks, I'm not sure this works on Windows

Addresses PR49512.

Reviewed By: #lld-macho, alexshap

Differential Revision: https://reviews.llvm.org/D98395

Added: 
    

Modified: 
    lld/test/MachO/arm64-relocs.s
    lld/test/MachO/dylink-lazy.s
    lld/test/MachO/function-starts.s
    lld/test/MachO/segments.s

Removed: 
    


################################################################################
diff  --git a/lld/test/MachO/arm64-relocs.s b/lld/test/MachO/arm64-relocs.s
index 5f22479bb068..bf5931a797e2 100644
--- a/lld/test/MachO/arm64-relocs.s
+++ b/lld/test/MachO/arm64-relocs.s
@@ -1,7 +1,9 @@
-# REQUIRES: aarch64, shell
+# REQUIRES: aarch64
 # RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %s -o %t.o
 # RUN: %lld -dylib -arch arm64 -lSystem -o %t %t.o
-# RUN: (llvm-objdump --syms %t; llvm-objdump --macho -d --section=__const %t) | FileCheck %s
+# RUN: llvm-objdump --syms %t > %t.objdump
+# RUN: llvm-objdump --macho -d --section=__const %t >> %t.objdump
+# RUN: FileCheck %s < %t.objdump
 
 # CHECK-LABEL: SYMBOL TABLE:
 # CHECK-DAG:   [[#%x,PTR_1:]] l     O __DATA_CONST,__const _ptr_1

diff  --git a/lld/test/MachO/dylink-lazy.s b/lld/test/MachO/dylink-lazy.s
index a5f275e55f08..62f70f1f9ece 100644
--- a/lld/test/MachO/dylink-lazy.s
+++ b/lld/test/MachO/dylink-lazy.s
@@ -1,4 +1,4 @@
-# REQUIRES: x86, shell
+# REQUIRES: x86
 # RUN: mkdir -p %t
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %p/Inputs/libhello.s \
 # RUN:   -o %t/libhello.o
@@ -19,8 +19,9 @@
 ## symbol each entry points to. So we call objdump twice in order to get the
 ## disassembly of __text and the bind tables first, which allow us to check for
 ## matching entries in __stubs.
-# RUN: (llvm-objdump -d --no-show-raw-insn --syms --rebase --bind --lazy-bind %t/dylink-lazy; \
-# RUN:  llvm-objdump -D --no-show-raw-insn %t/dylink-lazy) | FileCheck %s
+# RUN: llvm-objdump -d --no-show-raw-insn --syms --rebase --bind --lazy-bind %t/dylink-lazy > %t/objdump
+# RUN: llvm-objdump -D --no-show-raw-insn %t/dylink-lazy >> %t/objdump
+# RUN: FileCheck %s < %t/objdump
 
 # RUN: %lld -pie -o %t/dylink-lazy-pie \
 # RUN:   -L%t -lhello -lgoodbye %t/dylink-lazy.o -lSystem

diff  --git a/lld/test/MachO/function-starts.s b/lld/test/MachO/function-starts.s
index 42d7d8c09053..ce2d4299cbdd 100644
--- a/lld/test/MachO/function-starts.s
+++ b/lld/test/MachO/function-starts.s
@@ -1,11 +1,12 @@
-# REQUIRES: x86, shell
-# UNSUPPORTED: system-windows
+# REQUIRES: x86
 
 # RUN: split-file %s %t
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/basic.s -o %t.basic.o
 # RUN: %lld %t.basic.o -o %t.basic
-# RUN: (llvm-objdump --syms %t.basic; llvm-objdump --macho --function-starts %t.basic) | FileCheck %s --check-prefix=BASIC
+# RUN: llvm-objdump --syms %t.basic > %t.objdump
+# RUN: llvm-objdump --macho --function-starts %t.basic >> %t.objdump
+# RUN: FileCheck %s --check-prefix=BASIC < %t.objdump
 
 # BASIC:      SYMBOL TABLE:
 # BASIC-NEXT: [[#%x,MAIN:]] g F __TEXT,__text _main
@@ -17,7 +18,9 @@
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/alias.s -o %t.alias.o
 # RUN: %lld %t.alias.o -o %t.alias
-# RUN: (llvm-objdump --syms  %t.alias; llvm-objdump --macho --function-starts %t.alias) | FileCheck %s --check-prefix=ALIAS
+# RUN: llvm-objdump --syms  %t.alias > %t.objdump
+# RUN: llvm-objdump --macho --function-starts %t.alias >> %t.objdump
+# RUN: FileCheck %s --check-prefix=ALIAS < %t.objdump
 
 # ALIAS:      SYMBOL TABLE:
 # ALIAS-NEXT: [[#%x,F2:]] l F __TEXT,__text _f2

diff  --git a/lld/test/MachO/segments.s b/lld/test/MachO/segments.s
index 4b57f79d1ee8..f4ac4c80a176 100644
--- a/lld/test/MachO/segments.s
+++ b/lld/test/MachO/segments.s
@@ -1,7 +1,10 @@
-# REQUIRES: x86, shell
+# REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
 # RUN: %lld -o %t %t.o
-# RUN: (llvm-readobj --macho-segment %t; echo "Total file size"; wc -c %t) | FileCheck %s
+# RUN: llvm-readobj --macho-segment %t > %t.out
+# RUN: echo "Total file size" >> %t.out
+# RUN: wc -c %t >> %t.out
+# RUN: FileCheck %s < %t.out
 
 ## These two segments must always be present at the start of an executable.
 # CHECK-NOT:  Segment {


        


More information about the llvm-commits mailing list