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

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: Suppress diffing tests without thinking about it. 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_corpus_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 = ["nov8", "v8"][self.has_v8]
Lei Zhang 2016/04/18 23:57:25 how about the more common way to do ternary operat
Tom Sepez 2016/04/19 00:04:47 Done.
16 xfa_option = ["noxfa", "xfa"][self.has_xfa]
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 IsSuppressed(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 is suppressed" % input_filename
39 return True 41 return True
40 return False 42 return False
43
44 def IsExecutionSuppressed(self, input_filepath):
Lei Zhang 2016/04/18 23:57:26 The difference between this and IsSuppressed() may
Tom Sepez 2016/04/19 00:04:47 Done.
45 return "xfa_specific" in input_filepath and not self.has_xfa
Lei Zhang 2016/04/18 23:57:26 Do you want to print a message to indicate suppres
Tom Sepez 2016/04/19 00:04:47 On 2016/04/18 23:57:26, Lei Zhang wrote: > Do you
OLDNEW
« no previous file with comments | « testing/tools/run_corpus_tests.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698