Parse pdfium_tests's feature string in TestRunner.
Instead of storing the raw output of "pdfium_test --show-config" and
expecting users like Suppressor to parse it, just parse it once in
TestRunner. Then future users, if any, do not have to do parsing a
second time.
Change-Id: Ia459025762ad10be66efb4ac2f0cc8c8b8fadb0e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/68190
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/testing/tools/suppressor.py b/testing/tools/suppressor.py
index 70eef99..38351b5 100755
--- a/testing/tools/suppressor.py
+++ b/testing/tools/suppressor.py
@@ -11,11 +11,9 @@
class Suppressor:
- def __init__(self, finder, feature_string, js_disabled, xfa_disabled):
- feature_vector = feature_string.strip().split(",")
- self.has_v8 = not js_disabled and "V8" in feature_vector
- self.has_xfa = (not js_disabled and not xfa_disabled and
- "XFA" in feature_vector)
+ def __init__(self, finder, features, js_disabled, xfa_disabled):
+ self.has_v8 = not js_disabled and 'V8' in features
+ self.has_xfa = not js_disabled and not xfa_disabled and 'XFA' in features
self.suppression_set = self._LoadSuppressedSet('SUPPRESSIONS', finder)
self.image_suppression_set = self._LoadSuppressedSet(
'SUPPRESSIONS_IMAGE_DIFF', finder)
diff --git a/testing/tools/test_runner.py b/testing/tools/test_runner.py
index d3640d6..363faf3 100644
--- a/testing/tools/test_runner.py
+++ b/testing/tools/test_runner.py
@@ -355,10 +355,10 @@
shutil.rmtree(self.working_dir, ignore_errors=True)
os.makedirs(self.working_dir)
- self.feature_string = subprocess.check_output(
- [self.pdfium_test_path, '--show-config'])
+ self.features = subprocess.check_output(
+ [self.pdfium_test_path, '--show-config']).strip().split(',')
self.test_suppressor = suppressor.Suppressor(
- finder, self.feature_string, self.options.disable_javascript,
+ finder, self.features, self.options.disable_javascript,
self.options.disable_xfa)
self.image_differ = pngdiffer.PNGDiffer(finder,
self.options.reverse_byte_order)