Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@ -0,0 +1,46 @@
import os, sys, subprocess, tempfile
import time
ANDROID_TMPDIR = '/data/local/tmp/Output'
ADB = os.environ.get('ADB', 'adb')
verbose = False
if os.environ.get('ANDROID_RUN_VERBOSE') == '1':
verbose = True
def host_to_device_path(path):
rel = os.path.relpath(path, "/")
dev = os.path.join(ANDROID_TMPDIR, rel)
return dev
def adb(args, attempts = 1):
if verbose:
print args
tmpname = tempfile.mktemp()
out = open(tmpname, 'w')
ret = 255
while attempts > 0 and ret != 0:
attempts -= 1
ret = subprocess.call([ADB] + args, stdout=out, stderr=subprocess.STDOUT)
if attempts != 0:
ret = 5
if ret != 0:
print "adb command failed", args
print tmpname
out.close()
out = open(tmpname, 'r')
print out.read()
out.close()
os.unlink(tmpname)
return ret
def pull_from_device(path):
tmp = tempfile.mktemp()
adb(['pull', path, tmp], 5)
text = open(tmp, 'r').read()
os.unlink(tmp)
return text
def push_to_device(path):
dst_path = host_to_device_path(path)
adb(['push', path, dst_path], 5)

View File

@ -0,0 +1,36 @@
#!/usr/bin/python
import os, sys, subprocess
from android_common import *
here = os.path.abspath(os.path.dirname(sys.argv[0]))
android_run = os.path.join(here, 'android_run.py')
output = None
output_type = 'executable'
args = sys.argv[1:]
while args:
arg = args.pop(0)
if arg == '-shared':
output_type = 'shared'
elif arg == '-c':
output_type = 'object'
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 output_type in ['executable', 'shared']:
push_to_device(output)
if output_type == 'executable':
os.rename(output, output + '.real')
os.symlink(android_run, output)

View File

@ -0,0 +1,39 @@
#!/usr/bin/python
import os, signal, sys, subprocess, tempfile
from android_common import *
ANDROID_TMPDIR = '/data/local/tmp/Output'
device_binary = host_to_device_path(sys.argv[0])
def build_env():
args = []
# Android linker ignores RPATH. Set LD_LIBRARY_PATH to Output dir.
args.append('LD_LIBRARY_PATH=%s' % (ANDROID_TMPDIR,))
for (key, value) in os.environ.items():
if key in ['ASAN_ACTIVATION_OPTIONS', 'SCUDO_OPTIONS'] or key.endswith('SAN_OPTIONS'):
args.append('%s="%s"' % (key, value))
return ' '.join(args)
is_64bit = (subprocess.check_output(['file', sys.argv[0] + '.real']).find('64-bit') != -1)
device_env = build_env()
device_args = ' '.join(sys.argv[1:]) # FIXME: escape?
device_stdout = device_binary + '.stdout'
device_stderr = device_binary + '.stderr'
device_exitcode = device_binary + '.exitcode'
ret = adb(['shell', 'cd %s && %s %s %s >%s 2>%s ; echo $? >%s' %
(ANDROID_TMPDIR, device_env, device_binary, device_args,
device_stdout, device_stderr, device_exitcode)])
if ret != 0:
sys.exit(ret)
sys.stdout.write(pull_from_device(device_stdout))
sys.stderr.write(pull_from_device(device_stderr))
retcode = int(pull_from_device(device_exitcode))
# If the device process died with a signal, do abort().
# Not exactly the same, but good enough to fool "not --crash".
if retcode > 128:
os.kill(os.getpid(), signal.SIGABRT)
sys.exit(retcode)