forked from osmocom/wireshark
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>
This commit is contained in:
parent
7247b98d45
commit
d7bbe384f5
|
@ -3338,6 +3338,7 @@ set(_test_group_list
|
||||||
suite_mergecap
|
suite_mergecap
|
||||||
suite_nameres
|
suite_nameres
|
||||||
suite_outputformats
|
suite_outputformats
|
||||||
|
suite_release
|
||||||
suite_text2pcap
|
suite_text2pcap
|
||||||
suite_sharkd
|
suite_sharkd
|
||||||
suite_unittests
|
suite_unittests
|
||||||
|
|
|
@ -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);
|
|
@ -54,6 +54,8 @@ def main():
|
||||||
parser = argparse.ArgumentParser(description='Wireshark unit tests')
|
parser = argparse.ArgumentParser(description='Wireshark unit tests')
|
||||||
cap_group = parser.add_mutually_exclusive_group()
|
cap_group = parser.add_mutually_exclusive_group()
|
||||||
cap_group.add_argument('-E', '--disable-capture', action='store_true', help='Disable capture tests')
|
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('-p', '--program-path', default=os.path.curdir, help='Path to Wireshark executables.')
|
||||||
parser.add_argument('--skip-missing-programs',
|
parser.add_argument('--skip-missing-programs',
|
||||||
help='Skip tests that lack programs from this list instead of failing'
|
help='Skip tests that lack programs from this list instead of failing'
|
||||||
|
|
|
@ -79,6 +79,7 @@
|
||||||
#include "ui/commandline.h"
|
#include "ui/commandline.h"
|
||||||
#include "ui/capture_ui_utils.h"
|
#include "ui/capture_ui_utils.h"
|
||||||
#include "ui/preference_utils.h"
|
#include "ui/preference_utils.h"
|
||||||
|
#include "ui/software_update.h"
|
||||||
#include "ui/taps.h"
|
#include "ui/taps.h"
|
||||||
|
|
||||||
#include "ui/qt/conversation_dialog.h"
|
#include "ui/qt/conversation_dialog.h"
|
||||||
|
@ -137,8 +138,8 @@
|
||||||
# INFO = 64
|
# INFO = 64
|
||||||
# DEBUG = 128
|
# DEBUG = 128
|
||||||
|
|
||||||
*/
|
|
||||||
#define DEBUG_STARTUP_TIME_LOGLEVEL 252
|
#define DEBUG_STARTUP_TIME_LOGLEVEL 252
|
||||||
|
*/
|
||||||
|
|
||||||
/* update the main window */
|
/* update the main window */
|
||||||
void main_window_update(void)
|
void main_window_update(void)
|
||||||
|
@ -226,6 +227,14 @@ get_gui_compiled_info(GString *str)
|
||||||
g_string_append(str, "without QtMultimedia");
|
g_string_append(str, "without QtMultimedia");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
g_string_append(str, ", ");
|
||||||
|
const char *update_info = software_update_info();
|
||||||
|
if (update_info) {
|
||||||
|
g_string_append_printf(str, "with automatic updates using %s", update_info);
|
||||||
|
} else {
|
||||||
|
g_string_append_printf(str, "without automatic updates");
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
g_string_append(str, ", ");
|
g_string_append(str, ", ");
|
||||||
#ifdef HAVE_AIRPCAP
|
#ifdef HAVE_AIRPCAP
|
||||||
|
|
|
@ -123,6 +123,10 @@ extern void software_update_cleanup(void) {
|
||||||
win_sparkle_cleanup();
|
win_sparkle_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *software_update_info(void) {
|
||||||
|
return "WinSparkle " WIN_SPARKLE_VERSION_STRING;
|
||||||
|
}
|
||||||
|
|
||||||
#elif defined (__APPLE__)
|
#elif defined (__APPLE__)
|
||||||
/** Initialize software updates.
|
/** Initialize software updates.
|
||||||
*/
|
*/
|
||||||
|
@ -146,6 +150,10 @@ software_update_check(void) {
|
||||||
*/
|
*/
|
||||||
void software_update_cleanup(void) {
|
void software_update_cleanup(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *software_update_info(void) {
|
||||||
|
return "Sparkle";
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else /* No updates */
|
#else /* No updates */
|
||||||
|
@ -167,6 +175,10 @@ software_update_check(void) {
|
||||||
void software_update_cleanup(void) {
|
void software_update_cleanup(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *software_update_info(void) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* defined(HAVE_SOFTWARE_UPDATE) && defined (_WIN32) */
|
#endif /* defined(HAVE_SOFTWARE_UPDATE) && defined (_WIN32) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -181,4 +193,3 @@ void software_update_cleanup(void) {
|
||||||
* ex: set shiftwidth=4 tabstop=8 expandtab:
|
* ex: set shiftwidth=4 tabstop=8 expandtab:
|
||||||
* :indentSize=4:tabSize=8:noTabs=true:
|
* :indentSize=4:tabSize=8:noTabs=true:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,12 @@ extern void software_update_check(void);
|
||||||
*/
|
*/
|
||||||
extern void software_update_cleanup(void);
|
extern void software_update_cleanup(void);
|
||||||
|
|
||||||
|
/** Fetch a description of the software update mechanism.
|
||||||
|
*
|
||||||
|
* @return NULL, "Sparkle", or "WinSparkle".
|
||||||
|
*/
|
||||||
|
extern const char *software_update_info(void);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/** Check to see if Wireshark can shut down safely (e.g. offer to save the
|
/** Check to see if Wireshark can shut down safely (e.g. offer to save the
|
||||||
* current capture). Called from a separate thread.
|
* current capture). Called from a separate thread.
|
||||||
|
|
Loading…
Reference in New Issue