From 44c7578bb2eea5b015778f5d1d348dd27e1e84e2 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 4 Mar 2022 09:53:31 +0100 Subject: tests: Disable seccomp BPF sandbox on older Chromiums Seems to be necessary with newer libc (?) and Qt 5.12 plus 5.15.0/.1/.2. --- qutebrowser/utils/version.py | 2 +- tests/helpers/testutils.py | 22 ++++++++-------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/qutebrowser/utils/version.py b/qutebrowser/utils/version.py index 8da86dd00..33acdce57 100644 --- a/qutebrowser/utils/version.py +++ b/qutebrowser/utils/version.py @@ -724,7 +724,7 @@ class WebEngineVersions: ) -def qtwebengine_versions(avoid_init: bool = False) -> WebEngineVersions: +def qtwebengine_versions(*, avoid_init: bool = False) -> WebEngineVersions: """Get the QtWebEngine and Chromium version numbers. If we have a parsed user agent, we use it here. If not, we avoid initializing diff --git a/tests/helpers/testutils.py b/tests/helpers/testutils.py index 9079ae069..4983da2cc 100644 --- a/tests/helpers/testutils.py +++ b/tests/helpers/testutils.py @@ -31,14 +31,9 @@ import importlib.machinery import pytest -from PyQt5.QtCore import qVersion from PyQt5.QtGui import QColor -try: - from PyQt5.QtWebEngine import PYQT_WEBENGINE_VERSION_STR -except ImportError: - PYQT_WEBENGINE_VERSION_STR = None -from qutebrowser.utils import qtutils, log, utils +from qutebrowser.utils import qtutils, log, utils, version ON_CI = 'CI' in os.environ @@ -279,21 +274,20 @@ def disable_seccomp_bpf_sandbox(): """ affected_versions = set() for base, patch_range in [ - # 5.12.0 to 5.12.7 (inclusive) - ('5.12', range(0, 8)), + # 5.12.0 to 5.12.10 (inclusive) + ('5.12', range(0, 11)), # 5.13.0 to 5.13.2 (inclusive) ('5.13', range(0, 3)), # 5.14.0 ('5.14', [0]), + # 5.15.0 to 5.15.2 (inclusive) + ('5.15', range(0, 3)), ]: for patch in patch_range: - affected_versions.add('{}.{}'.format(base, patch)) + affected_versions.add(utils.VersionNumber.parse(f'{base}.{patch}')) - version = (PYQT_WEBENGINE_VERSION_STR - if PYQT_WEBENGINE_VERSION_STR is not None - else qVersion()) - - return version in affected_versions + versions = version.qtwebengine_versions(avoid_init=True) + return versions.webengine in affected_versions def import_userscript(name): -- cgit v1.2.3-54-g00ecf