[PATCH] D32561: [asan] Add a compilation wrapper that codesigns shared libraries to support iOS simulator testing
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 27 22:08:44 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL301617: [asan] Add a compilation wrapper that codesigns shared libraries to support iOS… (authored by kuba.brecka).
Changed prior to commit:
https://reviews.llvm.org/D32561?vs=96823&id=97041#toc
Repository:
rL LLVM
https://reviews.llvm.org/D32561
Files:
compiler-rt/trunk/test/asan/lit.cfg
compiler-rt/trunk/test/lit.common.cfg
compiler-rt/trunk/test/sanitizer_common/ios_commands/iossim_compile.py
Index: compiler-rt/trunk/test/sanitizer_common/ios_commands/iossim_compile.py
===================================================================
--- compiler-rt/trunk/test/sanitizer_common/ios_commands/iossim_compile.py
+++ compiler-rt/trunk/test/sanitizer_common/ios_commands/iossim_compile.py
@@ -0,0 +1,32 @@
+#!/usr/bin/python
+
+import os, sys, subprocess
+
+output = None
+output_type = 'executable'
+
+args = sys.argv[1:]
+while args:
+ arg = args.pop(0)
+ if arg == '-shared':
+ output_type = 'shared'
+ elif arg == '-dynamiclib':
+ output_type = 'dylib'
+ elif arg == '-c':
+ output_type = 'object'
+ elif arg == '-S':
+ output_type = 'assembly'
+ elif arg == '-o':
+ output = args.pop(0)
+
+if output == None:
+ print "No output file name!"
+ sys.exit(1)
+
+ret = subprocess.call(sys.argv[1:])
+if ret != 0:
+ sys.exit(ret)
+
+# If we produce a dylib, ad-hoc sign it.
+if output_type in ['shared', 'dylib']:
+ ret = subprocess.call(["codesign", "-s", "-", output])
Index: compiler-rt/trunk/test/lit.common.cfg
===================================================================
--- compiler-rt/trunk/test/lit.common.cfg
+++ compiler-rt/trunk/test/lit.common.cfg
@@ -97,17 +97,23 @@
if config.emulator:
config.substitutions.append( ('%run', config.emulator) )
config.substitutions.append( ('%env ', "env ") )
+ config.compile_wrapper = ""
elif config.ios:
+ config.available_features.add('ios')
+
device_id_env = "SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER" if config.iossim else "SANITIZER_IOS_TEST_DEVICE_IDENTIFIER"
if device_id_env in os.environ: config.environment[device_id_env] = os.environ[device_id_env]
ios_commands_dir = os.path.join(config.compiler_rt_src_root, "test", "sanitizer_common", "ios_commands")
run_wrapper = os.path.join(ios_commands_dir, "iossim_run.py" if config.iossim else "ios_run.py")
config.substitutions.append(('%run', run_wrapper))
env_wrapper = os.path.join(ios_commands_dir, "iossim_env.py" if config.iossim else "ios_env.py")
config.substitutions.append(('%env ', env_wrapper + " "))
+ compile_wrapper = os.path.join(ios_commands_dir, "iossim_compile.py" if config.iossim else "ios_compile.py")
+ config.compile_wrapper = compile_wrapper
else:
config.substitutions.append( ('%run', "") )
config.substitutions.append( ('%env ', "env ") )
+ config.compile_wrapper = ""
# Define CHECK-%os to check for OS-dependent output.
config.substitutions.append( ('CHECK-%os', ("CHECK-" + config.host_os)))
Index: compiler-rt/trunk/test/asan/lit.cfg
===================================================================
--- compiler-rt/trunk/test/asan/lit.cfg
+++ compiler-rt/trunk/test/asan/lit.cfg
@@ -108,14 +108,12 @@
asan_lit_source_dir = get_required_attr(config, "asan_lit_source_dir")
if config.android == "1":
config.available_features.add('android')
- clang_wrapper = os.path.join(asan_lit_source_dir,
- "android_commands", "android_compile.py") + " "
+ compile_wrapper = os.path.join(asan_lit_source_dir, "android_commands", "android_compile.py") + " "
else:
config.available_features.add('not-android')
- clang_wrapper = ""
def build_invocation(compile_flags):
- return " " + " ".join([clang_wrapper, config.clang] + compile_flags) + " "
+ return " " + " ".join([config.compile_wrapper, config.clang] + compile_flags) + " "
# Clang driver link 'x86' (i686) architecture to 'i386'.
target_arch = config.target_arch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32561.97041.patch
Type: text/x-patch
Size: 3515 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170428/e39f76bb/attachment.bin>
More information about the llvm-commits
mailing list