[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.
This commit is contained in:
Fred Riss 2020-03-18 20:12:21 -07:00
parent 71db787c45
commit acd641c19d
2 changed files with 24 additions and 14 deletions

View File

@ -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

View File

@ -80,20 +80,11 @@ class HiddenIvarsTestCase(TestBase):
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 @@ class HiddenIvarsTestCase(TestBase):
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.