[master] f850b6086 vtc-bisect: New inverted mode

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Fri Aug 6 11:51:07 UTC 2021


commit f850b608648f6fcdddd6f13e2e94e7c87f4da046
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Fri Aug 6 12:00:51 2021 +0200

    vtc-bisect: New inverted mode
    
    This is how I found the accidental bug fix for #3662:
    
        git show varnish-6.0.8:bin/varnishtest/tests/c00053.vtc >bisect.vtc
        tools/vtc-bisect.sh -g varnish-6.0.0 -j32 -i
    
    I hope this will help others, I use this script whenever the cause of a
    failure is not obvious.

diff --git a/tools/vtc-bisect.sh b/tools/vtc-bisect.sh
index e4c82e083..e0f2e8b92 100755
--- a/tools/vtc-bisect.sh
+++ b/tools/vtc-bisect.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (c) 2019 Varnish Software AS
+# Copyright (c) 2019, 2021 Varnish Software AS
 # All rights reserved.
 #
 # Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
@@ -38,7 +38,7 @@ usage() {
 	printf 'Error: %s.\n\n' "$1"
 
 	cat <<-EOF
-	Usage: $SCRIPT [-b <rev>] [-g <rev>] [-j <jobs>] [<file>]
+	Usage: $SCRIPT [-b <rev>] [-g <rev>] [-i] [-j <jobs>] [<file>]
 	       $SCRIPT -h
 
 	Automatically look for the change that introduced a regression with
@@ -48,12 +48,17 @@ usage() {
 	-h         : show this help and exit
 	-b <rev>   : bad revision (defaults to HEAD)
 	-g <rev>   : good revision (defaults to latest tag before bad)
+	-i         : inverted mode, look for a bug fix instead
 	-j <jobs>  : number of jobs for make invocations (defaults to 8)
 
 	When <file> is empty or missing, bisect.vtc is expected to be found
 	at the root of the git repository. The current source tree is used
 	and VPATH setups are not supported.
 
+	The -i option inverses the bisection behavior: the test case is now
+	expected to fail on the good revision and pass on the bad revision.
+	This is useful to track a bug that was fixed without being noticed.
+
 	This script is expected to run from the root of the git repository
 	as well.
 	EOF
@@ -77,22 +82,29 @@ run() {
 		exit 125
 	fi
 
-	bin/varnishtest/varnishtest -i "$VTC_FILE"
+	if [ -n "$INVERSE" ]
+	then
+		! bin/varnishtest/varnishtest -i "$VTC_FILE"
+	else
+		bin/varnishtest/varnishtest -i "$VTC_FILE"
+	fi
 	exit $?
 }
 
 BISECT_GOOD=
 BISECT_BAD=
 MAKE_JOBS=
+INVERSE=
 RUN_MODE=false
 VTC_FILE=
 
-while getopts b:g:hj:r OPT
+while getopts b:g:hij:r OPT
 do
 	case $OPT in
 	b) BISECT_BAD=$OPTARG ;;
 	g) BISECT_GOOD=$OPTARG ;;
 	h) usage ;;
+	i) INVERSE=-i ;;
 	j) MAKE_JOBS=$OPTARG ;;
 	r) RUN_MODE=true ;; # -r usage is strictly internal
 	*) usage "wrong usage" >&2 ;;
@@ -128,5 +140,6 @@ cd "$ROOT_DIR"
 git bisect start
 git bisect good "$BISECT_GOOD"
 git bisect bad "$BISECT_BAD"
-git bisect run "$TMP_DIR"/vtc-bisect.sh -r -j "$MAKE_JOBS" "$TMP_DIR"/bisect.vtc
+git bisect run "$TMP_DIR"/vtc-bisect.sh -r -j "$MAKE_JOBS" $INVERSE \
+	"$TMP_DIR"/bisect.vtc
 git bisect reset


More information about the varnish-commit mailing list