def main(): parser = argparse.ArgumentParser() parser.add_argument( '--arch', choices=list(set(_SUPPORTED_ARCH_DICT.values())), default=None, type=str, help=('Architecture to for CTS tests. Will auto-determine based on ' 'the device ro.product.cpu.abi property.')) parser.add_argument( '--cts-release', # TODO(aluo): --platform is deprecated (the meaning is unclear). '--platform', choices=sorted(set(SDK_PLATFORM_DICT.values())), required=False, default=None, help='Which CTS release to use for the run. This should generally be <= ' 'device OS level (otherwise, the newer tests will fail). If ' 'unspecified, the script will auto-determine the release based on ' 'device OS level.') parser.add_argument( '--skip-expected-failures', action='store_true', help= "Option to skip all tests that are expected to fail. Can't be used " "with test filters.") parser.add_argument('--apk-dir', help='Directory to extract CTS APKs to. ' 'Will use temp directory by default.') parser.add_argument( '--test-launcher-summary-output', '--json-results-file', '--write-full-results-to', '--isolated-script-test-output', dest='json_results_file', type=os.path.realpath, help='If set, will dump results in JSON form to the specified file. ' 'Note that this will also trigger saving per-test logcats to ' 'logdog.') parser.add_argument('-m', '--module-apk', dest='module_apk', help='CTS module apk name in ' + _WEBVIEW_CTS_GCS_PATH_FILE + ' file, without the path prefix.') test_filter.AddFilterOptions(parser) script_common.AddDeviceArguments(parser) logging_common.AddLoggingArguments(parser) args, test_runner_args = parser.parse_known_args() logging_common.InitializeLogging(args) devil_chromium.Initialize() test_runner_args.extend(ForwardArgsToTestRunner(args)) devices = script_common.GetDevices(args.devices, args.blacklist_file) device = devices[0] if len(devices) > 1: logging.warning( 'Detection of arch and cts-release will use 1st of %d ' 'devices: %s', len(devices), device.serial) arch = args.arch or DetermineArch(device) cts_release = args.cts_release or DetermineCtsRelease(device) if (args.test_filter_file or args.test_filter or args.isolated_script_test_filter): # TODO(aluo): auto-determine the module based on the test filter and the # available tests in each module if not args.module_apk: args.module_apk = 'CtsWebkitTestCases.apk' platform_modules = GetCTSModuleNames(arch, cts_release) if args.module_apk and args.module_apk not in platform_modules: raise Exception('--module-apk for arch==' + arch + 'and cts_release==' + cts_release + ' must be one of: ' + ', '.join(platform_modules)) # Need to uninstall all previous cts webkit packages so that the # MockContentProvider names won't conflict with a previously installed # one under a different package name. This is due to CtsWebkitTestCases's # package name change from M to N versions of the tests while keeping the # MockContentProvider's authority string the same. UninstallAnyCtsWebkitPackages(device) return RunAllCTSTests(args, arch, cts_release, test_runner_args)
def main(): parser = argparse.ArgumentParser() parser.add_argument( '--arch', choices=list(set(_SUPPORTED_ARCH_DICT.values())), default=None, type=str, help=('Architecture to for CTS tests. Will auto-determine based on ' 'the device ro.product.cpu.abi property.')) parser.add_argument('--platform', choices=['L', 'M', 'N', 'O'], required=False, default=None, help='Android platform version for CTS tests. ' 'Will auto-determine based on SDK level by default.') parser.add_argument( '--skip-expected-failures', action='store_true', help= "Option to skip all tests that are expected to fail. Can't be used " "with test filters.") parser.add_argument('--apk-dir', help='Directory to extract CTS APKs to. ' 'Will use temp directory by default.') parser.add_argument( '--test-launcher-summary-output', '--json-results-file', '--write-full-results-to', '--isolated-script-test-output', dest='json_results_file', type=os.path.realpath, help='If set, will dump results in JSON form to the specified file. ' 'Note that this will also trigger saving per-test logcats to ' 'logdog.') parser.add_argument('-m', '--module-apk', dest='module_apk', help='CTS module apk name in ' + _WEBVIEW_CTS_GCS_PATH_FILE + ' file, without the path prefix.') test_filter.AddFilterOptions(parser) script_common.AddDeviceArguments(parser) logging_common.AddLoggingArguments(parser) args, test_runner_args = parser.parse_known_args() logging_common.InitializeLogging(args) devil_chromium.Initialize() devices = script_common.GetDevices(args.devices, args.blacklist_file) device = devices[0] if len(devices) > 1: logging.warning( 'Only single device supported, using 1st of %d devices: %s', len(devices), device.serial) test_runner_args.extend(['-d', device.serial]) if args.platform is None: args.platform = DeterminePlatform(device) if args.platform is None: raise Exception('Could not auto-determine device platform, ' 'please specifiy --platform') arch = args.arch if args.arch else DetermineArch(device) if (args.test_filter_file or args.test_filter or args.isolated_script_test_filter): if args.skip_expected_failures: # TODO(aluo): allow both options to be used together so that expected # failures in the filtered test set can be skipped raise Exception( '--skip-expected-failures and test filters are mutually' ' exclusive') # TODO(aluo): auto-determine the module based on the test filter and the # available tests in each module if not args.module_apk: args.module_apk = 'CtsWebkitTestCases.apk' platform_modules = GetCTSModuleNames(arch, args.platform) if args.module_apk and args.module_apk not in platform_modules: raise Exception('--module-apk for arch==' + arch + 'and platform==' + args.platform + ' must be one of: ' + ', '.join(platform_modules)) return RunAllCTSTests(args, arch, test_runner_args)