| Index: scripts/slave/recipe_modules/chromium_tests/steps.py
|
| diff --git a/scripts/slave/recipe_modules/chromium_tests/steps.py b/scripts/slave/recipe_modules/chromium_tests/steps.py
|
| index f8686380d82bb69fc11b703e7cda885a85fc1395..11c84745b88990258e1ee858be65890bcef9b439 100644
|
| --- a/scripts/slave/recipe_modules/chromium_tests/steps.py
|
| +++ b/scripts/slave/recipe_modules/chromium_tests/steps.py
|
| @@ -283,7 +283,8 @@ class LocalGTestTest(Test):
|
| return self.target_name
|
|
|
| def compile_targets(self, api):
|
| - if self._override_compile_targets:
|
| + # TODO(phajdan.jr): clean up override_compile_targets (remove or cover).
|
| + if self._override_compile_targets: # pragma: no cover
|
| return self._override_compile_targets
|
|
|
| if api.chromium.c.TARGET_PLATFORM == 'android':
|
| @@ -917,170 +918,6 @@ class SwarmingGTestTest(SwarmingTest):
|
| test_results_server='test-results.appspot.com')
|
|
|
|
|
| -# TODO(bpastene) Remove all AMP recipe code once all use of it has been
|
| -# discontinued. crbug.com/603943
|
| -class AMPTest(Test):
|
| - AMP_INSTANCE_ADDRESS = '172.22.21.180'
|
| - AMP_INSTANCE_PORT = '80'
|
| - AMP_INSTANCE_PROTOCOL = 'http'
|
| - AMP_RESULTS_BUCKET = 'chrome-amp-results'
|
| - def __init__(self, name, device_name=None, device_os=None, device_oem=None,
|
| - test_run_timeout=None):
|
| - self._name = name
|
| - self._device_name = device_name
|
| - self._device_os = device_os
|
| - self._device_oem = device_oem
|
| - self._test_run_id = None
|
| - self._test_run_timeout = test_run_timeout
|
| - self._trigger_successful = None
|
| - self._step_results = {}
|
| -
|
| - @property
|
| - def name(self):
|
| - return self._name
|
| -
|
| - def amp_arguments(self, api):
|
| - return api.amp.amp_arguments(
|
| - api_address=AMPTest.AMP_INSTANCE_ADDRESS,
|
| - api_port=AMPTest.AMP_INSTANCE_PORT,
|
| - api_protocol=AMPTest.AMP_INSTANCE_PROTOCOL,
|
| - device_name=self._device_name,
|
| - device_oem=self._device_oem,
|
| - device_os=self._device_os,
|
| - test_run_timeout=self._test_run_timeout)
|
| -
|
| - def pre_run(self, api, suffix, test_filter=None):
|
| - """Triggers an AMP test."""
|
| - isolate_file_path = (api.path['checkout'].join(self._android_isolate_path)
|
| - if self._android_isolate_path else None)
|
| - try:
|
| - self.trigger_test(api, suffix)
|
| - self._trigger_successful = True
|
| - except api.step.StepFailure:
|
| - self._trigger_successful = False
|
| -
|
| - def trigger_test(self, api, suffix):
|
| - self.test_run_id = api.amp.trigger_test_suite(
|
| - step_name=self._step_name(suffix),
|
| - suite=self.name,
|
| - test_type=self.test_type(),
|
| - test_type_args=self.test_type_args(api),
|
| - amp_args=self.amp_arguments(api))
|
| -
|
| - def test_type(self):
|
| - raise NotImplementedError() # pragma: no cover
|
| -
|
| - def test_type_args(self, api):
|
| - raise NotImplementedError() # pragma: no cover
|
| -
|
| - def run(self, api, suffix, test_filter=None):
|
| - self._step_results[suffix] = {'valid': False, 'failures': []}
|
| -
|
| - def post_run(self, api, suffix, test_filter=None):
|
| - if self._trigger_successful:
|
| - self.collect_test(api, suffix)
|
| -
|
| - def collect_test(self, api, suffix):
|
| - gtest_results_file = api.test_utils.gtest_results(add_json_log=False)
|
| - step_test_data = lambda: api.test_utils.test_api.canned_gtest_output(True)
|
| -
|
| - try:
|
| - api.amp.collect_test_suite(
|
| - step_name=self._step_name(suffix),
|
| - test_run_id=self.test_run_id,
|
| - suite=self.name, test_type=self.test_type(),
|
| - test_type_args=self.test_type_args(api),
|
| - amp_args=self.amp_arguments(api),
|
| - json_results_file=gtest_results_file,
|
| - step_test_data=step_test_data)
|
| - finally:
|
| - step_result = api.step.active_result
|
| - valid, failures = self.validate_task_results(api, step_result)
|
| - self._step_results[suffix] = {'valid': valid, 'failures': failures}
|
| -
|
| - def validate_task_results(self, api, step_result):
|
| - try:
|
| - gtest_results = step_result.test_utils.gtest_results
|
| - valid = gtest_results.valid
|
| - failures = gtest_results.failures
|
| - except (AttributeError, KeyError, ValueError): # pragma: no cover
|
| - valid = False
|
| - failures = None
|
| -
|
| - if valid:
|
| - step_result.presentation.step_text += api.test_utils.format_step_text([
|
| - ['failures:', failures]
|
| - ])
|
| -
|
| - return valid, failures
|
| -
|
| - def has_valid_results(self, api, suffix): # pragma: no cover
|
| - return suffix in self._step_results and self._step_results[suffix]['valid']
|
| -
|
| - def failures(self, api, suffix): # pragma: no cover
|
| - assert self.has_valid_results(api, suffix)
|
| - return self._step_results[suffix]['failures']
|
| -
|
| -
|
| -class AMPGTestTest(AMPTest):
|
| - def __init__(self, name, args=None, target_name=None, device_name=None,
|
| - device_os=None, device_oem=None, android_isolate_path=None,
|
| - test_run_timeout=None, **runtest_kwargs):
|
| - super(AMPGTestTest, self).__init__(
|
| - name=name, device_name=device_name, device_os=device_os,
|
| - device_oem=device_oem, test_run_timeout=test_run_timeout)
|
| - self._args = args
|
| - self._target_name = target_name
|
| - self._android_isolate_path = android_isolate_path
|
| - # LocalGTestTest is used when AMP tests are not triggered successfully.
|
| - self._local_test = LocalGTestTest(name, args, target_name, **runtest_kwargs)
|
| -
|
| - def compile_targets(self, api):
|
| - return self._local_test.compile_targets(api)
|
| -
|
| - #override
|
| - def test_type(self):
|
| - return 'gtest'
|
| -
|
| - #override
|
| - def test_type_args(self, api):
|
| - isolate_file_path = (api.path['checkout'].join(self._android_isolate_path)
|
| - if self._android_isolate_path else None)
|
| - return api.amp.gtest_arguments(
|
| - self.name, isolate_file_path=isolate_file_path)
|
| -
|
| -
|
| -class AMPInstrumentationTest(AMPTest):
|
| - def __init__(self, test_apk, apk_under_test, compile_target=None,
|
| - device_name=None, device_os=None, device_oem=None,
|
| - android_isolate_path=None, test_run_timeout=None,
|
| - test_timeout_scale=None):
|
| - super(AMPInstrumentationTest, self).__init__(
|
| - test_apk, device_name=device_name, device_os=device_os,
|
| - device_oem=device_oem, test_run_timeout=test_run_timeout)
|
| - self._apk_under_test = apk_under_test
|
| - self._compile_target = compile_target
|
| - self._android_isolate_path = android_isolate_path
|
| - self._test_timeout_scale = test_timeout_scale
|
| -
|
| - def compile_targets(self, api):
|
| - return [self._compile_target]
|
| -
|
| - #override
|
| - def test_type(self):
|
| - return 'instrumentation'
|
| -
|
| - #override
|
| - def test_type_args(self, api):
|
| - isolate_file_path = (api.path['checkout'].join(self._android_isolate_path)
|
| - if self._android_isolate_path else None)
|
| - return api.amp.instrumentation_test_arguments(
|
| - apk_under_test=self._apk_under_test,
|
| - test_apk=self.name,
|
| - isolate_file_path=isolate_file_path,
|
| - timeout_scale=self._test_timeout_scale)
|
| -
|
| -
|
| class LocalIsolatedScriptTest(Test):
|
| def __init__(self, name, args=None, target_name=None,
|
| override_compile_targets=None, **runtest_kwargs):
|
|
|