def _setup_remote_arc_root(executor, copied_files): # Copy specified files to the remote host. exec_paths = _get_exec_paths() executor.rsync(copied_files, executor.get_remote_arc_root(), exclude_paths=exec_paths) executor.rsync(exec_paths, build_common.get_chromeos_arc_root_without_noexec())
def cleanup_remote_files(parsed_args): executor = _create_remote_executor(parsed_args) removed_patterns = [ # ARC root directory in the remote host. executor.get_remote_arc_root(), # The directory executables are temporarily copied to. build_common.get_chromeos_arc_root_without_noexec(), # Temporary Chrome profile directories created for integration tests. # These sometimes remain after the tests finish for some reasons. os.path.join(executor.get_remote_tmpdir(), build_common.CHROME_USER_DATA_DIR_PREFIX + "-*"), ] executor.run(" ".join(["rm", "-rf"] + removed_patterns), cwd=".")
def cleanup_remote_files(parsed_args): executor = _create_remote_executor(parsed_args) removed_patterns = [ # ARC root directory in the remote host. executor.get_remote_arc_root(), # The directory executables are temporarily copied to. build_common.get_chromeos_arc_root_without_noexec(), # Temporary Chrome profile directories created for integration tests. # These sometimes remain after the tests finish for some reasons. os.path.join(executor.get_remote_tmpdir(), build_common.CHROME_USER_DATA_DIR_PREFIX + '-*'), ] executor.run(' '.join(['rm', '-rf'] + removed_patterns), cwd='.')
def get_adb_path_for_chromeos(relative=True): """Returns the directory that contains the adb executable for Chrome OS.""" if platform_util.is_running_on_chromeos(): # The adb binary is copied to a directory whose filesystem is mounted # without noexec mount options on Chrome OS. root = build_common.get_chromeos_arc_root_without_noexec() else: root = build_common.get_arc_root() # Chrome OS based on linux-i686 is not supported. target = 'linux-arm' if OPTIONS.is_arm() else 'linux-x86_64' path = os.path.join('out/adb', target, 'adb') if relative: return path return os.path.join(root, path)
def _construct_command(test_info, gtest_filter, gtest_list_tests): variables = test_info['variables'].copy() variables.setdefault('argv', '') variables.setdefault('qemu_arm', '') if platform_util.is_running_on_chromeos(): # On ChromeOS, binaries in directories mounted with noexec options are # copied to the corresponding directories mounted with exec option. # Change runner to use the binaries under the directory mounted with exec # option. # Also do not use qemu_arm when running on ARM Chromebook. arc_root_without_noexec = \ build_common.get_chromeos_arc_root_without_noexec() if build_options.OPTIONS.is_bare_metal_build(): variables['runner'] = ' '.join( toolchain.get_bare_metal_runner( bin_dir=arc_root_without_noexec)) variables['runner_without_test_library'] = ' '.join( toolchain.get_bare_metal_runner( bin_dir=arc_root_without_noexec, use_test_library=False)) if build_options.OPTIONS.is_arm(): variables['qemu_arm'] = '' # Update --gtest_filter to re-enable the tests disabled only on qemu. if variables.get('qemu_disabled_tests'): variables[ 'gtest_options'] = unittest_util.build_gtest_options( variables.get('enabled_tests'), variables.get('disabled_tests')) else: variables['runner'] = ' '.join( toolchain.get_nacl_runner( build_options.OPTIONS.get_target_bitsize(), bin_dir=arc_root_without_noexec)) variables['runner_without_test_library'] = ' '.join( toolchain.get_nacl_runner( build_options.OPTIONS.get_target_bitsize(), bin_dir=arc_root_without_noexec, use_test_library=False)) build_dir = build_common.get_build_dir() # Use test binary in the directory mounted without noexec. variables['in'] = variables['in'].replace( build_dir, os.path.join(arc_root_without_noexec, build_dir)) else: if build_options.OPTIONS.is_arm(): # Pass environment variables by -E flag for qemu-arm instead of # "env" command. # TODO(hamaji): This and the is_running_on_chromeos() case above # are both hacky. We probably want to construct the command to # run a unittest here based on the info in variables, and remove # test_info['command']. qemu_arm = variables['qemu_arm'].split(' ') if '$qemu_arm' in test_info['command']: runner = variables['runner'].split(' ') assert runner[0] == 'env' runner.pop(0) qemu_arm.append('-E') while '=' in runner[0]: qemu_arm.append(runner[0]) runner.pop(0) variables['qemu_arm'] = ' '.join(qemu_arm) variables['runner'] = ' '.join(runner) if gtest_filter: variables['gtest_options'] = '--gtest_filter=' + gtest_filter if gtest_list_tests: variables['gtest_options'] = '--gtest_list_tests' # Test is run as a command to build a test results file. command_template = string.Template(test_info['command']) return command_template.substitute(variables)
def _construct_command(test_info, gtest_filter, gtest_list_tests): variables = test_info['variables'].copy() variables.setdefault('argv', '') variables.setdefault('qemu_arm', '') if platform_util.is_running_on_chromeos(): # On ChromeOS, binaries in directories mounted with noexec options are # copied to the corresponding directories mounted with exec option. # Change runner to use the binaries under the directory mounted with exec # option. # Also do not use qemu_arm when running on ARM Chromebook. arc_root_without_noexec = \ build_common.get_chromeos_arc_root_without_noexec() if build_options.OPTIONS.is_bare_metal_build(): variables['runner'] = ' '.join( toolchain.get_bare_metal_runner(bin_dir=arc_root_without_noexec)) variables['runner_without_test_library'] = ' '.join( toolchain.get_bare_metal_runner(bin_dir=arc_root_without_noexec, use_test_library=False)) if build_options.OPTIONS.is_arm(): variables['qemu_arm'] = '' # Update --gtest_filter to re-enable the tests disabled only on qemu. if variables.get('qemu_disabled_tests'): variables['gtest_options'] = unittest_util.build_gtest_options( variables.get('enabled_tests'), variables.get('disabled_tests')) else: variables['runner'] = ' '.join( toolchain.get_nacl_runner( build_options.OPTIONS.get_target_bitsize(), bin_dir=arc_root_without_noexec)) variables['runner_without_test_library'] = ' '.join( toolchain.get_nacl_runner( build_options.OPTIONS.get_target_bitsize(), bin_dir=arc_root_without_noexec, use_test_library=False)) build_dir = build_common.get_build_dir() # Use test binary in the directory mounted without noexec. variables['in'] = variables['in'].replace( build_dir, os.path.join(arc_root_without_noexec, build_dir)) else: if build_options.OPTIONS.is_arm(): # Pass environment variables by -E flag for qemu-arm instead of # "env" command. # TODO(hamaji): This and the is_running_on_chromeos() case above # are both hacky. We probably want to construct the command to # run a unittest here based on the info in variables, and remove # test_info['command']. qemu_arm = variables['qemu_arm'].split(' ') if '$qemu_arm' in test_info['command']: runner = variables['runner'].split(' ') assert runner[0] == 'env' runner.pop(0) qemu_arm.append('-E') while '=' in runner[0]: qemu_arm.append(runner[0]) runner.pop(0) variables['qemu_arm'] = ' '.join(qemu_arm) variables['runner'] = ' '.join(runner) if gtest_filter: variables['gtest_options'] = '--gtest_filter=' + gtest_filter if gtest_list_tests: variables['gtest_options'] = '--gtest_list_tests' # Test is run as a command to build a test results file. command_template = string.Template(test_info['command']) return command_template.substitute(variables)