[lldb] Don't add no-sandbox entitlement when running tests on simulator

It seems that if codesigning the test executables with the
`com.apple.private.security.no-sandbox` entitlement then the simulator refuses
to launch them and every test fails with `Process launch failed: process exited
with status -1 (no such process.)`.

This patch checks if we're trying to run the test suite on the simulator and
then avoids signing the executable with `no-sandbox`.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D89052
This commit is contained in:
Raphael Isemann 2020-10-13 15:08:20 +02:00
parent 480c440f9a
commit dfc7243952
2 changed files with 14 additions and 2 deletions

View File

@ -65,11 +65,15 @@ class BuilderDarwin(Builder):
if configuration.dsymutil:
args['DSYMUTIL'] = configuration.dsymutil
operating_system, _ = get_os_and_env()
operating_system, env = get_os_and_env()
if operating_system and operating_system != "macosx":
builder_dir = os.path.dirname(os.path.abspath(__file__))
test_dir = os.path.dirname(builder_dir)
entitlements = os.path.join(test_dir, 'make', 'entitlements.plist')
if env == "simulator":
entitlements_file = 'entitlements-simulator.plist'
else:
entitlements_file = 'entitlements.plist'
entitlements = os.path.join(test_dir, 'make', entitlements_file)
args['CODESIGN'] = 'codesign --entitlements {}'.format(
entitlements)

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.get-task-allow</key>
<true/>
</dict>
</plist>