[Lldb-commits] [lldb] acd641c - [lldb/testsuite] Slightly rework TestHiddenIvars.py

Fred Riss via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 18 20:54:29 PDT 2020


Author: Fred Riss
Date: 2020-03-18T20:52:28-07:00
New Revision: acd641c19d687c7117b08cdd568a91a381043ebb

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

LOG: [lldb/testsuite] Slightly rework TestHiddenIvars.py

The test was stripping the binaries from the Python
code. Unfortunately, if running on darwin embedded in a context that
requires code signing, the stripping was invalidating the signature,
thus breaking the test.

This patch moves the stripping to the Makefile and resigns the
stripped binaries if required.

Added: 
    

Modified: 
    lldb/test/API/lang/objc/hidden-ivars/Makefile
    lldb/test/API/lang/objc/hidden-ivars/TestHiddenIvars.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/lang/objc/hidden-ivars/Makefile b/lldb/test/API/lang/objc/hidden-ivars/Makefile
index 0664769456ef..283e8a118fb1 100644
--- a/lldb/test/API/lang/objc/hidden-ivars/Makefile
+++ b/lldb/test/API/lang/objc/hidden-ivars/Makefile
@@ -4,4 +4,24 @@ OBJC_SOURCES := main.m
 
 LD_EXTRAS = -framework Foundation
 
+all: a.out libInternalDefiner.dylib stripped
+
 include Makefile.rules
+
+ifeq "$(MAKE_DSYM)" "YES"
+stripped: a.out.dSYM
+endif
+
+stripped: a.out libInternalDefiner.dylib
+	mkdir stripped
+	strip -Sx a.out -o stripped/a.out
+	strip -Sx libInternalDefiner.dylib -o stripped/libInternalDefiner.dylib
+ifneq "$(CODESIGN)" ""
+	$(CODESIGN) -fs - stripped/a.out
+endif
+ifneq "$(CODESIGN)" ""
+	$(CODESIGN) -fs - stripped/libInternalDefiner.dylib
+endif
+ifeq "$(MAKE_DSYM)" "YES"
+	cp -r a.out.dSYM stripped/a.out.dSYM
+endif

diff  --git a/lldb/test/API/lang/objc/hidden-ivars/TestHiddenIvars.py b/lldb/test/API/lang/objc/hidden-ivars/TestHiddenIvars.py
index 03a325ac49c6..5930ffdc958a 100644
--- a/lldb/test/API/lang/objc/hidden-ivars/TestHiddenIvars.py
+++ b/lldb/test/API/lang/objc/hidden-ivars/TestHiddenIvars.py
@@ -80,20 +80,11 @@ def test_frame_variable_across_modules(self):
     def common_setup(self, strip):
 
         if strip:
-            self.assertTrue(subprocess.call(
-                ['/usr/bin/strip', '-Sx',
-                 self.getBuildArtifact('libInternalDefiner.dylib')]) == 0,
-                            'stripping dylib succeeded')
-            self.assertTrue(subprocess.call(
-                ['/bin/rm', '-rf',
-                 self.getBuildArtifact('libInternalDefiner.dylib.dSYM')]) == 0,
-                            'remove dylib dSYM file succeeded')
-            self.assertTrue(subprocess.call(['/usr/bin/strip', '-Sx',
-                                             self.getBuildArtifact("a.out")
-                                            ]) == 0,
-                            'stripping a.out succeeded')
+            exe = self.getBuildArtifact("stripped/a.out")
+        else:
+            exe = self.getBuildArtifact("a.out")
         # Create a target by the debugger.
-        target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
+        target = self.dbg.CreateTarget(exe)
         self.assertTrue(target, VALID_TARGET)
 
         # Create the breakpoint inside function 'main'.
@@ -110,7 +101,6 @@ def common_setup(self, strip):
             None, environment, self.get_process_working_directory())
         self.assertTrue(process, PROCESS_IS_VALID)
 
-        exe = self.getBuildArtifact("a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Break inside the foo function which takes a bar_ptr argument.


        


More information about the lldb-commits mailing list