2014-09-22 20:21:00 +02:00
|
|
|
#!/usr/bin/env python3
|
2014-09-12 07:08:36 +02:00
|
|
|
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
|
|
|
|
2019-02-23 06:34:17 +01:00
|
|
|
# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
2014-09-12 07:08:36 +02:00
|
|
|
#
|
|
|
|
# This file is part of qutebrowser.
|
|
|
|
#
|
|
|
|
# qutebrowser is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# qutebrowser is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
"""Tester for Qt segfaults with different harfbuzz engines."""
|
|
|
|
|
|
|
|
import os
|
2017-12-15 23:08:53 +01:00
|
|
|
import os.path
|
2014-09-12 07:08:36 +02:00
|
|
|
import signal
|
|
|
|
import sys
|
|
|
|
import subprocess
|
|
|
|
|
2015-06-28 22:31:30 +02:00
|
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir,
|
2016-04-27 18:30:54 +02:00
|
|
|
os.pardir))
|
2014-09-22 20:29:37 +02:00
|
|
|
|
|
|
|
from scripts import utils
|
2014-09-12 07:08:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
SCRIPT = """
|
|
|
|
import sys
|
|
|
|
|
|
|
|
from PyQt5.QtCore import QUrl
|
|
|
|
from PyQt5.QtWidgets import QApplication
|
|
|
|
from PyQt5.QtWebKitWidgets import QWebView
|
|
|
|
|
|
|
|
def on_load_finished(ok):
|
|
|
|
if ok:
|
|
|
|
app.exit(0)
|
|
|
|
else:
|
|
|
|
app.exit(1)
|
|
|
|
|
|
|
|
app = QApplication([])
|
|
|
|
wv = QWebView()
|
|
|
|
wv.loadFinished.connect(on_load_finished)
|
|
|
|
wv.load(QUrl(sys.argv[1]))
|
|
|
|
#wv.show()
|
|
|
|
app.exec_()
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
def print_ret(ret):
|
|
|
|
"""Print information about an exit status."""
|
|
|
|
if ret == 0:
|
2014-09-22 20:29:37 +02:00
|
|
|
utils.print_col("success", 'green')
|
2014-09-12 07:08:36 +02:00
|
|
|
elif ret == -signal.SIGSEGV:
|
2014-09-22 20:29:37 +02:00
|
|
|
utils.print_col("segfault", 'red')
|
2014-09-12 07:08:36 +02:00
|
|
|
else:
|
2014-09-22 20:29:37 +02:00
|
|
|
utils.print_col("error {}".format(ret), 'yellow')
|
2014-09-12 07:08:36 +02:00
|
|
|
print()
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
retvals = []
|
|
|
|
if len(sys.argv) < 2:
|
|
|
|
# pages which previously caused problems
|
2014-09-16 22:39:49 +02:00
|
|
|
pages = [
|
2015-06-12 16:59:33 +02:00
|
|
|
# ANGLE, https://bugreports.qt.io/browse/QTBUG-39723
|
2014-09-18 06:45:09 +02:00
|
|
|
('http://www.binpress.com/', False),
|
|
|
|
('http://david.li/flow/', False),
|
|
|
|
('https://imzdl.com/', False),
|
2015-03-31 20:49:29 +02:00
|
|
|
# not reproducible
|
2015-06-12 16:59:33 +02:00
|
|
|
# https://bugreports.qt.io/browse/QTBUG-39847
|
2014-09-18 06:45:09 +02:00
|
|
|
('http://www.20min.ch/', True),
|
2015-06-12 16:59:33 +02:00
|
|
|
# HarfBuzz, https://bugreports.qt.io/browse/QTBUG-39278
|
2014-09-18 06:45:09 +02:00
|
|
|
('http://www.the-compiler.org/', True),
|
|
|
|
('http://phoronix.com', True),
|
|
|
|
('http://twitter.com', True),
|
2015-06-12 16:59:33 +02:00
|
|
|
# HarfBuzz #2, https://bugreports.qt.io/browse/QTBUG-36099
|
2014-09-18 06:45:09 +02:00
|
|
|
('http://lenta.ru/', True),
|
2015-06-12 16:59:33 +02:00
|
|
|
# Unknown, https://bugreports.qt.io/browse/QTBUG-41360
|
2014-09-18 06:45:09 +02:00
|
|
|
('http://salt.readthedocs.org/en/latest/topics/pillar/', True),
|
2014-09-16 22:39:49 +02:00
|
|
|
]
|
2014-09-12 07:08:36 +02:00
|
|
|
else:
|
2014-09-18 06:45:09 +02:00
|
|
|
pages = [(e, True) for e in sys.argv[1:]]
|
|
|
|
for page, test_harfbuzz in pages:
|
2014-09-22 20:29:37 +02:00
|
|
|
utils.print_bold("==== {} ====".format(page))
|
2014-09-18 06:45:09 +02:00
|
|
|
if test_harfbuzz:
|
|
|
|
print("With system harfbuzz:")
|
2017-10-23 11:22:56 +02:00
|
|
|
ret = subprocess.run([sys.executable, '-c', SCRIPT, page]).returncode
|
2014-09-12 07:08:36 +02:00
|
|
|
print_ret(ret)
|
|
|
|
retvals.append(ret)
|
2014-09-18 06:45:09 +02:00
|
|
|
if test_harfbuzz:
|
|
|
|
print("With QT_HARFBUZZ=old:")
|
|
|
|
env = dict(os.environ)
|
|
|
|
env['QT_HARFBUZZ'] = 'old'
|
2017-10-23 11:22:56 +02:00
|
|
|
ret = subprocess.run([sys.executable, '-c', SCRIPT, page],
|
|
|
|
env=env).returncode
|
2014-09-18 06:45:09 +02:00
|
|
|
print_ret(ret)
|
|
|
|
retvals.append(ret)
|
|
|
|
print("With QT_HARFBUZZ=new:")
|
|
|
|
env = dict(os.environ)
|
|
|
|
env['QT_HARFBUZZ'] = 'new'
|
2017-10-23 11:22:56 +02:00
|
|
|
ret = subprocess.run([sys.executable, '-c', SCRIPT, page],
|
|
|
|
env=env).returncode
|
2014-09-18 06:45:09 +02:00
|
|
|
print_ret(ret)
|
|
|
|
retvals.append(ret)
|
2014-09-12 07:08:36 +02:00
|
|
|
if all(r == 0 for r in retvals):
|
|
|
|
sys.exit(0)
|
|
|
|
else:
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|