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

Side by Side Diff: testing/tools/suppressor.py

Issue 1894083003: Exclude XFA-only corpus from non-xfa and roll corpus (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Tidy, print suppression msg. Created 4 years, 8 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 | « testing/tools/run_pixel_tests.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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The PDFium Authors. All rights reserved. 2 # Copyright 2015 The PDFium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import os 6 import os
7 7
8 import common 8 import common
9 9
10 class Suppressor: 10 class Suppressor:
11 def __init__(self, finder, feature_string): 11 def __init__(self, finder, feature_string):
12 feature_vector = feature_string.strip().split(",") 12 feature_vector = feature_string.strip().split(",")
13 v8_option = ["nov8", "v8"]["V8" in feature_vector] 13 self.has_v8 = "V8" in feature_vector
14 xfa_option = ["noxfa", "xfa"]["XFA" in feature_vector] 14 self.has_xfa = "XFA" in feature_vector
15 v8_option = "v8" if self.has_v8 else "nov8"
16 xfa_option = "xfa" if self.has_xfa else "noxfa"
15 with open(os.path.join(finder.TestingDir(), 'SUPPRESSIONS')) as f: 17 with open(os.path.join(finder.TestingDir(), 'SUPPRESSIONS')) as f:
16 self.suppression_set = set(self._FilterSuppressions( 18 self.suppression_set = set(self._FilterSuppressions(
17 common.os_name(), v8_option, xfa_option, self._ExtractSuppressions(f))) 19 common.os_name(), v8_option, xfa_option, self._ExtractSuppressions(f)))
18 20
19 def _ExtractSuppressions(self, f): 21 def _ExtractSuppressions(self, f):
20 return [y.split(' ') for y in 22 return [y.split(' ') for y in
21 [x.split('#')[0].strip() for x in 23 [x.split('#')[0].strip() for x in
22 f.readlines()] if y] 24 f.readlines()] if y]
23 25
24 def _FilterSuppressions(self, os, js, xfa, unfiltered_list): 26 def _FilterSuppressions(self, os, js, xfa, unfiltered_list):
25 return [x[0] for x in unfiltered_list 27 return [x[0] for x in unfiltered_list
26 if self._MatchSuppression(x, os, js, xfa)] 28 if self._MatchSuppression(x, os, js, xfa)]
27 29
28 def _MatchSuppression(self, item, os, js, xfa): 30 def _MatchSuppression(self, item, os, js, xfa):
29 os_column = item[1].split(","); 31 os_column = item[1].split(",");
30 js_column = item[2].split(","); 32 js_column = item[2].split(",");
31 xfa_column = item[3].split(","); 33 xfa_column = item[3].split(",");
32 return (('*' in os_column or os in os_column) and 34 return (('*' in os_column or os in os_column) and
33 ('*' in js_column or js in js_column) and 35 ('*' in js_column or js in js_column) and
34 ('*' in xfa_column or xfa in xfa_column)) 36 ('*' in xfa_column or xfa in xfa_column))
35 37
36 def IsSuppressed(self, input_filename): 38 def IsResultSuppressed(self, input_filename):
37 if input_filename in self.suppression_set: 39 if input_filename in self.suppression_set:
38 print "%s is suppressed" % input_filename 40 print "%s result is suppressed" % input_filename
39 return True 41 return True
40 return False 42 return False
43
44 def IsExecutionSuppressed(self, input_filepath):
45 if "xfa_specific" in input_filepath and not self.has_xfa:
46 print "%s execution is suppressed" % input_filepath
47 return True
48 return False
OLDNEW
« no previous file with comments | « testing/tools/run_pixel_tests.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698