| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 def generate_tests(api, test_suite, revision, enable_swarming=False): | 6 def generate_tests(api, test_suite, revision, enable_swarming=False): |
| 7 tests = [] | 7 tests = [] |
| 8 | 8 |
| 9 if test_suite == 'webrtc': | 9 if test_suite == 'webrtc': |
| 10 for test, extra_args in sorted(api.NORMAL_TESTS.items()): | 10 for test, extra_args in sorted(api.NORMAL_TESTS.items()): |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 # http://crbug.com/589101 | 32 # http://crbug.com/589101 |
| 33 if api.m.platform.is_mac or api.m.platform.is_win: | 33 if api.m.platform.is_mac or api.m.platform.is_win: |
| 34 tests.append(BaremetalTest('audio_device_tests', revision)) | 34 tests.append(BaremetalTest('audio_device_tests', revision)) |
| 35 | 35 |
| 36 tests.extend([ | 36 tests.extend([ |
| 37 BaremetalTest('voe_auto_test', revision, args=['--automated']), | 37 BaremetalTest('voe_auto_test', revision, args=['--automated']), |
| 38 BaremetalTest('video_capture_tests', revision), | 38 BaremetalTest('video_capture_tests', revision), |
| 39 ]) | 39 ]) |
| 40 if not api.m.tryserver.is_tryserver: | 40 if not api.m.tryserver.is_tryserver: |
| 41 tests.append(BaremetalTest('webrtc_perf_tests', revision, perf_test=True)) | 41 tests.append(BaremetalTest('webrtc_perf_tests', revision, perf_test=True)) |
| 42 elif test_suite == 'android_swarming' or test_suite == 'android_perf': | 42 elif (test_suite == 'android_perf' and not api.m.tryserver.is_tryserver |
| 43 for test, extra_args in sorted(api.ANDROID_DEVICE_TESTS.items()): | 43 and api.c.PERF_ID and api.m.chromium.c.BUILD_CONFIG == 'Release'): |
| 44 tests.append(AndroidTest(test, enable_swarming, **extra_args)) | 44 tests.append(AndroidPerfTest('webrtc_perf_tests', revision, |
| 45 if (test_suite == 'android_perf' and not api.m.tryserver.is_tryserver | 45 perf_id=api.c.PERF_ID)) |
| 46 and api.c.PERF_ID and api.m.chromium.c.BUILD_CONFIG == 'Release'): | 46 elif test_suite == 'android_swarming': |
| 47 tests.append(AndroidPerfTest('webrtc_perf_tests', revision, | 47 for test, extra_args in (sorted(api.ANDROID_DEVICE_TESTS.items()) + |
| 48 perf_id=api.c.PERF_ID)) | 48 sorted(api.ANDROID_INSTRUMENTATION_TESTS.items())): |
| 49 for test, extra_args in sorted(api.ANDROID_INSTRUMENTATION_TESTS.items()): | 49 tests.append(Test(test, enable_swarming, **extra_args)) |
| 50 tests.append(AndroidInstrumentationTest(test, enable_swarming, | |
| 51 **extra_args)) | |
| 52 if test_suite == 'android_swarming': | |
| 53 for test, extra_args in sorted(api.ANDROID_JUNIT_TESTS.items()): | 50 for test, extra_args in sorted(api.ANDROID_JUNIT_TESTS.items()): |
| 54 tests.append(AndroidJunitTest(test, False, **extra_args)) | 51 tests.append(AndroidJunitTest(test, False, **extra_args)) |
| 55 | 52 |
| 56 return tests | 53 return tests |
| 57 | 54 |
| 58 | 55 |
| 59 # TODO(kjellander): Continue refactoring an integrate the classes in the | 56 # TODO(kjellander): Continue refactoring an integrate the classes in the |
| 60 # chromium_tests recipe module instead (if possible). | 57 # chromium_tests recipe module instead (if possible). |
| 61 class Test(object): | 58 class Test(object): |
| 62 def __init__(self, name, enable_swarming=False, shards=1): | 59 def __init__(self, name, enable_swarming=False, shards=1): |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 **self._runtest_kwargs) | 103 **self._runtest_kwargs) |
| 107 | 104 |
| 108 | 105 |
| 109 class BaremetalTest(WebRTCTest): | 106 class BaremetalTest(WebRTCTest): |
| 110 """A WebRTC desktop test that uses audio and/or video devices.""" | 107 """A WebRTC desktop test that uses audio and/or video devices.""" |
| 111 def __init__(self, name, revision, perf_test=False, **runtest_kwargs): | 108 def __init__(self, name, revision, perf_test=False, **runtest_kwargs): |
| 112 # Tests accessing hardware devices shouldn't be run in parallel. | 109 # Tests accessing hardware devices shouldn't be run in parallel. |
| 113 super(BaremetalTest, self).__init__(name, revision, parallel=False, | 110 super(BaremetalTest, self).__init__(name, revision, parallel=False, |
| 114 perf_test=perf_test, **runtest_kwargs) | 111 perf_test=perf_test, **runtest_kwargs) |
| 115 | 112 |
| 116 | |
| 117 def get_android_tool(api): | |
| 118 if api.m.chromium.c.gyp_env.GYP_DEFINES.get('asan', 0) == 1: | |
| 119 return 'asan' | |
| 120 return None | |
| 121 | |
| 122 | |
| 123 class AndroidTest(Test): | |
| 124 """Runs a simple Android test.""" | |
| 125 | |
| 126 def run_nonswarming(self, api, suffix): | |
| 127 api.m.chromium_android.run_test_suite(self._name, | |
| 128 tool=get_android_tool(api)) | |
| 129 | |
| 130 | |
| 131 class AndroidInstrumentationTest(Test): | |
| 132 """Installs the APK on the device and runs the test.""" | |
| 133 | |
| 134 def run_nonswarming(self, api, suffix): | |
| 135 api.m.chromium_android.run_instrumentation_suite( | |
| 136 name=self._name, | |
| 137 wrapper_script_suite_name=self._name, | |
| 138 tool=get_android_tool(api), | |
| 139 verbose=True) | |
| 140 | |
| 141 class AndroidJunitTest(Test): | 113 class AndroidJunitTest(Test): |
| 142 """Runs an Android Junit test.""" | 114 """Runs an Android Junit test.""" |
| 143 | 115 |
| 144 def run_nonswarming(self, api, suffix): | 116 def run_nonswarming(self, api, suffix): |
| 145 api.m.chromium_android.run_java_unit_test_suite(self._name) | 117 api.m.chromium_android.run_java_unit_test_suite(self._name) |
| 146 | 118 |
| 147 class AndroidPerfTest(Test): | 119 class AndroidPerfTest(Test): |
| 148 """A performance test to run on Android devices. | 120 """A performance test to run on Android devices. |
| 149 | 121 |
| 150 Basically just wrap what happens in chromium_android.run_test_suite to run | 122 Basically just wrap what happens in chromium_android.run_test_suite to run |
| (...skipping 15 matching lines...) Expand all Loading... |
| 166 'run_%s' % self._name) | 138 'run_%s' % self._name) |
| 167 args = ['--verbose'] | 139 args = ['--verbose'] |
| 168 api.add_test(name=self._name, | 140 api.add_test(name=self._name, |
| 169 test=wrapper_script, | 141 test=wrapper_script, |
| 170 args=args, | 142 args=args, |
| 171 revision=self._revision, | 143 revision=self._revision, |
| 172 python_mode=True, | 144 python_mode=True, |
| 173 perf_test=True, | 145 perf_test=True, |
| 174 perf_dashboard_id=self._name) | 146 perf_dashboard_id=self._name) |
| 175 | 147 |
| OLD | NEW |