aboutsummaryrefslogtreecommitdiffstats
path: root/test/fixtures_ws.py
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2019-01-21 19:26:06 +0100
committerPeter Wu <peter@lekensteyn.nl>2019-01-22 17:45:58 +0000
commit0751504db7aa30fbc77e8165fbab4001d466a881 (patch)
treef9cdfdd9604d342adff5e503ab405e6223b1559c /test/fixtures_ws.py
parentd90eab1240b54c98110821d0b1a1b591fb6668aa (diff)
test: enable GUI tests on Linux, headless
This will enable four tests in case_wireshark_capture on Linux, two of them require --capture-interface to be specified. To enable headless mode, QT_QPA_PLATFORM=minimal is set. Unfortunately this option causes a null pointer dereference crash on macOS and it also fails on Windows (cause not investigated). So limit it to Linux for now. Change-Id: Id05364571b2c9da38434e611d92642a1177700df Reviewed-on: https://code.wireshark.org/review/31664 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'test/fixtures_ws.py')
-rw-r--r--test/fixtures_ws.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/test/fixtures_ws.py b/test/fixtures_ws.py
index 4b408acd5b..ed656e0c2d 100644
--- a/test/fixtures_ws.py
+++ b/test/fixtures_ws.py
@@ -132,9 +132,11 @@ def cmd_wireshark(program):
@fixtures.fixture(scope='session')
def wireshark_command(cmd_wireshark):
- if sys.platform not in ('win32', 'darwin'):
- # TODO check DISPLAY for X11 on Linux or BSD?
- fixtures.skip('Wireshark GUI tests requires DISPLAY')
+ # Windows and macOS can always display the GUI. On Linux, headless mode is
+ # used, see QT_QPA_PLATFORM in the 'test_env' fixture.
+ if sys.platform not in ('win32', 'darwin', 'linux'):
+ if 'DISPLAY' not in os.environ:
+ fixtures.skip('Wireshark GUI tests requires DISPLAY')
return (cmd_wireshark, '-ogui.update.enabled:FALSE')
@@ -263,6 +265,16 @@ def test_env(base_env, conf_path, request, dirs):
env['WIRESHARK_RUN_FROM_BUILD_DIRECTORY'] = '1'
env['WIRESHARK_QUIT_AFTER_CAPTURE'] = '1'
+ # Allow GUI tests to be run without opening windows nor requiring a Xserver.
+ # Set envvar QT_DEBUG_BACKINGSTORE=1 to save the window contents to a file
+ # in the current directory, output0000.png, output0001.png, etc. Note that
+ # this will overwrite existing files.
+ if sys.platform == 'linux':
+ # This option was verified working on Arch Linux with Qt 5.12.0-2 and
+ # Ubuntu 16.04 with libqt5gui5 5.5.1+dfsg-16ubuntu7.5. On macOS and
+ # Windows it unfortunately crashes (Qt 5.12.0).
+ env['QT_QPA_PLATFORM'] = 'minimal'
+
# Remove this if test instances no longer inherit from SubprocessTestCase?
if isinstance(request.instance, subprocesstest.SubprocessTestCase):
# Inject the test environment as default if it was not overridden.