def _get_gms_core_apitest_data_roots_glob_template(): # Expectaion files are prepared for supported moudles in gms core. In other # words, test suites without matching expectation file always fail. Omit such # suites in order to save the disk space of remote Chromebooks. return ['{out}/data_roots/' + os.path.basename(path) for path in file_util.glob('out/internal-apks-integration-tests/expectations/' + 'gms_core_apitest.*')]
def _get_gms_core_apitest_data_roots_glob_template(): # Expectaion files are prepared for supported moudles in gms core. In other # words, test suites without matching expectation file always fail. Omit such # suites in order to save the disk space of remote Chromebooks. return [ '{out}/data_roots/' + os.path.basename(path) for path in file_util.glob('out/internal-apks-integration-tests/expectations/' + 'gms_core_apitest.*') ]
def get_launch_chrome_deps(parsed_args): """Returns a list of paths needed to run ./launch_chrome. The returned path may be a directory. In that case, all its descendents are needed. """ glob_template_list = (_COMMON_GLOB_TEMPLATE_LIST + _LAUNCH_CHROME_GLOB_TEMPLATE_LIST) patterns = (map(build_common.expand_path_placeholder, glob_template_list) + [parsed_args.arc_data_dir]) return file_util.glob(*patterns)
def get_launch_chrome_deps(parsed_args): """Returns a list of paths needed to run ./launch_chrome. The returned path may be a directory. In that case, all its descendents are needed. """ glob_template_list = ( _COMMON_GLOB_TEMPLATE_LIST + _LAUNCH_CHROME_GLOB_TEMPLATE_LIST) patterns = ( map(build_common.expand_path_placeholder, glob_template_list) + [parsed_args.arc_data_dir]) return file_util.glob(*patterns)
def get_unittest_deps(parsed_args): """Returns a list of paths needed to run unittests. The returned path may be a directory. In that case, all its descendants are needed. """ glob_template_list = (_COMMON_GLOB_TEMPLATE_LIST + _UNITTEST_GLOB_TEMPLATE_LIST) patterns = (map(build_common.expand_path_placeholder, glob_template_list) + unittest_util.get_nacl_tools() + unittest_util.get_test_executables(parsed_args.tests)) return file_util.glob(*patterns)
def get_unittest_deps(parsed_args): """Returns a list of paths needed to run unittests. The returned path may be a directory. In that case, all its descendants are needed. """ glob_template_list = ( _COMMON_GLOB_TEMPLATE_LIST + _UNITTEST_GLOB_TEMPLATE_LIST) patterns = ( map(build_common.expand_path_placeholder, glob_template_list) + unittest_util.get_nacl_tools() + unittest_util.get_test_executables(parsed_args.tests)) return file_util.glob(*patterns)
def get_integration_test_deps(): """Returns a list of paths needed to run ./run_integration_tests. The returned path may be a directory. In that case, all its descendants are needed. """ # Note: integration test depends on ./launch_chrome. Also, we run unittests # as a part of integration test on ChromeOS. glob_template_list = ( _COMMON_GLOB_TEMPLATE_LIST + _LAUNCH_CHROME_GLOB_TEMPLATE_LIST + _INTEGRATION_TEST_GLOB_TEMPLATE_LIST + _UNITTEST_GLOB_TEMPLATE_LIST + _get_gms_core_apitest_data_roots_glob_template()) patterns = ( map(build_common.expand_path_placeholder, glob_template_list) + [toolchain.get_adb_path_for_chromeos()] + unittest_util.get_nacl_tools() + unittest_util.get_test_executables(unittest_util.get_all_tests())) return file_util.glob(*patterns)
def get_integration_test_deps(): """Returns a list of paths needed to run ./run_integration_tests. The returned path may be a directory. In that case, all its descendants are needed. """ # Note: integration test depends on ./launch_chrome. Also, we run unittests # as a part of integration test on ChromeOS. glob_template_list = (_COMMON_GLOB_TEMPLATE_LIST + _LAUNCH_CHROME_GLOB_TEMPLATE_LIST + _INTEGRATION_TEST_GLOB_TEMPLATE_LIST + _UNITTEST_GLOB_TEMPLATE_LIST + _get_gms_core_apitest_data_roots_glob_template()) patterns = ( map(build_common.expand_path_placeholder, glob_template_list) + [toolchain.get_adb_path_for_chromeos()] + unittest_util.get_nacl_tools() + unittest_util.get_test_executables(unittest_util.get_all_tests())) return file_util.glob(*patterns)
def _preoptimize_subapk(src_apk, dest_apk, work_dir): # Extract inner apks from |src_apk|. # Note that we cannot use Python zipfile module for handling apk. # See: https://bugs.python.org/issue14315. subprocess.call(['unzip', '-q', src_apk, _SUBAPK_PATTERN, '-d', work_dir]) inner_apk_list = file_util.glob(os.path.join(work_dir, _SUBAPK_PATTERN)) # Optimize each apk and place the output odex next to the apk. odex_files = [] for apk_path in inner_apk_list: apk_name = os.path.basename(apk_path) odex_name = re.sub(r'\.apk$', '.odex', apk_name) odex_path_in_apk = os.path.join(_SUBAPK_PATH, odex_name) odex_path = os.path.join(work_dir, odex_path_in_apk) odex_files.append(odex_path_in_apk) install_path = _get_apk_install_location(_calc_sha1(apk_path), apk_name) dex2oat_cmd = [ 'src/build/filter_dex2oat_warnings.py', toolchain.get_tool('java', 'dex2oat') ] + build_common.get_dex2oat_for_apk_flags( apk_path=apk_path, apk_install_path=install_path, output_odex_path=odex_path) if subprocess.call(dex2oat_cmd, cwd=_ARC_ROOT) != 0: print 'ERROR: preoptimize failed for %s.' % apk_path return False # Prepare |dest_apk|. shutil.copyfile(src_apk, dest_apk) # Add odex files to |dest_apk| by using aapt. if odex_files: aapt_add_cmd = [os.path.join(_ARC_ROOT, toolchain.get_tool('java', 'aapt')), 'add', os.path.join(_ARC_ROOT, dest_apk)] + odex_files with open(os.devnull, 'w') as devnull: if subprocess.call(aapt_add_cmd, cwd=work_dir, stdout=devnull) != 0: print 'ERROR: adding odex files to %s failed.' % dest_apk file_util.remove_file_force(dest_apk) return False return True