def ProcessInstrumentationOptions(args): """Processes options/arguments and populate |options| with defaults. Args: args: argparse.Namespace object. Returns: An InstrumentationOptions named tuple which contains all options relevant to instrumentation tests. """ ProcessJavaTestOptions(args) if not args.host_driven_root: args.run_python_tests = False args.test_apk_path = os.path.join(constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR, '%s.apk' % args.test_apk) args.test_apk_jar_path = os.path.join(constants.GetOutDirectory(), constants.SDK_BUILD_TEST_JAVALIB_DIR, '%s.jar' % args.test_apk) args.test_support_apk_path = '%sSupport%s' % (os.path.splitext( args.test_apk_path)) args.test_runner = apk_helper.GetInstrumentationName(args.test_apk_path) # TODO(jbudorick): Get rid of InstrumentationOptions. return instrumentation_test_options.InstrumentationOptions( args.tool, args.annotations, args.exclude_annotations, args.test_filter, args.test_data, args.save_perf_json, args.screenshot_failures, args.wait_for_debugger, args.coverage_dir, args.test_apk, args.test_apk_path, args.test_apk_jar_path, args.test_runner, args.test_support_apk_path, args.device_flags, args.isolate_file_path, args.set_asserts, args.delete_stale_data)
def _initializeDriverAttributes(self): self._driver_apk = os.path.join(constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR, 'OnDeviceInstrumentationDriver.apk') if os.path.exists(self._driver_apk): self._driver_package = apk_helper.GetPackageName(self._driver_apk) self._driver_name = apk_helper.GetInstrumentationName( self._driver_apk) else: self._driver_apk = None
def ProcessInstrumentationOptions(options, error_func): """Processes options/arguments and populate |options| with defaults. Args: options: optparse.Options object. error_func: Function to call with the error message in case of an error. Returns: An InstrumentationOptions named tuple which contains all options relevant to instrumentation tests. """ ProcessJavaTestOptions(options) if options.java_only and options.python_only: error_func('Options java_only (-j) and python_only (-p) ' 'are mutually exclusive.') options.run_java_tests = True options.run_python_tests = True if options.java_only: options.run_python_tests = False elif options.python_only: options.run_java_tests = False if not options.host_driven_root: options.run_python_tests = False if not options.test_apk: error_func('--test-apk must be specified.') options.test_apk_path = os.path.join(constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR, '%s.apk' % options.test_apk) options.test_apk_jar_path = os.path.join( constants.GetOutDirectory(), constants.SDK_BUILD_TEST_JAVALIB_DIR, '%s.jar' % options.test_apk) options.test_support_apk_path = '%sSupport%s' % (os.path.splitext( options.test_apk_path)) options.test_runner = apk_helper.GetInstrumentationName( options.test_apk_path) return instrumentation_test_options.InstrumentationOptions( options.tool, options.cleanup_test_files, options.annotations, options.exclude_annotations, options.test_filter, options.test_data, options.save_perf_json, options.screenshot_failures, options.wait_for_debugger, options.coverage_dir, options.test_apk, options.test_apk_path, options.test_apk_jar_path, options.test_runner, options.test_support_apk_path, options.device_flags, options.isolate_file_path)
def __initializeApkAttributes(self, args, error_func): if args.apk_under_test.endswith('.apk'): self._apk_under_test = args.apk_under_test else: self._apk_under_test = os.path.join(constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR, '%s.apk' % args.apk_under_test) if not os.path.exists(self._apk_under_test): error_func('Unable to find APK under test: %s' % self._apk_under_test) if args.test_apk.endswith('.apk'): test_apk_root = os.path.splitext(os.path.basename( args.test_apk))[0] self._test_apk = args.test_apk else: test_apk_root = args.test_apk self._test_apk = os.path.join(constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR, '%s.apk' % args.test_apk) self._test_jar = os.path.join(constants.GetOutDirectory(), constants.SDK_BUILD_TEST_JAVALIB_DIR, '%s.jar' % test_apk_root) self._test_support_apk = os.path.join( constants.GetOutDirectory(), constants.SDK_BUILD_TEST_JAVALIB_DIR, '%sSupport.apk' % test_apk_root) if not os.path.exists(self._test_apk): error_func('Unable to find test APK: %s' % self._test_apk) if not os.path.exists(self._test_jar): error_func('Unable to find test JAR: %s' % self._test_jar) self._test_package = apk_helper.GetPackageName(self.test_apk) self._test_runner = apk_helper.GetInstrumentationName(self.test_apk) self._package_info = None for package_info in constants.PACKAGE_INFO.itervalues(): if self._test_package == package_info.test_package: self._package_info = package_info if not self._package_info: error_func('Unable to find package info for %s' % self._test_package)
def __init__(self, apk): self._apk = apk self._package = apk_helper.GetPackageName(self._apk) self._runner = apk_helper.GetInstrumentationName(self._apk) self._component = '%s/%s' % (self._package, self._runner) self._enable_test_server_spawner = False
def __init__(self, apk): self._apk = apk self._package = apk_helper.GetPackageName(self._apk) self._runner = apk_helper.GetInstrumentationName(self._apk) self._component = '%s/%s' % (self._package, self._runner)