def __init__(self, device, test_suite, gtest_filter, test_arguments, timeout, rebaseline, performance_test, cleanup_test_files, tool, shard_index, dump_debug_info=False, fast_and_loose=False): BaseTestRunner.__init__(self, device, shard_index) self._running_on_emulator = self.device.startswith('emulator') self._gtest_filter = gtest_filter self._test_arguments = test_arguments self.test_results = TestResults() if dump_debug_info: self.dump_debug_info = debug_info.GTestDebugInfo(self.adb, device, os.path.basename(test_suite), gtest_filter) else: self.dump_debug_info = None self.fast_and_loose = fast_and_loose if os.path.splitext(test_suite)[1] == '.apk': self.test_package = TestPackageApk( self.adb, device, test_suite, timeout, rebaseline, performance_test, cleanup_test_files, tool, self.dump_debug_info) else: self.test_package = TestPackageExecutable( self.adb, device, test_suite, timeout, rebaseline, performance_test, cleanup_test_files, tool, self.dump_debug_info)
def __init__(self, device, test_suite, gtest_filter, test_arguments, timeout, rebaseline, performance_test, cleanup_test_files, tool_name, shard_index, dump_debug_info, fast_and_loose, build_type, in_webkit_checkout): BaseTestRunner.__init__(self, device, tool_name, shard_index, build_type) self._running_on_emulator = self.device.startswith('emulator') self._gtest_filter = gtest_filter self._test_arguments = test_arguments self.test_results = TestResults() if dump_debug_info: self.dump_debug_info = debug_info.GTestDebugInfo(self.adb, device, os.path.basename(test_suite), gtest_filter) else: self.dump_debug_info = None self.fast_and_loose = fast_and_loose self.in_webkit_checkout = in_webkit_checkout logging.warning('Test suite: ' + test_suite) if os.path.splitext(test_suite)[1] == '.apk': self.test_package = TestPackageApk(self.adb, device, test_suite, timeout, rebaseline, performance_test, cleanup_test_files, self.tool, self.dump_debug_info) else: # Put a copy into the android out/target directory, to allow stack trace # generation. symbols_dir = os.path.join(constants.CHROME_DIR, 'out', build_type, 'lib.target') self.test_package = TestPackageExecutable( self.adb, device, test_suite, timeout, rebaseline, performance_test, cleanup_test_files, self.tool, self.dump_debug_info, symbols_dir) self._performance_test_setup = None if performance_test: self._performance_test_setup = perf_tests_helper.PerfTestSetup(self.adb)
def __init__(self, device, test_suite, gtest_filter, test_arguments, timeout, rebaseline, performance_test, cleanup_test_files, tool_name, shard_index, dump_debug_info, fast_and_loose, build_type): BaseTestRunner.__init__(self, device, tool_name, shard_index, build_type) self._running_on_emulator = self.device.startswith('emulator') self._gtest_filter = gtest_filter self._test_arguments = test_arguments self.test_results = TestResults() if dump_debug_info: self.dump_debug_info = debug_info.GTestDebugInfo(self.adb, device, os.path.basename(test_suite), gtest_filter) else: self.dump_debug_info = None self.fast_and_loose = fast_and_loose logging.warning('Test suite: ' + test_suite) if os.path.splitext(test_suite)[1] == '.apk': self.test_package = TestPackageApk(self.adb, device, test_suite, timeout, rebaseline, performance_test, cleanup_test_files, self.tool, self.dump_debug_info) else: self.test_package = TestPackageExecutable( self.adb, device, test_suite, timeout, rebaseline, performance_test, cleanup_test_files, self.tool, self.dump_debug_info) self._performance_test_setup = None if performance_test: self._performance_test_setup = perf_tests_helper.PerfTestSetup(self.adb)
def __init__(self, device, test_suite, gtest_filter, test_arguments, timeout, cleanup_test_files, tool_name, shard_index, dump_debug_info, fast_and_loose, build_type, in_webkit_checkout): BaseTestRunner.__init__(self, device, tool_name, shard_index, build_type) self._running_on_emulator = self.device.startswith('emulator') self._gtest_filter = gtest_filter self._test_arguments = test_arguments self.test_results = TestResults() if dump_debug_info: self.dump_debug_info = debug_info.GTestDebugInfo( self.adb, device, os.path.basename(test_suite), gtest_filter) else: self.dump_debug_info = None self.fast_and_loose = fast_and_loose self.in_webkit_checkout = in_webkit_checkout logging.warning('Test suite: ' + test_suite) if os.path.splitext(test_suite)[1] == '.apk': self.test_package = TestPackageApk(self.adb, device, test_suite, timeout, cleanup_test_files, self.tool, self.dump_debug_info) else: # Put a copy into the android out/target directory, to allow stack trace # generation. symbols_dir = os.path.join(constants.CHROME_DIR, 'out', build_type, 'lib.target') self.test_package = TestPackageExecutable( self.adb, device, test_suite, timeout, cleanup_test_files, self.tool, self.dump_debug_info, symbols_dir)
def __init__(self, device, test_suite, gtest_filter, test_arguments, timeout, rebaseline, performance_test, cleanup_test_files, tool_name, shard_index, dump_debug_info, fast_and_loose, build_type): BaseTestRunner.__init__(self, device, tool_name, shard_index, build_type) self._running_on_emulator = self.device.startswith('emulator') self._gtest_filter = gtest_filter self._test_arguments = test_arguments self.test_results = TestResults() if dump_debug_info: self.dump_debug_info = debug_info.GTestDebugInfo( self.adb, device, os.path.basename(test_suite), gtest_filter) else: self.dump_debug_info = None self.fast_and_loose = fast_and_loose logging.warning('Test suite: ' + test_suite) if os.path.splitext(test_suite)[1] == '.apk': self.test_package = TestPackageApk(self.adb, device, test_suite, timeout, rebaseline, performance_test, cleanup_test_files, self.tool, self.dump_debug_info) else: self.test_package = TestPackageExecutable( self.adb, device, test_suite, timeout, rebaseline, performance_test, cleanup_test_files, self.tool, self.dump_debug_info) self._performance_test_setup = None if performance_test: self._performance_test_setup = perf_tests_helper.PerfTestSetup( self.adb)
def __init__(self, device, test_suite, gtest_filter, test_arguments, timeout, rebaseline, performance_test, cleanup_test_files, tool, shard_index, dump_debug_info=False, fast_and_loose=False): BaseTestRunner.__init__(self, device, shard_index) self._running_on_emulator = self.device.startswith('emulator') self._gtest_filter = gtest_filter self._test_arguments = test_arguments self.test_results = TestResults() if dump_debug_info: self.dump_debug_info = debug_info.GTestDebugInfo(self.adb, device, os.path.basename(test_suite), gtest_filter) else: self.dump_debug_info = None self.fast_and_loose = fast_and_loose # Below if condition was intentionally removed from upstream as Java based # unit tests hasn't been ready yet. if os.path.splitext(test_suite)[1] == '.apk': self.test_package = TestPackageApk(self.adb, device, test_suite, timeout, rebaseline, performance_test, cleanup_test_files, tool, self.dump_debug_info) else: # The symbols_dir was intentionally removed from upstream as # ANDROID_PRODUCT_OUT is not available in upstream and we don't want to # expose that we are working on Android source tree. # Put a copy into the android out/target directory, to allow stack trace # generation. android_product_out = os.environ['ANDROID_PRODUCT_OUT'] symbols_dir = os.path.join(android_product_out, 'symbols', 'data', 'local') self.test_package = TestPackageExecutable(self.adb, device, test_suite, timeout, rebaseline, performance_test, cleanup_test_files, tool, self.dump_debug_info, symbols_dir)
def __init__(self, options, device, tests_iter, coverage, shard_index, apks, ports_to_forward): """Create a new TestRunner. Args: options: An options object with the following required attributes: - build_type: 'Release' or 'Debug'. - install_apk: Re-installs the apk if opted. - save_perf_json: Whether or not to save the JSON file from UI perf tests. - screenshot_failures: Take a screenshot for a test failure - tool: Name of the Valgrind tool. - wait_for_debugger: blocks until the debugger is connected. - disable_assertions: Whether to disable java assertions on the device. device: Attached android device. tests_iter: A list of tests to be run. coverage: Collects coverage information if opted. shard_index: shard # for this TestRunner, used to create unique port numbers. apks: A list of ApkInfo objects need to be installed. The first element should be the tests apk, the rests could be the apks used in test. The default is ChromeTest.apk. ports_to_forward: A list of port numbers for which to set up forwarders. Can be optionally requested by a test case. Raises: FatalTestException: if coverage metadata is not available. """ BaseTestRunner.__init__(self, device, options.tool, shard_index, options.build_type) if not apks: apks = [ apk_info.ApkInfo(options.test_apk_path, options.test_apk_jar_path) ] self.build_type = options.build_type self.install_apk = options.install_apk self.test_data = options.test_data self.save_perf_json = options.save_perf_json self.screenshot_failures = options.screenshot_failures self.wait_for_debugger = options.wait_for_debugger self.disable_assertions = options.disable_assertions self.tests_iter = tests_iter self.coverage = coverage self.apks = apks self.test_apk = apks[0] self.instrumentation_class_path = self.test_apk.GetPackageName() self.ports_to_forward = ports_to_forward self.test_results = TestResults() self.forwarder = None if self.coverage: if os.path.exists(TestRunner._COVERAGE_MERGED_FILENAME): os.remove(TestRunner._COVERAGE_MERGED_FILENAME) if not os.path.exists(TestRunner._COVERAGE_META_INFO_PATH): raise FatalTestException('FATAL ERROR in ' + sys.argv[0] + ' : Coverage meta info [' + TestRunner._COVERAGE_META_INFO_PATH + '] does not exist.') if (not TestRunner._COVERAGE_WEB_ROOT_DIR or not os.path.exists(TestRunner._COVERAGE_WEB_ROOT_DIR)): raise FatalTestException( 'FATAL ERROR in ' + sys.argv[0] + ' : Path specified in $EMMA_WEB_ROOTDIR [' + TestRunner._COVERAGE_WEB_ROOT_DIR + '] does not exist.')
def __init__(self, options, device, tests_iter, coverage, shard_index, apks, ports_to_forward): """Create a new TestRunner. Args: options: An options object with the following required attributes: - build_type: 'Release' or 'Debug'. - install_apk: Re-installs the apk if opted. - save_perf_json: Whether or not to save the JSON file from UI perf tests. - screenshot_failures: Take a screenshot for a test failure - tool: Name of the Valgrind tool. - wait_for_debugger: blocks until the debugger is connected. - disable_assertions: Whether to disable java assertions on the device. device: Attached android device. tests_iter: A list of tests to be run. coverage: Collects coverage information if opted. shard_index: shard # for this TestRunner, used to create unique port numbers. apks: A list of ApkInfo objects need to be installed. The first element should be the tests apk, the rests could be the apks used in test. The default is ChromeTest.apk. ports_to_forward: A list of port numbers for which to set up forwarders. Can be optionally requested by a test case. Raises: FatalTestException: if coverage metadata is not available. """ BaseTestRunner.__init__( self, device, options.tool, shard_index, options.build_type) if not apks: apks = [apk_info.ApkInfo(options.test_apk_path, options.test_apk_jar_path)] self.build_type = options.build_type self.install_apk = options.install_apk self.save_perf_json = options.save_perf_json self.screenshot_failures = options.screenshot_failures self.wait_for_debugger = options.wait_for_debugger self.disable_assertions = options.disable_assertions self.tests_iter = tests_iter self.coverage = coverage self.apks = apks self.test_apk = apks[0] self.instrumentation_class_path = self.test_apk.GetPackageName() self.ports_to_forward = ports_to_forward self.test_results = TestResults() self.forwarder = None if self.coverage: if os.path.exists(TestRunner._COVERAGE_MERGED_FILENAME): os.remove(TestRunner._COVERAGE_MERGED_FILENAME) if not os.path.exists(TestRunner._COVERAGE_META_INFO_PATH): raise FatalTestException('FATAL ERROR in ' + sys.argv[0] + ' : Coverage meta info [' + TestRunner._COVERAGE_META_INFO_PATH + '] does not exist.') if (not TestRunner._COVERAGE_WEB_ROOT_DIR or not os.path.exists(TestRunner._COVERAGE_WEB_ROOT_DIR)): raise FatalTestException('FATAL ERROR in ' + sys.argv[0] + ' : Path specified in $EMMA_WEB_ROOTDIR [' + TestRunner._COVERAGE_WEB_ROOT_DIR + '] does not exist.')
def __init__(self, device): BaseTestRunner.__init__(self, device, 0) self.trace = None