[llvm] 5f56da3 - [llvm-install-name-tool] Tighten some path checks

Shoaib Meenai via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 30 17:25:06 PDT 2020


Author: Shoaib Meenai
Date: 2020-06-30T17:20:00-07:00
New Revision: 5f56da3763ac6d5cc38b474fb05a2c89542d207e

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

LOG: [llvm-install-name-tool] Tighten some path checks

Just having --implicit-check-not=/usr breaks when the LLVM checkout path
contains '/usr', since llvm-objdump prints out the path to the input
file in the first line. Tighten the checks by adding the 'name' prefix
that's used when printing load command payloads. An alternative would be
to redirect the input file into llvm-objdump, in which case it prints
out 'a.out' as the file name, but I'm not sure how reliable that
behavior is.

Added: 
    

Modified: 
    llvm/test/tools/llvm-objcopy/MachO/install-name-tool-change.test
    llvm/test/tools/llvm-objcopy/MachO/install-name-tool-id.test

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-objcopy/MachO/install-name-tool-change.test b/llvm/test/tools/llvm-objcopy/MachO/install-name-tool-change.test
index 12e1dff92627..8869af217998 100644
--- a/llvm/test/tools/llvm-objcopy/MachO/install-name-tool-change.test
+++ b/llvm/test/tools/llvm-objcopy/MachO/install-name-tool-change.test
@@ -5,62 +5,62 @@
 ## Specifying -change once:
 # RUN: cp %t %t.copy
 # RUN: llvm-install-name-tool -change /usr/dylib/LOAD /usr/long/long/dylib/LOAD %t.copy
-# RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE --implicit-check-not=/usr
+# RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE --implicit-check-not='name /usr'
 
-# CHANGE: /usr/long/long/dylib/LOAD
-# CHANGE: /usr/dylib/WEAK
+# CHANGE: name /usr/long/long/dylib/LOAD
+# CHANGE: name /usr/dylib/WEAK
 
 ## Specifying -change multiple times:
 # RUN: cp %t %t.copy
 # RUN: llvm-install-name-tool -change /usr/dylib/WEAK /usr/sh/WEAK \
 # RUN:                        -change /usr/dylib/LOAD /usr/sh/LOAD  %t.copy
-# RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE-MULTIPLE --implicit-check-not=/usr
+# RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE-MULTIPLE --implicit-check-not='name /usr'
 
-# CHANGE-MULTIPLE: /usr/sh/LOAD
-# CHANGE-MULTIPLE: /usr/sh/WEAK
+# CHANGE-MULTIPLE: name /usr/sh/LOAD
+# CHANGE-MULTIPLE: name /usr/sh/WEAK
 
 ## Changing same dependent library name multiple times:
 # RUN: cp %t %t.copy
 # RUN: llvm-install-name-tool -change /usr/dylib/LOAD /usr/LOAD \
 # RUN:                        -change /usr/dylib/LOAD /usr/XXXX %t.copy
-# RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE-REPEAT --implicit-check-not=/usr
+# RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE-REPEAT --implicit-check-not='name /usr'
 
-# CHANGE-REPEAT: /usr/LOAD
-# CHANGE-REPEAT: /usr/dylib/WEAK
+# CHANGE-REPEAT: name /usr/LOAD
+# CHANGE-REPEAT: name /usr/dylib/WEAK
 
 ## Specifying dependent library names in a chain:
 # RUN: cp %t %t.copy
 # RUN: llvm-install-name-tool -change /usr/dylib/LOAD /usr/XX/LOAD \
 # RUN:                        -change /usr/XX/LOAD /usr/YY/LOAD %t.copy
-# RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE-CHAIN --implicit-check-not=/usr
+# RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE-CHAIN --implicit-check-not='name /usr'
 
