tests: Widen disable-bpf-sandbox argument
This should fix tests with newer kernels/glibc's with Qt versions before 5.14.1.
This commit is contained in:
parent
1d398e9d8e
commit
65a610c3bf
|
|
@ -74,19 +74,17 @@ jobs:
|
|||
os: ubuntu-20.04
|
||||
python: 3.6
|
||||
### PyQt 5.11 (Python 3.7)
|
||||
# FIXME: seccomp-bpf failure in syscall 0230
|
||||
# - testenv: py37-pyqt511
|
||||
# os: ubuntu-20.04
|
||||
# python: 3.7
|
||||
- testenv: py37-pyqt511
|
||||
os: ubuntu-20.04
|
||||
python: 3.7
|
||||
### PyQt 5.12 (Python 3.8)
|
||||
- testenv: py38-pyqt512
|
||||
os: ubuntu-20.04
|
||||
python: 3.8
|
||||
### PyQt 5.13 (Python 3.8)
|
||||
# FIXME: seccomp-bpf failure in syscall 0230
|
||||
# - testenv: py38-pyqt513
|
||||
# os: ubuntu-20.04
|
||||
# python: 3.8
|
||||
- testenv: py38-pyqt513
|
||||
os: ubuntu-20.04
|
||||
python: 3.8
|
||||
### PyQt 5.14 (Python 3.8)
|
||||
- testenv: py38-pyqt514
|
||||
os: ubuntu-20.04
|
||||
|
|
|
|||
11
.travis.yml
11
.travis.yml
|
|
@ -12,17 +12,6 @@ matrix:
|
|||
env: TESTENV=py35-pyqt57
|
||||
dist: xenial
|
||||
|
||||
### PyQt 5.11 (Python 3.7)
|
||||
- python: 3.7
|
||||
env: TESTENV=py37-pyqt511
|
||||
|
||||
### PyQt 5.13 (Python 3.8)
|
||||
- env: TESTENV=py38-pyqt513
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libxkbcommon-x11-0
|
||||
|
||||
### PyQt 5.15 (Python 3.8, with coverage)
|
||||
- env: TESTENV=py38-pyqt515-cov
|
||||
addons:
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import pathlib
|
|||
|
||||
import pytest
|
||||
import hypothesis
|
||||
from PyQt5.QtCore import qVersion, PYQT_VERSION
|
||||
from PyQt5.QtCore import PYQT_VERSION
|
||||
|
||||
pytest.register_assert_rewrite('helpers')
|
||||
|
||||
|
|
@ -197,12 +197,10 @@ def pytest_ignore_collect(path):
|
|||
|
||||
@pytest.fixture(scope='session')
|
||||
def qapp_args():
|
||||
"""Make QtWebEngine unit tests run on Qt 5.7.1.
|
||||
|
||||
See https://github.com/qutebrowser/qutebrowser/issues/3163
|
||||
"""
|
||||
if qVersion() == '5.7.1':
|
||||
return [sys.argv[0], '--disable-seccomp-filter-sandbox']
|
||||
"""Make QtWebEngine unit tests run on older Qt versions + newer kernels."""
|
||||
seccomp_args = testutils.seccomp_args(qt_flag=False)
|
||||
if seccomp_args:
|
||||
return [sys.argv[0]] + seccomp_args
|
||||
return []
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import json
|
|||
|
||||
import yaml
|
||||
import pytest
|
||||
from PyQt5.QtCore import pyqtSignal, QUrl, qVersion
|
||||
from PyQt5.QtCore import pyqtSignal, QUrl
|
||||
|
||||
from qutebrowser.misc import ipc
|
||||
from qutebrowser.utils import log, utils, javascript, qtutils
|
||||
|
|
@ -544,9 +544,10 @@ class QuteProc(testprocess.Process):
|
|||
'--json-logging', '--loglevel', 'vdebug',
|
||||
'--backend', backend, '--debug-flag', 'no-sql-history',
|
||||
'--debug-flag', 'werror']
|
||||
if qVersion() == '5.7.1':
|
||||
# https://github.com/qutebrowser/qutebrowser/issues/3163
|
||||
args += ['--qt-flag', 'disable-seccomp-filter-sandbox']
|
||||
|
||||
if self.request.config.webengine:
|
||||
args += testutils.seccomp_args(qt_flag=True)
|
||||
|
||||
args.append('about:blank')
|
||||
return args
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import logging
|
|||
import re
|
||||
|
||||
import pytest
|
||||
from PyQt5.QtCore import QProcess, qVersion
|
||||
from PyQt5.QtCore import QProcess
|
||||
|
||||
from helpers import utils
|
||||
|
||||
|
|
@ -43,9 +43,10 @@ def _base_args(config):
|
|||
args += ['--backend', 'webengine']
|
||||
else:
|
||||
args += ['--backend', 'webkit']
|
||||
if qVersion() == '5.7.1':
|
||||
# https://github.com/qutebrowser/qutebrowser/issues/3163
|
||||
args += ['--qt-flag', 'disable-seccomp-filter-sandbox']
|
||||
|
||||
if config.webengine:
|
||||
args += utils.seccomp_args(qt_flag=True)
|
||||
|
||||
args.append('about:blank')
|
||||
return args
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,12 @@ import pathlib
|
|||
|
||||
import pytest
|
||||
|
||||
from PyQt5.QtCore import qVersion
|
||||
try:
|
||||
from PyQt5.QtWebEngine import PYQT_WEBENGINE_VERSION_STR
|
||||
except ImportError:
|
||||
PYQT_WEBENGINE_VERSION_STR = None
|
||||
|
||||
from qutebrowser.utils import qtutils, log
|
||||
|
||||
ON_CI = 'CI' in os.environ
|
||||
|
|
@ -211,3 +217,43 @@ def ignore_bs4_warning():
|
|||
def blocked_hosts():
|
||||
path = os.path.join(abs_datapath(), 'blocked-hosts.gz')
|
||||
yield from io.TextIOWrapper(gzip.open(path), encoding='utf-8')
|
||||
|
||||
|
||||
def seccomp_args(qt_flag):
|
||||
"""Get necessary flags to disable the seccomp BPF sandbox.
|
||||
|
||||
This is needed for some QtWebEngine setups, with older Qt versions but
|
||||
newer kernels.
|
||||
|
||||
Args:
|
||||
qt_flag: Add a '--qt-flag' argument.
|
||||
"""
|
||||
affected_versions = set()
|
||||
for base, patch_range in [
|
||||
## seccomp-bpf failure in syscall 0281
|
||||
## https://github.com/qutebrowser/qutebrowser/issues/3163
|
||||
# 5.7.1
|
||||
('5.7', [1]),
|
||||
|
||||
## seccomp-bpf failure in syscall 0281 (clock_nanosleep)
|
||||
## https://bugreports.qt.io/browse/QTBUG-81313
|
||||
# 5.11.0 to 5.11.3 (inclusive)
|
||||
('5.11', range(0, 4)),
|
||||
# 5.12.0 to 5.12.7 (inclusive)
|
||||
('5.12', range(0, 8)),
|
||||
# 5.13.0 to 5.13.2 (inclusive)
|
||||
('5.13', range(0, 3)),
|
||||
# 5.14.0
|
||||
('5.14', [0]),
|
||||
]:
|
||||
for patch in patch_range:
|
||||
affected_versions.add('{}.{}'.format(base, patch))
|
||||
|
||||
version = (PYQT_WEBENGINE_VERSION_STR
|
||||
if PYQT_WEBENGINE_VERSION_STR is not None
|
||||
else qVersion())
|
||||
if version in affected_versions:
|
||||
disable_arg = 'disable-seccomp-filter-sandbox'
|
||||
return ['--qt-flag', disable_arg] if qt_flag else ['--' + disable_arg]
|
||||
|
||||
return []
|
||||
|
|
|
|||
Loading…
Reference in New Issue