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

Side by Side Diff: build/android/pylib/instrumentation/instrumentation_test_instance.py

Issue 2580943002: Fix negative gtest filters for instrumentation tests. (Closed)
Patch Set: Reenabled test for negative filters Created 4 years 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 | « no previous file | build/android/pylib/instrumentation/instrumentation_test_instance_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import collections 5 import collections
6 import copy 6 import copy
7 import logging 7 import logging
8 import os 8 import os
9 import pickle 9 import pickle
10 import re 10 import re
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 # Allow fully-qualified name as well as an omitted package. 228 # Allow fully-qualified name as well as an omitted package.
229 unqualified_class_test = { 229 unqualified_class_test = {
230 'class': t['class'].split('.')[-1], 230 'class': t['class'].split('.')[-1],
231 'method': t['method'] 231 'method': t['method']
232 } 232 }
233 names = [ 233 names = [
234 GetTestName(t, sep='.'), 234 GetTestName(t, sep='.'),
235 GetTestName(unqualified_class_test, sep='.'), 235 GetTestName(unqualified_class_test, sep='.'),
236 GetUniqueTestName(t, sep='.') 236 GetUniqueTestName(t, sep='.')
237 ] 237 ]
238 return unittest_util.FilterTestNames(names, test_filter) 238
239 pattern_groups = test_filter.split('-')
240 if len(pattern_groups) > 1:
241 negative_filter = pattern_groups[1]
242 if unittest_util.FilterTestNames(names, negative_filter):
243 return []
244
245 positive_filter = pattern_groups[0]
246 return unittest_util.FilterTestNames(names, positive_filter)
239 247
240 def annotation_filter(all_annotations): 248 def annotation_filter(all_annotations):
241 if not annotations: 249 if not annotations:
242 return True 250 return True
243 return any_annotation_matches(annotations, all_annotations) 251 return any_annotation_matches(annotations, all_annotations)
244 252
245 def excluded_annotation_filter(all_annotations): 253 def excluded_annotation_filter(all_annotations):
246 if not excluded_annotations: 254 if not excluded_annotations:
247 return True 255 return True
248 return not any_annotation_matches(excluded_annotations, 256 return not any_annotation_matches(excluded_annotations,
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 804
797 @staticmethod 805 @staticmethod
798 def GenerateTestResults( 806 def GenerateTestResults(
799 result_code, result_bundle, statuses, start_ms, duration_ms): 807 result_code, result_bundle, statuses, start_ms, duration_ms):
800 return GenerateTestResults(result_code, result_bundle, statuses, 808 return GenerateTestResults(result_code, result_bundle, statuses,
801 start_ms, duration_ms) 809 start_ms, duration_ms)
802 810
803 #override 811 #override
804 def TearDown(self): 812 def TearDown(self):
805 pass 813 pass
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/instrumentation/instrumentation_test_instance_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698