diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-04-09 13:37:02 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-04-09 13:37:02 -0700 |
commit | 30762ceda9db949550de6785b36dbe0d89c6d9d2 (patch) | |
tree | 6212fb0d3f1b70e2f25d0014066f4d3804f3f6e3 /testing/tools/suppressor.py | |
parent | 06e015f33248e4453259c8cebc414e9601638a6d (diff) | |
download | pdfium-30762ceda9db949550de6785b36dbe0d89c6d9d2.tar.xz |
Merge to XFA: testing utility combo patch
This pulls in the following CLs from master:
Review URL: https://codereview.chromium.org/1072613003
Review URL: https://codereview.chromium.org/1058463004
Review URL: https://codereview.chromium.org/1057983003
Review URL: https://codereview.chromium.org/1036073002
Review URL: https://codereview.chromium.org/1031203003
Review URL: https://codereview.chromium.org/1029193002
Review URL: https://codereview.chromium.org/1016613004
Review URL: https://codereview.chromium.org/1026903002
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1062163003
Diffstat (limited to 'testing/tools/suppressor.py')
-rwxr-xr-x | testing/tools/suppressor.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/testing/tools/suppressor.py b/testing/tools/suppressor.py new file mode 100755 index 0000000000..fff9bc8381 --- /dev/null +++ b/testing/tools/suppressor.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# Copyright 2015 The PDFium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +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)) + + 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 IsSuppressed(self, input_filename): + if input_filename in self.suppression_list: + print ("Not running %s, found in %s file" % + (input_filename, self.SUPPRESSIONS_FILENAME)) + return True + if input_filename in self.platform_suppression_list: + print ("Not running %s, found in %s file" % + (input_filename, self.PLATFORM_SUPPRESSIONS_FILENAME)) + return True + return False |