-# CHANGE-CHAIN: /usr/XX/LOAD
-# CHANGE-CHAIN: /usr/dylib/WEAK
+# CHANGE-CHAIN: name /usr/XX/LOAD
+# CHANGE-CHAIN: name /usr/dylib/WEAK
 
 ## Changing multiple dependent library names where one exists and the other doesn't:
 # RUN: cp %t %t.copy
 # RUN: llvm-install-name-tool -change /usr/dylib/LOAD /usr/JOJO/LOAD \
 # RUN:                        -change /usr/BIZARRE /usr/KOKO/LOAD %t.copy
-# RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE-SWITCH --implicit-check-not=/usr
+# RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE-SWITCH --implicit-check-not='name /usr'
 
-# CHANGE-SWITCH: /usr/JOJO/LOAD
-# CHANGE-SWITCH: /usr/dylib/WEAK
+# CHANGE-SWITCH: name /usr/JOJO/LOAD
+# CHANGE-SWITCH: name /usr/dylib/WEAK
 
 ## Changing to a common dependent library name:
 # RUN: cp %t %t.copy
 # RUN: llvm-install-name-tool -change /usr/dylib/LOAD /usr/COMMON \
 # RUN:                        -change /usr/dylib/WEAK /usr/COMMON %t.copy
-# RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE-COMMON --implicit-check-not=/usr
+# RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE-COMMON --implicit-check-not='name /usr'
 
-# CHANGE-COMMON: /usr/COMMON
-# CHANGE-COMMON: /usr/COMMON
+# CHANGE-COMMON: name /usr/COMMON
+# CHANGE-COMMON: name /usr/COMMON
 
 ## Change all common dependent library names at once:
 # RUN: llvm-install-name-tool -change /usr/COMMON /usr/ONCE %t.copy
-# RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE-ONCE --implicit-check-not=/usr
+# RUN: llvm-objdump -p %t.copy | FileCheck %s --check-prefix=CHANGE-ONCE --implicit-check-not='name /usr'
 
-# CHANGE-ONCE: /usr/ONCE
-# CHANGE-ONCE: /usr/ONCE
+# CHANGE-ONCE: name /usr/ONCE
+# CHANGE-ONCE: name /usr/ONCE
 
 ## Check that -change option has no effect if the binary doesn't contain old install name:
 # RUN: cp %t %t1

diff  --git a/llvm/test/tools/llvm-objcopy/MachO/install-name-tool-id.test b/llvm/test/tools/llvm-objcopy/MachO/install-name-tool-id.test
index e36f402502d6..eb29d26be934 100644
--- a/llvm/test/tools/llvm-objcopy/MachO/install-name-tool-id.test
+++ b/llvm/test/tools/llvm-objcopy/MachO/install-name-tool-id.test
@@ -4,15 +4,15 @@
 
 ## Specifying -id once:
 # RUN: llvm-install-name-tool -id /usr/lib/A_long_long_test %t
-# RUN: llvm-objdump -p %t | FileCheck %s --check-prefix=ID --implicit-check-not=/usr
+# RUN: llvm-objdump -p %t | FileCheck %s --check-prefix=ID --implicit-check-not='name /usr'
 
-# ID: /usr/lib/A_long_long_test
+# ID: name /usr/lib/A_long_long_test
 
 ## Specifying -id more than once:
 # RUN: llvm-install-name-tool -id /usr/lib/B_long -id /usr/lib/K_long -id /usr/A_short  %t
-# RUN: llvm-objdump -p %t | FileCheck %s --check-prefix=ID-MULTIPLE --implicit-check-not=/usr
+# RUN: llvm-objdump -p %t | FileCheck %s --check-prefix=ID-MULTIPLE --implicit-check-not='name /usr'
 
-# ID-MULTIPLE: /usr/A_short
+# ID-MULTIPLE: name /usr/A_short
 
 ## Specifying -id with empty string:
 # RUN: not llvm-install-name-tool -id '' %t 2>&1 | \


        


More information about the llvm-commits mailing list