Skip to content

Commit acd641c

Browse files
committed
[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.
1 parent 71db787 commit acd641c

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

lldb/test/API/lang/objc/hidden-ivars/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,24 @@ OBJC_SOURCES := main.m
44

55
LD_EXTRAS = -framework Foundation
66

7+
all: a.out libInternalDefiner.dylib stripped
8+
79
include Makefile.rules
10+
11+
ifeq "$(MAKE_DSYM)" "YES"
12+
stripped: a.out.dSYM
13+
endif
14+
15+
stripped: a.out libInternalDefiner.dylib
16+
mkdir stripped
17+
strip -Sx a.out -o stripped/a.out
18+
strip -Sx libInternalDefiner.dylib -o stripped/libInternalDefiner.dylib
19+
ifneq "$(CODESIGN)" ""
20+
$(CODESIGN) -fs - stripped/a.out
21+
endif
22+
ifneq "$(CODESIGN)" ""
23+
$(CODESIGN) -fs - stripped/libInternalDefiner.dylib
24+
endif
25+
ifeq "$(MAKE_DSYM)" "YES"
26+
cp -r a.out.dSYM stripped/a.out.dSYM
27+
endif

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

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,11 @@ def test_frame_variable_across_modules(self):
8080
def common_setup(self, strip):
8181

8282
if strip:
83-
self.assertTrue(subprocess.call(
84-
['/usr/bin/strip', '-Sx',
85-
self.getBuildArtifact('libInternalDefiner.dylib')]) == 0,
86-
'stripping dylib succeeded')
87-
self.assertTrue(subprocess.call(
88-
['/bin/rm', '-rf',
89-
self.getBuildArtifact('libInternalDefiner.dylib.dSYM')]) == 0,
90-
'remove dylib dSYM file succeeded')
91-
self.assertTrue(subprocess.call(['/usr/bin/strip', '-Sx',
92-
self.getBuildArtifact("a.out")
93-
]) == 0,
94-
'stripping a.out succeeded')
83+
exe = self.getBuildArtifact("stripped/a.out")
84+
else:
85+
exe = self.getBuildArtifact("a.out")
9586
# Create a target by the debugger.
96-
target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
87+
target = self.dbg.CreateTarget(exe)
9788
self.assertTrue(target, VALID_TARGET)
9889

9990
# Create the breakpoint inside function 'main'.
@@ -110,7 +101,6 @@ def common_setup(self, strip):
110101
None, environment, self.get_process_working_directory())
111102
self.assertTrue(process, PROCESS_IS_VALID)
112103

113-
exe = self.getBuildArtifact("a.out")
114104
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
115105

116106
# Break inside the foo function which takes a bar_ptr argument.

0 commit comments

Comments
 (0)