Chromium Code Reviews| Index: scripts/slave/recipe_modules/chromium/steps.py |
| diff --git a/scripts/slave/recipe_modules/chromium/steps.py b/scripts/slave/recipe_modules/chromium/steps.py |
| index 33f9e4ac64e0e66e90e6df2731e6a877ea4fdfca..c8faa75dbc298ef3a146960ce757a424e98b532c 100644 |
| --- a/scripts/slave/recipe_modules/chromium/steps.py |
| +++ b/scripts/slave/recipe_modules/chromium/steps.py |
| @@ -618,15 +618,97 @@ class SwarmingGTestTest(SwarmingTest): |
| return True, gtest_results.failures |
| +class AMPGTestTest(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, args=None, target_name=None, |
| + android_isolate_path=None, **runtest_kwargs): |
| + self._name = name |
| + 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) |
| + |
| + @property |
| + def name(self): |
| + return self._name |
| + |
| + @property |
| + def target_name(self): |
| + return self._local_test.target_name |
| + |
| + @property |
| + def isolate_target(self): |
| + return self._local_test.isolate_target |
| + |
| + def compile_targets(self, api): |
| + return self._local_test.compile_targets(api) |
| + |
| + def run(self, api, suffix): # pylint: disable=R0201 |
| + """Not used. All logic in pre_run, post_run.""" |
| + return [] |
| + |
| + def pre_run(self, api, suffix): |
| + """Triggers an AMP test.""" |
| + amp_arguments = api.amp.amp_arguments( |
|
navabi
2015/05/07 20:16:49
this is one reason i need the amp module here.
|
| + api_address=AMPGTestTest.AMP_INSTANCE_ADDRESS, |
| + api_port=AMPGTestTest.AMP_INSTANCE_PORT, |
| + api_protocol=AMPGTestTest.AMP_INSTANCE_PROTOCOL, |
| + device_minimum_os=builder.get('device_minimum_os'), |
| + device_name=builder.get('device_name'), |
| + device_os=builder.get('device_os'), |
| + device_timeout=builder.get('device_timeout')) |
| + |
| + isolate_file_path = (api.path['checkout'].join(self._android_isolate_path) |
| + if self._android_isolate_path else None) |
| + deferred_trigger_result = api.amp.trigger_test_suite( |
| + self._name, 'gtest', |
| + api.amp.gtest_arguments(self._name, |
| + isolate_file_path=isolate_file_path), |
| + amp_arguments) |
| + self._trigger_successful = deferred_trigger_result.is_ok |
| + |
| + def post_run(self, api, suffix): |
| + # If we were unable to successfully trigger the AMP job, run locally. |
|
Paweł Hajdan Jr.
2015/05/08 08:55:11
Why do we need this fallback logic? We don't do th
navabi
2015/05/18 15:51:49
It is needed. We need this fallback logic because
Paweł Hajdan Jr.
2015/06/08 09:33:21
I think it'd be helpful to include what you said a
navabi
2015/06/18 19:47:48
Done and done.
navabi
2015/06/18 21:20:58
Actually done and undone. We can't have the call t
Paweł Hajdan Jr.
2015/06/19 10:46:09
That's correct, the order of calls is like you sai
|
| + if not self._trigger_successful: |
| + return self._local_test.run(api, suffix) |
| + else: |
| + amp_arguments = api.amp.amp_arguments( |
| + api_address=AMPGTestTest.AMP_INSTANCE_ADDRESS, |
| + api_port=AMPGTestTest.AMP_INSTANCE_PORT, |
| + api_protocol=AMPGTestTest.AMP_INSTANCE_PROTOCOL, |
| + device_minimum_os=builder.get('device_minimum_os'), |
| + device_name=builder.get('device_name'), |
| + device_os=builder.get('device_os'), |
| + device_timeout=builder.get('device_timeout')) |
| + |
| + deferred_step_result = api.amp.collect_test_suite( |
| + self._name, 'gtest', api.amp.gtest_arguments(self._name), |
| + amp_arguments) |
| + self._test_runs[suffix] = deferred_step_result |
| + return deferred_step_result |
| + |
| + def has_valid_results(self, api, suffix): |
| + return self._local_test.has_valid_results(api, suffix) |
| + |
| + def failures(self, api, suffix): |
| + return self._local_test.failures(api, suffix) |
| + |
| + |
| class GTestTest(Test): |
| def __init__(self, name, args=None, target_name=None, enable_swarming=False, |
| swarming_shards=1, swarming_dimensions=None, swarming_tags=None, |
| - swarming_extra_suffix=None, **runtest_kwargs): |
| + swarming_extra_suffix=None, amp_test=False, **runtest_kwargs): |
| super(GTestTest, self).__init__() |
| if enable_swarming: |
| self._test = SwarmingGTestTest( |
| name, args, target_name, swarming_shards, swarming_dimensions, |
| swarming_tags, swarming_extra_suffix) |
| + elif amp_test: |
|
Paweł Hajdan Jr.
2015/05/08 08:55:11
Do we need to modify GTestTest? Why wouldn't calle
navabi
2015/05/18 15:51:49
This was to make it like SwarmingGTestTest. Notice
navabi
2015/06/18 19:47:48
Done. Now the callers use AMPGTestTest directly.
|
| + self._test = AMPGTestTest(name, args, target_name, **runtest_kwargs) |
| else: |
| self._test = LocalGTestTest(name, args, target_name, **runtest_kwargs) |