From 9ed3db47e17fdf61a8facee1eeb5cbf4deda17bd Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Fri, 20 Feb 2015 15:19:37 +0100 Subject: bisect-wireshark: interactive git-bisect script Useful to find regressions in the GUI by manual inspection. --- bisect-wireshark | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100755 bisect-wireshark (limited to 'bisect-wireshark') diff --git a/bisect-wireshark b/bisect-wireshark new file mode 100755 index 0000000..1f7cc68 --- /dev/null +++ b/bisect-wireshark @@ -0,0 +1,92 @@ +#!/bin/bash +# Run an interactive git bisect on wireshark (wireshark-gtk by default) +# +# Usage: +# 1. Mark commits as good/bad (see man git-bisect) +# git bisect start +# 2. Optionally change the default target: +# export WIRESHARK_BIN=wireshark-gtk # for wireshark-gtk +# export WIRESHARK_BIN= # build everything +# 3. Start the interactive bisect: +# git bisect run ../wireshark-notes/bisect-wireshark +# 4. After the script returns, the faulty commit is identified. + +# Wireshark program to build and launch (leave it empty to build everything) +WIRESHARK_BIN=${WIRESHARK_BIN-wireshark} +OUTDIR=/tmp/wsbuild +buildlogdir=/tmp/wslogs + +SRCDIR=$(git rev-parse --show-toplevel) +ver=$(git describe) +buildlog=$buildlogdir/build-$(date +%Y-%m-%d-%H%M%S)-${ver}.txt + +mkdir -p "$buildlogdir" "$OUTDIR" +if ! cd "$OUTDIR"; then + echo "Failed to create output dir" + exit 128 # abort +fi + +make_local() { + CFLAGS="-fsanitize=address -fsanitize=undefined -fdiagnostics-color=auto" + set -x # Print commands as they are executed + # Configure + time cmake "$SRCDIR" -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CFLAGS" && + # Build + time make -C "$OUTDIR" -j$(nproc) $WIRESHARK_BIN +} + +# Export variables and build locally (need recent Bash versions, the one +# included with Ubuntu 12.04 won't do) +script -e -c "date -R; $(declare -p WIRESHARK_BIN SRCDIR OUTDIR); +$(declare -pf make_local); time make_local" "$buildlog" +rc=$? +if [ $rc = 0 ]; then + echo "Build OK" +else + printf '\e[1;31m%\e[m\n' "Build failed with $rc" +fi + +# Run it and interactively ask the user to tell whether it passed or not +while true; do + if [ -n "$WIRESHARK_BIN" ]; then + "$OUTDIR/run/$WIRESHARK_BIN" + fi + + cat <