| OLD | NEW |
| (Empty) |
| 1 | |
| 2 DEPS = [ | |
| 3 'amp', | |
| 4 'recipe_engine/json', | |
| 5 'recipe_engine/path', | |
| 6 'recipe_engine/properties', | |
| 7 ] | |
| 8 | |
| 9 BUILDERS = { | |
| 10 'normal_example': { | |
| 11 'device_name': ['SampleDevice'], | |
| 12 'device_os': ['SampleDeviceOS'], | |
| 13 'api_address': '127.0.0.1', | |
| 14 'api_port': '80', | |
| 15 'api_protocol': 'http', | |
| 16 }, | |
| 17 'no_device_name': { | |
| 18 'device_os': ['SampleDeviceOS'], | |
| 19 'api_address': '127.0.0.1', | |
| 20 'api_port': '80', | |
| 21 'api_protocol': 'http', | |
| 22 }, | |
| 23 'no_device_os': { | |
| 24 'device_name': ['SampleDevice'], | |
| 25 'api_address': '127.0.0.1', | |
| 26 'api_port': '80', | |
| 27 'api_protocol': 'http', | |
| 28 }, | |
| 29 'split_example': { | |
| 30 'device_name': ['SampleDevice'], | |
| 31 'device_os': ['SampleDeviceOS'], | |
| 32 'api_address': '127.0.0.1', | |
| 33 'api_port': '80', | |
| 34 'api_protocol': 'http', | |
| 35 }, | |
| 36 'multiple_devices': { | |
| 37 'device_name': ['SampleDevice0', 'SampleDevice1'], | |
| 38 'device_os': ['SampleDeviceOS'], | |
| 39 'api_address': '127.0.0.1', | |
| 40 'api_port': '80', | |
| 41 'api_protocol': 'http', | |
| 42 }, | |
| 43 'multiple_device_oses': { | |
| 44 'device_name': ['SampleDevice'], | |
| 45 'device_os': ['SampleDeviceOS0', 'SampleDeviceOS1'], | |
| 46 'api_address': '127.0.0.1', | |
| 47 'api_port': '80', | |
| 48 'api_protocol': 'http', | |
| 49 }, | |
| 50 'device_oem': { | |
| 51 'device_name': ['SampleDevice'], | |
| 52 'device_oem': ['SampleDeviceOEM'], | |
| 53 'device_os': ['SampleDeviceOS'], | |
| 54 'api_address': '127.0.0.1', | |
| 55 'api_port': '80', | |
| 56 'api_protocol': 'http', | |
| 57 }, | |
| 58 'minimum_device_os': { | |
| 59 'device_minimum_os': 'MinimumSampleDeviceOS', | |
| 60 'device_name': ['SampleDevice'], | |
| 61 'api_address': '127.0.0.1', | |
| 62 'api_port': '80', | |
| 63 'api_protocol': 'http', | |
| 64 }, | |
| 65 'underspecified_with_timeout': { | |
| 66 'device_minimum_os': 'MinimumSampleDeviceOS', | |
| 67 'device_name': ['SampleDevice0', 'SampleDevice1'], | |
| 68 'device_timeout': 60, | |
| 69 'api_address': '127.0.0.1', | |
| 70 'api_port': '80', | |
| 71 'api_protocol': 'http', | |
| 72 }, | |
| 73 'network_config_set': { | |
| 74 'device_name': ['SampleDevice'], | |
| 75 'device_os': ['SampleDeviceOS'], | |
| 76 'api_address': '127.0.0.1', | |
| 77 'api_port': '80', | |
| 78 'api_protocol': 'http', | |
| 79 'network_config': 8, # Sprint 4G 1 Bar | |
| 80 }, | |
| 81 'slow_tests': { | |
| 82 'device_name': ['SampleDevice'], | |
| 83 'device_os': ['SampleDeviceOS'], | |
| 84 'api_address': '127.0.0.1', | |
| 85 'api_port': '80', | |
| 86 'api_protocol': 'http', | |
| 87 'timeout_scale': 10, | |
| 88 'test_run_timeout': 3600, | |
| 89 }, | |
| 90 } | |
| 91 | |
| 92 AMP_RESULTS_BUCKET = 'chrome-amp-results' | |
| 93 | |
| 94 from recipe_engine.recipe_api import Property | |
| 95 | |
| 96 PROPERTIES = { | |
| 97 'buildername': Property(), | |
| 98 } | |
| 99 | |
| 100 def RunSteps(api, buildername): | |
| 101 api.amp.setup() | |
| 102 api.amp.set_config('main_pool') | |
| 103 | |
| 104 builder = BUILDERS[buildername] | |
| 105 api.path['checkout'] = api.path['slave_build'].join('src') | |
| 106 | |
| 107 gtest_test_id = api.amp.trigger_test_suite( | |
| 108 'example_gtest_suite', 'gtest', | |
| 109 api.amp.gtest_arguments('example_gtest_suite'), | |
| 110 api.amp.amp_arguments( | |
| 111 device_minimum_os=builder.get('device_minimum_os', None), | |
| 112 device_name=builder.get('device_name', None), | |
| 113 device_oem=builder.get('device_oem', None), | |
| 114 device_os=builder.get('device_os', None), | |
| 115 device_timeout=builder.get('device_timeout', None), | |
| 116 api_address=builder.get('api_address', None), | |
| 117 api_port=builder.get('api_port', None), | |
| 118 api_protocol=builder.get('api_protocol', None), | |
| 119 network_config=builder.get('network_config', None))) | |
| 120 | |
| 121 instrumentation_test_id = api.amp.trigger_test_suite( | |
| 122 'example_instrumentation_suite', 'instrumentation', | |
| 123 api.amp.instrumentation_test_arguments( | |
| 124 apk_under_test='ApkUnderTest.apk', | |
| 125 test_apk='TestApk.apk', | |
| 126 additional_apks=['ExtraApk1.apk', 'ExtraApk2.apk'], | |
| 127 isolate_file_path='isolate_file.isolate', | |
| 128 annotation='SmallTest', | |
| 129 timeout_scale=builder.get('timeout_scale')), | |
| 130 api.amp.amp_arguments( | |
| 131 device_minimum_os=builder.get('device_minimum_os', None), | |
| 132 device_name=builder.get('device_name', None), | |
| 133 device_oem=builder.get('device_oem', None), | |
| 134 device_os=builder.get('device_os', None), | |
| 135 device_timeout=builder.get('device_timeout', None), | |
| 136 api_address=builder.get('api_address', None), | |
| 137 api_port=builder.get('api_port', None), | |
| 138 api_protocol=builder.get('api_protocol', None), | |
| 139 network_config=builder.get('network_config', None), | |
| 140 test_run_timeout=builder.get('test_run_timeout'))) | |
| 141 | |
| 142 uirobot_test_id = api.amp.trigger_test_suite( | |
| 143 'example_uirobot_suite', 'uirobot', | |
| 144 api.amp.uirobot_arguments(app_under_test='Example.apk'), | |
| 145 api.amp.amp_arguments( | |
| 146 device_minimum_os=builder.get('device_minimum_os', None), | |
| 147 device_name=builder.get('device_name', None), | |
| 148 device_oem=builder.get('device_oem', None), | |
| 149 device_os=builder.get('device_os', None), | |
| 150 device_timeout=builder.get('device_timeout', None), | |
| 151 api_address=builder.get('api_address', None), | |
| 152 api_port=builder.get('api_port', None), | |
| 153 api_protocol=builder.get('api_protocol', None), | |
| 154 network_config=builder.get('network_config', None))) | |
| 155 | |
| 156 api.amp.collect_test_suite( | |
| 157 'example_gtest_suite', 'gtest', | |
| 158 api.amp.gtest_arguments('example_gtest_suite'), | |
| 159 api.amp.amp_arguments(api_address=builder.get('api_address', None), | |
| 160 api_port=builder.get('api_port', None), | |
| 161 api_protocol=builder.get('api_protocol', None)), | |
| 162 test_run_id=gtest_test_id) | |
| 163 | |
| 164 api.amp.upload_logcat_to_gs( | |
| 165 AMP_RESULTS_BUCKET, 'example_gtest_suite', test_run_id=gtest_test_id) | |
| 166 | |
| 167 api.amp.collect_test_suite( | |
| 168 'example_instrumentation_suite', | |
| 169 'instrumentation', | |
| 170 api.amp.instrumentation_test_arguments( | |
| 171 apk_under_test='ApkUnderTest.apk', | |
| 172 test_apk='TestApk.apk'), | |
| 173 api.amp.amp_arguments( | |
| 174 api_address=builder.get('api_address', None), | |
| 175 api_port=builder.get('api_port', None), | |
| 176 api_protocol=builder.get('api_protocol', None)), | |
| 177 test_run_id=instrumentation_test_id) | |
| 178 | |
| 179 api.amp.upload_logcat_to_gs( | |
| 180 AMP_RESULTS_BUCKET, 'example_instrumentation_suite', | |
| 181 test_run_id=instrumentation_test_id) | |
| 182 | |
| 183 api.amp.collect_test_suite( | |
| 184 'example_uirobot_suite', 'uirobot', | |
| 185 api.amp.uirobot_arguments(), | |
| 186 api.amp.amp_arguments(api_address=builder.get('api_address', None), | |
| 187 api_port=builder.get('api_port', None), | |
| 188 api_protocol=builder.get('api_protocol', None)), | |
| 189 test_run_id=uirobot_test_id) | |
| 190 | |
| 191 api.amp.upload_logcat_to_gs( | |
| 192 AMP_RESULTS_BUCKET, 'example_uirobot_suite', test_run_id=uirobot_test_id) | |
| 193 | |
| 194 def GenTests(api): | |
| 195 for buildername in BUILDERS: | |
| 196 yield ( | |
| 197 api.test('%s_basic' % buildername) + | |
| 198 api.properties.generic(buildername=buildername)) | |
| 199 | |
| 200 yield ( | |
| 201 api.test('bad_device_data_from_trigger') + | |
| 202 api.properties.generic(buildername='split_example') + | |
| 203 api.override_step_data('[trigger] example_gtest_suite', | |
| 204 api.json.output({}))) | |
| 205 | |
| 206 yield ( | |
| 207 api.test('bad_device_data_for_collect') + | |
| 208 api.properties.generic(buildername='split_example') + | |
| 209 api.override_step_data('[collect] load example_gtest_suite', | |
| 210 api.json.output({}))) | |
| 211 | |
| 212 yield ( | |
| 213 api.test('bad_test_id_data_for_upload') + | |
| 214 api.properties.generic(buildername='split_example') + | |
| 215 api.override_step_data('[upload logcat] load example_gtest_suite data', | |
| 216 api.json.output({}))) | |
| OLD | NEW |