am 3461be0c: Update Android LIT code to match API changes.

* commit '3461be0c177d5eb6869f184bf2814ce43e6b2e1b':
  Update Android LIT code to match API changes.
This commit is contained in:
Dan Albert
2015-01-07 18:12:06 +00:00
committed by Android Git Automerger

View File

@@ -232,41 +232,41 @@ class AndroidLibcxxTestFormat(LibcxxTestFormat):
def _adb_mkdir(self, path):
cmd = ['adb', 'shell', 'mkdir', path]
out, err, exit_code = self.execute_command(cmd)
out, err, exit_code = lit.util.executeCommand(cmd)
if exit_code != 0:
raise AdbError(cmd, out, err, exit_code)
def _adb_push(self, src, dst):
cmd = ['adb', 'push', src, dst]
out, err, exit_code = self.execute_command(cmd)
out, err, exit_code = lit.util.executeCommand(cmd)
if exit_code != 0:
raise AdbError(cmd, out, err, exit_code)
def _build(self, exec_path, source_path, compile_only=False,
use_verify=False):
cxx_out_path = exec_path
if not compile_only:
cxx_out_path += '.o'
cxx_args = self.cxx_template.replace('%OUT%', cxx_out_path)
def _compile(self, output_path, source_path, use_verify=False):
if use_verify:
raise NotImplementedError(
'AndroidConfiguration does not support use_verify mode.')
cxx_args = self.cxx_template.replace('%OUT%', output_path)
cxx_args = cxx_args.replace('%SOURCE%', source_path)
cmd = [self.cxx_under_test] + shlex.split(cxx_args)
out, err, exit_code = lit.util.executeCommand(cmd)
return cmd, out, err, exit_code
def _link(self, exec_path, object_path):
link_args = self.link_template.replace('%OUT%', exec_path)
link_args = link_args.replace('%SOURCE%', object_path)
cmd = [self.cxx_under_test] + shlex.split(link_args)
out, err, exit_code = lit.util.executeCommand(cmd)
return cmd, out, err, exit_code
def _build(self, exec_path, source_path, compile_only=False,
use_verify=False):
cmd, report, rc = LibcxxTestFormat._build(
self, exec_path, source_path, compile_only, use_verify)
if rc != 0:
return cmd, report, rc
try:
out, err, exit_code = self.execute_command(cmd)
if compile_only or exit_code != 0:
return cmd, out, err, exit_code
compile_cmd = cmd
link_args = self.link_template.replace('%OUT%', exec_path)
link_args = link_args.replace('%SOURCE%', cxx_out_path)
cmd = [self.cxx_under_test] + shlex.split(link_args)
full_cmd = compile_cmd + [' && '] + cmd
out, err, exit_code = self.execute_command(cmd)
if exit_code != 0:
return full_cmd, out, err, exit_code
exec_file = os.path.basename(exec_path)
self._adb_mkdir(self._working_directory(exec_file))
@@ -280,14 +280,14 @@ class AndroidLibcxxTestFormat(LibcxxTestFormat):
df_path = os.path.join(src_dir, data_file)
df_dev_path = self._wd_path(exec_file, data_file)
self._adb_push(df_path, df_dev_path)
return full_cmd, out, err, exit_code
return cmd, report, rc
except AdbError as ex:
return ex.cmd, ex.out, ex.err, ex.exit_code
return self._make_report(ex.cmd, ex.out, ex.err, ex.exit_code)
def _clean(self, exec_path):
exec_file = os.path.basename(exec_path)
cmd = ['adb', 'shell', 'rm', '-rf', self._working_directory(exec_file)]
self.execute_command(cmd)
lit.util.executeCommand(cmd)
os.remove(exec_path)
def _run(self, exec_path, lit_config, in_dir=None):
@@ -301,7 +301,7 @@ class AndroidLibcxxTestFormat(LibcxxTestFormat):
# https://code.google.com/p/android/issues/detail?id=65857. Work around
# it by just waiting a second and then retrying.
for _ in range(10):
out, err, exit_code = self.execute_command(cmd)
out, err, exit_code = lit.util.executeCommand(cmd)
if exit_code == 0:
if 'Text file busy' in out:
time.sleep(1)
@@ -314,7 +314,7 @@ class AndroidLibcxxTestFormat(LibcxxTestFormat):
else:
err += '\nTimed out after {} seconds'.format(self.timeout)
break
return cmd, out, err, exit_code
return self._make_report(cmd, out, err, exit_code)
class Configuration(object):
@@ -771,6 +771,7 @@ class AndroidConfiguration(Configuration):
self.configure_cxx_template()
self.configure_link_template()
self.configure_triple()
self.configure_features()
def configure_build_cmds(self):
os.chdir(self.config.android_root)
@@ -797,6 +798,9 @@ class AndroidConfiguration(Configuration):
raise RuntimeError('Could not determine target triple.')
self.config.target_triple = match.group(1)
def configure_features(self):
self.config.available_features.add('long_tests')
def get_test_format(self):
return AndroidLibcxxTestFormat(
self.cxx_under_test,