Merge changes Ifc661bd2,Iba4ed7be am: b2ed3ee88f

am: 75ad1be5d6

Change-Id: I4ccc2a35f603e2bf68f7e8c0d7190d6d4d10f5ae
This commit is contained in:
Dan Albert
2019-01-10 12:21:13 -08:00
committed by android-build-merger
3 changed files with 13 additions and 28 deletions

View File

@@ -142,6 +142,14 @@ def get_build_cmds(bitness, host):
return extract_build_cmds(commands, os.path.basename(target)) return extract_build_cmds(commands, os.path.basename(target))
def setup_test_directory():
"""Prepares a device test directory for use by the shell user."""
device_dir = '/data/local/tmp/libcxx'
check_call(['adb', 'shell', 'rm', '-rf', device_dir])
check_call(['adb', 'shell', 'mkdir', '-p', device_dir])
check_call(['adb', 'shell', 'chown', '-R', 'shell:shell', device_dir])
def main(): def main():
"""Program entry point.""" """Program entry point."""
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
@@ -176,6 +184,9 @@ def main():
have_filter_args = True have_filter_args = True
break # No need to keep scanning. break # No need to keep scanning.
if not args.host:
setup_test_directory()
lit_args = [ lit_args = [
'-sv', android_mode_arg, cxx_under_test_arg, cxx_template_arg, '-sv', android_mode_arg, cxx_under_test_arg, cxx_template_arg,
link_template_arg, libcxx_site_cfg_arg, libcxxabi_site_cfg_arg link_template_arg, libcxx_site_cfg_arg, libcxxabi_site_cfg_arg

View File

@@ -16,7 +16,7 @@ class AdbExecutor(libcxx.test.executor.RemoteExecutor):
def _remote_temp(self, is_dir): def _remote_temp(self, is_dir):
dir_arg = '-d' if is_dir else '' dir_arg = '-d' if is_dir else ''
cmd = 'mktemp -q {} /data/local/tmp/libcxx.XXXXXXXXXX'.format(dir_arg) cmd = 'mktemp -q {} /data/local/tmp/libcxx/temp.XXXXXX'.format(dir_arg)
_, temp_path, err, exitCode = self._execute_command_remote([cmd]) _, temp_path, err, exitCode = self._execute_command_remote([cmd])
temp_path = temp_path.strip() temp_path = temp_path.strip()
if exitCode != 0: if exitCode != 0:
@@ -32,7 +32,7 @@ class AdbExecutor(libcxx.test.executor.RemoteExecutor):
adb_cmd.extend(['-s', self.serial]) adb_cmd.extend(['-s', self.serial])
delimiter = 'x' delimiter = 'x'
probe_cmd = ' '.join(cmd) + '; echo {}$?'.format(delimiter) probe_cmd = 'su shell {}; echo {}$?'.format(' '.join(cmd), delimiter)
env_cmd = [] env_cmd = []
if env is not None: if env is not None:

View File

@@ -52,32 +52,6 @@ class TestFormat(HostTestFormat):
def _wd_path(self, test_name, file_name): def _wd_path(self, test_name, file_name):
return os.path.join(self._working_directory(test_name), file_name) return os.path.join(self._working_directory(test_name), file_name)
def _build(self, exec_path, source_path, compile_only=False,
use_verify=False):
# pylint: disable=protected-access
cmd, report, rc = libcxx.test.format.LibcxxTestFormat._build(
self, exec_path, source_path, compile_only, use_verify)
if rc != 0:
return cmd, report, rc
try:
exec_file = os.path.basename(exec_path)
adb.mkdir(self._working_directory(exec_file))
adb.push(exec_path, self._wd_path(exec_file, exec_file))
# Push any .dat files in the same directory as the source to the
# working directory.
src_dir = os.path.dirname(source_path)
data_files = [f for f in os.listdir(src_dir) if f.endswith('.dat')]
for data_file in data_files:
df_path = os.path.join(src_dir, data_file)
df_dev_path = self._wd_path(exec_file, data_file)
adb.push(df_path, df_dev_path)
return cmd, report, rc
except adb.AdbError as ex:
return self._make_report(ex.cmd, ex.out, ex.err, ex.exit_code)
def _clean(self, exec_path): def _clean(self, exec_path):
exec_file = os.path.basename(exec_path) exec_file = os.path.basename(exec_path)
cmd = ['adb', 'shell', 'rm', '-rf', self._working_directory(exec_file)] cmd = ['adb', 'shell', 'rm', '-rf', self._working_directory(exec_file)]