forked from osmocom/wireshark
Add tests for the Qt UI.
Make sure the Qt UI quits if WIRESHARK_QUIT_AFTER_CAPTURE is set. Make sure Bourne shell scripts (*.sh) have UNIX/POSIX line endings. Reduce some time values so that the tests run faster. Change-Id: I81df7c6f72d7d807d1856863cbea1bb6326ca711 Reviewed-on: https://code.wireshark.org/review/4407 Tested-by: Gerald Combs <gerald@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>daniel/osmux
parent
b5aa0d2a4f
commit
58cde5c74a
|
@ -1,4 +1,5 @@
|
|||
* text=auto
|
||||
*.sh eol=lf
|
||||
/test export-ignore
|
||||
.bzrignore export-ignore
|
||||
.gitattributes export-ignore
|
||||
|
|
|
@ -50,13 +50,16 @@ SKIP_CAPTURE=${SKIP_CAPTURE:-1}
|
|||
# Override the last two items if we're running Windows
|
||||
if [ "$WS_SYSTEM" = "Windows" ] ; then
|
||||
WS_BIN_PATH=${WS_BIN_PATH:-$SOURCE_DIR/wireshark-gtk2}
|
||||
WS_QT_BIN_PATH=${WS_QT_BIN_PATH:-$SOURCE_DIR/wireshark-qt-release}
|
||||
SKIP_CAPTURE=0
|
||||
fi
|
||||
|
||||
# Path to the Wireshark binaries, default to source dir if unset
|
||||
WS_BIN_PATH=${WS_BIN_PATH:-$SOURCE_DIR}
|
||||
WS_QT_BIN_PATH=${WS_QT_BIN_PATH:-$SOURCE_DIR}
|
||||
|
||||
# Tweak the following to your liking.
|
||||
WIRESHARK=$WS_QT_BIN_PATH/wireshark
|
||||
WIRESHARK_GTK=$WS_BIN_PATH/wireshark-gtk
|
||||
TSHARK=$WS_BIN_PATH/tshark
|
||||
RAWSHARK=$WS_BIN_PATH/rawshark
|
||||
|
@ -76,7 +79,7 @@ TRAFFIC_CAPTURE_IFACE=${TRAFFIC_CAPTURE_IFACE:-1}
|
|||
|
||||
# time to capture some traffic (in seconds)
|
||||
# (you may increase this if you get errors caused by very low traffic)
|
||||
TRAFFIC_CAPTURE_DURATION=15
|
||||
TRAFFIC_CAPTURE_DURATION=10
|
||||
|
||||
# the default is to not capture in promiscuous mode
|
||||
# (this makes known trouble with some Windows WLAN adapters)
|
||||
|
|
|
@ -27,6 +27,7 @@ EXIT_OK=0
|
|||
EXIT_COMMAND_LINE=1
|
||||
EXIT_ERROR=2
|
||||
|
||||
WIRESHARK_CMD="$WIRESHARK -o gui.update.enabled:FALSE -k"
|
||||
WIRESHARK_GTK_CMD="$WIRESHARK_GTK -o gui.update.enabled:FALSE -k"
|
||||
|
||||
capture_test_output_print() {
|
||||
|
@ -58,7 +59,7 @@ traffic_gen_ping() {
|
|||
*) # *BSD, Linux
|
||||
ping -c 1 -s $x www.wireshark.org ;;
|
||||
esac
|
||||
sleep 1
|
||||
sleep 0.1
|
||||
done
|
||||
date
|
||||
} > ./testout_ping.txt 2>&1 &
|
||||
|
@ -202,7 +203,7 @@ capture_step_fifo() {
|
|||
# capture packets via a fifo
|
||||
capture_step_stdin() {
|
||||
CONSOLE_LOG_ARGS=""
|
||||
if [ "$DUT" == "$WIRESHARK_GTK_CMD" -a "$WS_SYSTEM" == "Windows" ] ; then
|
||||
if [[ ( "$DUT" == "$WIRESHARK_CMD" || "$DUT" == "$WIRESHARK_GTK_CMD" ) && "$WS_SYSTEM" == "Windows" ]] ; then
|
||||
CONSOLE_LOG_ARGS="-o console.log.level:127"
|
||||
fi
|
||||
|
||||
|
@ -412,6 +413,34 @@ wireshark_capture_suite() {
|
|||
# k: start capture immediately
|
||||
# WIRESHARK_QUIT_AFTER_CAPTURE needs to be set.
|
||||
|
||||
#
|
||||
# NOTE: This may not do the right thing if we use toolkits
|
||||
# that use Wayland or Mir directly, unless they also depend
|
||||
# on the DISPLAY environment variable.
|
||||
#
|
||||
if [[ $WS_SYSTEM != Windows && $WS_SYSTEM != Darwin ]] && [ -z "$DISPLAY" ]; then
|
||||
echo -n ' (X server not available)'
|
||||
test_step_skipped
|
||||
return
|
||||
fi
|
||||
|
||||
DUT="$WIRESHARK_CMD"
|
||||
test_step_add "Capture 10 packets" capture_step_10packets
|
||||
# piping to stdout doesn't work with Wireshark and capturing!
|
||||
#test_step_add "Capture 10 packets using stdout: -w -" capture_step_10packets_stdout
|
||||
if [ $TEST_FIFO ]; then
|
||||
test_step_add "Capture via fifo" capture_step_fifo
|
||||
fi
|
||||
test_step_add "Capture via stdin" capture_step_stdin
|
||||
# read filter doesn't work with Wireshark and capturing!
|
||||
#test_step_add "Capture read filter (${TRAFFIC_CAPTURE_DURATION}s)" capture_step_read_filter
|
||||
test_step_add "Capture snapshot length 68 bytes (${TRAFFIC_CAPTURE_DURATION}s)" capture_step_snapshot
|
||||
}
|
||||
|
||||
wireshark_gtk_capture_suite() {
|
||||
# k: start capture immediately
|
||||
# WIRESHARK_QUIT_AFTER_CAPTURE needs to be set.
|
||||
|
||||
#
|
||||
# NOTE: if, on OS X, we start using a native-Quartz toolkit,
|
||||
# this would need to change to check for WS_SYSTEM being
|
||||
|
@ -484,6 +513,7 @@ capture_suite() {
|
|||
test_suite_add "Dumpcap capture" dumpcap_capture_suite
|
||||
test_suite_add "TShark capture" tshark_capture_suite
|
||||
test_suite_add "Wireshark capture" wireshark_capture_suite
|
||||
test_suite_add "Wireshark 1 capture" wireshark_gtk_capture_suite
|
||||
}
|
||||
|
||||
#
|
||||
|
|
|
@ -143,6 +143,12 @@ io_step_rawshark_pcap_stdin() {
|
|||
}
|
||||
|
||||
|
||||
wireshark_io_suite() {
|
||||
# Q: quit after cap, k: start capture immediately
|
||||
DUT="$WIRESHARK"
|
||||
test_step_add "Input file" io_step_input_file
|
||||
}
|
||||
|
||||
wireshark_gtk_io_suite() {
|
||||
# Q: quit after cap, k: start capture immediately
|
||||
DUT="$WIRESHARK_GTK"
|
||||
|
|
|
@ -114,7 +114,7 @@ trap test_cleanup EXIT
|
|||
test_step_prerequisites() {
|
||||
|
||||
NOTFOUND=0
|
||||
for i in "$WIRESHARK_GTK" "$TSHARK" "$CAPINFOS" "$DUMPCAP" ; do
|
||||
for i in "$WIRESHARK" "$WIRESHARK_GTK" "$TSHARK" "$CAPINFOS" "$DUMPCAP" ; do
|
||||
if [ ! -x $i ]; then
|
||||
echo "Couldn't find $i"
|
||||
NOTFOUND=1
|
||||
|
|
|
@ -298,7 +298,7 @@ print_usage(gboolean for_help_option) {
|
|||
#ifndef _WIN32
|
||||
fprintf(output, " --display=DISPLAY X display to use\n");
|
||||
#endif
|
||||
fprintf(output, "\nNOTE: Not all options are already implemented in the QT port.\n");
|
||||
fprintf(output, "\nNOTE: Not all options are implemented in the Qt port.\n");
|
||||
|
||||
#ifdef _WIN32
|
||||
destroy_console();
|
||||
|
|
|
@ -418,6 +418,12 @@ void MainWindow::captureCaptureUpdateFinished(capture_session *cap_session) {
|
|||
setForCaptureInProgress(false);
|
||||
|
||||
setWindowIcon(wsApp->normalIcon());
|
||||
|
||||
if (global_capture_opts.quit_after_cap) {
|
||||
/* command line asked us to quit after the capture */
|
||||
/* don't pop up a dialog to ask for unsaved files etc. */
|
||||
wsApp->quit();
|
||||
}
|
||||
#endif // HAVE_LIBPCAP
|
||||
}
|
||||
void MainWindow::captureCaptureFixedStarted(capture_session *cap_session) {
|
||||
|
@ -437,6 +443,12 @@ void MainWindow::captureCaptureFixedFinished(capture_session *cap_session) {
|
|||
setForCaptureInProgress(false);
|
||||
|
||||
setWindowIcon(wsApp->normalIcon());
|
||||
|
||||
if (global_capture_opts.quit_after_cap) {
|
||||
/* command line asked us to quit after the capture */
|
||||
/* don't pop up a dialog to ask for unsaved files etc. */
|
||||
wsApp->quit();
|
||||
}
|
||||
#endif // HAVE_LIBPCAP
|
||||
}
|
||||
void MainWindow::captureCaptureStopping(capture_session *cap_session) {
|
||||
|
@ -457,6 +469,12 @@ void MainWindow::captureCaptureFailed(capture_session *cap_session) {
|
|||
main_ui_->mainStack->setCurrentWidget(main_welcome_);
|
||||
|
||||
setWindowIcon(wsApp->normalIcon());
|
||||
|
||||
if (global_capture_opts.quit_after_cap) {
|
||||
/* command line asked us to quit after the capture */
|
||||
/* don't pop up a dialog to ask for unsaved files etc. */
|
||||
wsApp->quit();
|
||||
}
|
||||
#endif // HAVE_LIBPCAP
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue