[llvm] 911be05 - [test][objcopy] Replace GNU sed extension with BSD compatible syntax.
Daniel Rodríguez Troitiño via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 26 17:37:06 PDT 2021
Author: Daniel Rodríguez Troitiño
Date: 2021-10-26T17:35:56-07:00
New Revision: 911be05743eb60624a12c21461766e0e7bbf6f54
URL: https://github.com/llvm/llvm-project/commit/911be05743eb60624a12c21461766e0e7bbf6f54
DIFF: https://github.com/llvm/llvm-project/commit/911be05743eb60624a12c21461766e0e7bbf6f54.diff
LOG: [test][objcopy] Replace GNU sed extension with BSD compatible syntax.
GNU sed offers the `,+4d` to delete the line a next four lines, but BSD
sed doesn't seem to support it (at least in macOS 10.15, but seems to do
in my 11.6 version).
Replace the usage of the extension with the equivalent syntax that works
both in BSD and GNU sed. I don't have a macOS 10.15 to check, but this
works in both my macOS 11.6 and Linux machines.
Differential Revision: https://reviews.llvm.org/D112583
Added:
Modified:
llvm/test/tools/llvm-objcopy/MachO/code_signature_lc.test
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-objcopy/MachO/code_signature_lc.test b/llvm/test/tools/llvm-objcopy/MachO/code_signature_lc.test
index da828a425634a..67728f887abf7 100644
--- a/llvm/test/tools/llvm-objcopy/MachO/code_signature_lc.test
+++ b/llvm/test/tools/llvm-objcopy/MachO/code_signature_lc.test
@@ -13,24 +13,26 @@
# RUN: obj2yaml %t.copy > %t.copy.yaml
## Verify that the copy still includes the load command
-# RUN: cat %t.copy.yaml | FileCheck %s --check-prefix=CHECK-COPY
+# RUN: FileCheck %s --check-prefix=CHECK-COPY < %t.copy.yaml
# CHECK-COPY: - cmd: LC_CODE_SIGNATURE
# CHECK-COPY-NEXT: cmdsize: 16
# CHECK-COPY-NEXT: dataoff: 16544
# CHECK-COPY-NEXT: datasize: 304
## Remove information changed by regeneration of load command:
-## - __LINKEDIT segment filesize may change
-## - LC_CODE_SIGNATURE command dataoff and datasize may change
+## - __LINKEDIT segment filesize may change (4 lines)
+## - LC_CODE_SIGNATURE command dataoff and datasize may change (3 lines)
## - __LINKEDIT data locations may change
+## NOTE: The {N;N;N;N;d} means delete the next four lines for BSD and GNU sed.
+## The ,+4d is a GNU extension which seems not to work in macOS 10.15
-# RUN: sed -e '/__LINKEDIT/,+4d' \
-# RUN: -e '/LC_CODE_SIGNATURE/,+3d' \
+# RUN: sed -e '/__LINKEDIT/{N;N;N;N;d;}' \
+# RUN: -e '/LC_CODE_SIGNATURE/{N;N;N;d}' \
# RUN: -e '/n_strx/d' \
# RUN: -e '/dyld_stub_binder/d' %t.yaml > %t.clean.yaml
-# RUN: sed -e '/__LINKEDIT/,+4d' \
-# RUN: -e '/LC_CODE_SIGNATURE/,+3d' \
+# RUN: sed -e '/__LINKEDIT/{N;N;N;N;d;}' \
+# RUN: -e '/LC_CODE_SIGNATURE/{N;N;N;d;}' \
# RUN: -e '/n_strx/d' \
# RUN: -e '/dyld_stub_binder/d' %t.copy.yaml > %t.copy.clean.yaml
More information about the llvm-commits
mailing list