summaryrefslogtreecommitdiff
path: root/testing/tools/suppressor.py
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-01-19 11:28:59 -0800
committerTom Sepez <tsepez@chromium.org>2016-01-19 11:28:59 -0800
commitacfe9a7ffca3ad1076e9b0772f4fc165a56065ff (patch)
tree02bc6f86dccdadf8912c608eb62a9a88a0e1d04b /testing/tools/suppressor.py
parenta76a6d8bcb76077fa248b64c5d64791dc8f23771 (diff)
downloadpdfium-acfe9a7ffca3ad1076e9b0772f4fc165a56065ff.tar.xz
Merge to XFA: Unify suppressions files and add matcher syntax.
Review URL: https://codereview.chromium.org/1586043006 . (cherry picked from commit 2cb9ae0309417222aa3555dabe4749119dc36d84) R=ochang@chromium.org, thestig@chromium.org Review URL: https://codereview.chromium.org/1582613012 .
Diffstat (limited to 'testing/tools/suppressor.py')
-rwxr-xr-xtesting/tools/suppressor.py39
1 files changed, 21 insertions, 18 deletions
diff --git a/testing/tools/suppressor.py b/testing/tools/suppressor.py
index 2bb31171ab..f25db4564b 100755
--- a/testing/tools/suppressor.py
+++ b/testing/tools/suppressor.py
@@ -8,27 +8,30 @@ import os
import common
class Suppressor:
- SUPPRESSIONS_FILENAME = 'SUPPRESSIONS'
- PLATFORM_SUPPRESSIONS_FILENAME = 'SUPPRESSIONS_%s' % common.os_name()
-
def __init__(self, finder):
- testing_dir = finder.TestingDir()
- self.suppression_list = self._ExtractSuppressions(
- os.path.join(testing_dir, self.SUPPRESSIONS_FILENAME))
- self.platform_suppression_list = self._ExtractSuppressions(
- os.path.join(testing_dir, self.PLATFORM_SUPPRESSIONS_FILENAME))
+ with open(os.path.join(finder.TestingDir(), 'SUPPRESSIONS')) as f:
+ self.suppression_set = set(self._FilterSuppressions(
+ common.os_name(), "v8", "xfa", self._ExtractSuppressions(f)))
+
+ def _ExtractSuppressions(self, f):
+ return [y.split(' ') for y in
+ [x.split('#')[0].strip() for x in
+ f.readlines()] if y]
- def _ExtractSuppressions(self, suppressions_filename):
- with open(suppressions_filename) as f:
- return [y for y in [x.split('#')[0].strip() for x in f.readlines()] if y]
+ def _FilterSuppressions(self, os, js, xfa, unfiltered_list):
+ return [x[0] for x in unfiltered_list
+ if self._MatchSuppression(x, os, js, xfa)]
+
+ def _MatchSuppression(self, item, os, js, xfa):
+ os_column = item[1].split(",");
+ js_column = item[2].split(",");
+ xfa_column = item[3].split(",");
+ return (('*' in os_column or os in os_column) and
+ ('*' in js_column or js in js_column) and
+ ('*' in xfa_column or xfa in xfa_column))
def IsSuppressed(self, input_filename):
- if input_filename in self.suppression_list:
- print ("%s is suppressed, found in %s file" %
- (input_filename, self.SUPPRESSIONS_FILENAME))
- return True
- if input_filename in self.platform_suppression_list:
- print ("%s is suppressed, found in %s file" %
- (input_filename, self.PLATFORM_SUPPRESSIONS_FILENAME))
+ if input_filename in self.suppression_set:
+ print "%s is suppressed" % input_filename
return True
return False