aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2020-02-13 15:18:14 -0800
committerAnders Broman <a.broman58@gmail.com>2020-02-15 11:13:25 +0000
commitd7bbe384f51b99b03694db811f48cf5a098ad65c (patch)
treef48a399d76c2badef1319228fda10928fb7d5b1e /test
parent7247b98d45d906b297b3f307c26ff9bd322ad51d (diff)
Test+Qt: Add an automatic update check.
Add software_update_info() to the software update module, which returns the name of our update library if we have one. Use it to add automatic update information to the compiled information in `wireshark --version`. Add a "release" test suite, which contains a test for automatic updates. Ping-Bug: 16381 Change-Id: I867a96bdcfde8be541eca2dc0e84b5000276e7dd Reviewed-on: https://code.wireshark.org/review/36107 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/suite_release.py47
-rwxr-xr-xtest/test.py2
2 files changed, 49 insertions, 0 deletions
diff --git a/test/suite_release.py b/test/suite_release.py
new file mode 100644
index 0000000000..8775f1f982
--- /dev/null
+++ b/test/suite_release.py
@@ -0,0 +1,47 @@
+#
+# -*- coding: utf-8 -*-
+# Wireshark tests
+#
+# Copyright (c) 2019 Gerald Combs <gerald@wireshark.org>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+'''Release tests'''
+
+import fixtures
+import re
+import subprocess
+import subprocesstest
+import types
+
+@fixtures.fixture
+def wireshark_features(request, cmd_wireshark, make_env):
+ '''
+ Returns an object describing available features in Wireshark. Tests
+ will be skipped unless --enable-release is passed on the command line.
+ '''
+ enabled = request.config.getoption('--enable-release', default=False)
+ if not enabled:
+ fixtures.skip('Release tests are not enabled via --enable-release')
+
+ try:
+ wireshark_v = subprocess.check_output(
+ (cmd_wireshark, '--version'),
+ stderr=subprocess.PIPE,
+ universal_newlines=True,
+ env=make_env()
+ )
+ wireshark_v = re.sub(r'\s+', ' ', wireshark_v)
+ except subprocess.CalledProcessError as ex:
+ print('Failed to detect Wireshark features: %s' % (ex,))
+ wireshark_v = ''
+ return types.SimpleNamespace(
+ have_automatic_updates='with automatic updates' in wireshark_v,
+ )
+
+@fixtures.uses_fixtures
+class case_release_automatic_updates(subprocesstest.SubprocessTestCase):
+ def test_automatic_updates_present(self, wireshark_features):
+ '''Checks whether Wireshark was built with automatic updates.'''
+
+ self.assertTrue(wireshark_features.have_automatic_updates);
diff --git a/test/test.py b/test/test.py
index df3e9337aa..fa6a543057 100755
--- a/test/test.py
+++ b/test/test.py
@@ -54,6 +54,8 @@ def main():
parser = argparse.ArgumentParser(description='Wireshark unit tests')
cap_group = parser.add_mutually_exclusive_group()
cap_group.add_argument('-E', '--disable-capture', action='store_true', help='Disable capture tests')
+ release_group = parser.add_mutually_exclusive_group()
+ release_group.add_argument('--enable-release', action='store_true', help='Enable release tests')
parser.add_argument('-p', '--program-path', default=os.path.curdir, help='Path to Wireshark executables.')
parser.add_argument('--skip-missing-programs',
help='Skip tests that lack programs from this list instead of failing'