4 # Copyright (c) 2019 Gerald Combs <gerald@wireshark.org>
6 # SPDX-License-Identifier: GPL-2.0-or-later
16 def wireshark_features(request
, cmd_wireshark
, make_env
):
18 Returns an object describing available features in Wireshark. Tests
19 will be skipped unless --enable-release is passed on the command line.
21 enabled
= request
.config
.getoption('--enable-release', default
=False)
23 pytest
.skip('Release tests are not enabled via --enable-release')
24 disabled
= request
.config
.getoption('--disable-gui', default
=False)
26 pytest
.skip('GUI tests are disabled via --disable-gui')
29 wireshark_v
= subprocess
.check_output(
30 (cmd_wireshark
, '--version'),
31 stderr
=subprocess
.PIPE
,
32 universal_newlines
=True,
35 wireshark_v
= re
.sub(r
'\s+', ' ', wireshark_v
)
36 except subprocess
.CalledProcessError
as ex
:
37 print('Failed to detect Wireshark features: %s' % (ex
,))
39 return types
.SimpleNamespace(
40 have_automatic_updates
='+automatic updates' in wireshark_v
,
43 class TestReleaseAutomaticUpdates
:
44 def test_automatic_updates_present(self
, wireshark_features
):
45 '''Checks whether Wireshark was built with automatic updates.'''
47 assert wireshark_features
.have_automatic_updates
50 def test_lua_present(self
, request
, features
):
51 '''Checks whether Wireshark was built with Lua support.'''
52 enabled
= request
.config
.getoption('--enable-release', default
=False)
54 pytest
.skip('Release tests are not enabled via --enable-release')
55 assert features
.have_lua