Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: tools/nanobench_flags.py

Issue 2184423002: Make coverage.py optional for dm and nanobench _flags.py (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/dm_flags.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # 1 #
2 # Copyright 2015 Google Inc. 2 # Copyright 2015 Google Inc.
3 # 3 #
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 # 6 #
7 7
8 #!/usr/bin/env python 8 #!/usr/bin/env python
9 9
10 usage = ''' 10 usage = '''
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 if match: 138 if match:
139 args.append('--match') 139 args.append('--match')
140 args.extend(match) 140 args.extend(match)
141 141
142 return args 142 return args
143 cov_end = lineno() # Don't care about code coverage past here. 143 cov_end = lineno() # Don't care about code coverage past here.
144 144
145 145
146 def self_test(): 146 def self_test():
147 import coverage # This way the bots don't need coverage.py to be installed.
148 args = {} 147 args = {}
149 cases = [ 148 cases = [
150 'Perf-Android-GCC-Nexus6-GPU-Adreno420-Arm7-Release', 149 'Perf-Android-GCC-Nexus6-GPU-Adreno420-Arm7-Release',
151 'Perf-Android-Nexus7-Tegra3-Arm7-Release', 150 'Perf-Android-Nexus7-Tegra3-Arm7-Release',
152 'Perf-Android-GCC-NexusPlayer-GPU-PowerVR-x86-Release', 151 'Perf-Android-GCC-NexusPlayer-GPU-PowerVR-x86-Release',
153 'Perf-Android-GCC-GalaxyS3-GPU-Mali400-Arm7-Release', 152 'Perf-Android-GCC-GalaxyS3-GPU-Mali400-Arm7-Release',
154 'Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind', 153 'Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind',
155 'Test-Win7-MSVC-ShuttleA-GPU-HD2000-x86-Debug-ANGLE', 154 'Test-Win7-MSVC-ShuttleA-GPU-HD2000-x86-Debug-ANGLE',
156 'Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Debug', 155 'Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Debug',
157 'Test-Android-GCC-GalaxyS4-GPU-SGX544-Arm7-Release', 156 'Test-Android-GCC-GalaxyS4-GPU-SGX544-Arm7-Release',
158 'Perf-Android-GCC-NVIDIA_Shield-GPU-TegraX1-Arm64-Release', 157 'Perf-Android-GCC-NVIDIA_Shield-GPU-TegraX1-Arm64-Release',
159 'Perf-Android-GCC-NVIDIA_Shield-GPU-TegraX1-Arm64-Release-Vulkan', 158 'Perf-Android-GCC-NVIDIA_Shield-GPU-TegraX1-Arm64-Release-Vulkan',
160 'Perf-Android-GCC-Nexus5-GPU-Adreno330-Arm7-Release', 159 'Perf-Android-GCC-Nexus5-GPU-Adreno330-Arm7-Release',
161 ] 160 ]
162 161
163 cov = coverage.coverage() 162 this_file = os.path.basename(__file__)
164 cov.start() 163 try:
165 for case in cases: 164 import coverage
166 args[case] = get_args(case) 165 cov = coverage.coverage()
167 cov.stop() 166 cov.start()
167 for case in cases:
168 args[case] = get_args(case)
169 cov.stop()
168 170
169 this_file = os.path.basename(__file__) 171 _, _, not_run, _ = cov.analysis(this_file)
170 _, _, not_run, _ = cov.analysis(this_file) 172 filtered = [line for line in not_run if line > cov_start and line < cov_end]
171 filtered = [line for line in not_run if line > cov_start and line < cov_end] 173 if filtered:
172 if filtered: 174 print 'Lines not covered by test cases: ', filtered
173 print 'Lines not covered by test cases: ', filtered 175 sys.exit(1)
174 sys.exit(1) 176 except ImportError:
177 print ("We cannot guarantee that this files tests are comprehensive " +
178 "without coverage.py. Please install it when you get a chance.")
175 179
176 golden = this_file.replace('.py', '.json') 180 golden = this_file.replace('.py', '.json')
177 with open(os.path.join(os.path.dirname(__file__), golden), 'w') as f: 181 with open(os.path.join(os.path.dirname(__file__), golden), 'w') as f:
178 json.dump(args, f, indent=2, sort_keys=True) 182 json.dump(args, f, indent=2, sort_keys=True)
179 183
180 184
181 if __name__ == '__main__': 185 if __name__ == '__main__':
182 if len(sys.argv) == 2 and sys.argv[1] == 'test': 186 if len(sys.argv) == 2 and sys.argv[1] == 'test':
183 self_test() 187 self_test()
184 sys.exit(0) 188 sys.exit(0)
185 189
186 if len(sys.argv) != 3: 190 if len(sys.argv) != 3:
187 print usage 191 print usage
188 sys.exit(1) 192 sys.exit(1)
189 193
190 with open(sys.argv[1], 'w') as out: 194 with open(sys.argv[1], 'w') as out:
191 json.dump(get_args(sys.argv[2]), out) 195 json.dump(get_args(sys.argv[2]), out)
OLDNEW
« no previous file with comments | « tools/dm_flags.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698