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 _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 _copy_in_file(self, src, dst): device_dirname = posixpath.dirname(dst) device_temp_path = posixpath.join(device_dirname, 'temp.exe') adb.push(src, device_temp_path) # `adb push`ed executables can fail with ETXTBSY because adbd doesn't # close file descriptors http://b.android.com/65857 before invoking the # shell. Work around it by copying the file we just copied to a new # location. # ICS and Jelly Bean didn't have /system/bin/cp. Use cat :( cmd = ['cat', device_temp_path, '>', dst, '&&', 'chmod', '777', dst] _, out, err, exit_code = self._execute_command_remote(cmd) if exit_code != 0: raise RuntimeError('Failed to copy {} to {}:\n{}\n{}'.format( src, dst, out, err))
def _copy_in_file(self, src, dst): # pylint: disable=no-self-use adb.push(src, dst)