[PATCH -mm v2] Bisecting through -mm with quilt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 22, 2005 at 05:42:50PM -0700, Andrew Morton wrote:
> Alexey Dobriyan <[email protected]> wrote:
> >  Quick, Dirty, Fragile, Should Work (TM).
> 
> hm, I wouldn't use it.  The problem is that a _lot_ of patches in -mm don't
> fscking compile.
> 
> 	bix:/usr/src/25> grep '[-]fix.patch' series | wc
> 	     72      72    2905
> 
> If your bisection happens to land you between foo.patch and foo-fix.patch,
> you have a *known bad* kernel.   What's the point in testing it?
> 
> So I'd recommend the smarter approach: copy the series file to ~/hunt, edit
> ~/hunt and do the bisection by hand, marking the good and bad points in
> ~/hunt as you go.

Done. If this isn't what you want, tell me so.
-----------------------------------------------------------------------
Marking patches as good or bad is separated from applying/reverting.
You can edit "series-bisect-mm" manually, then do "./bisect-mm apply"
and it will change tree to the new middle point.

Manual editing boils down to:
			    .--> "good fix-typo.patch"
	"fix-typo.patch" --<
			    `--> "bad fix-typo.patch"

Signed-off-by: Alexey Dobriyan <[email protected]>
---

 bisect-mm |  108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 108 insertions(+)

--- a/bisect-mm
+++ b/bisect-mm
@@ -0,0 +1,108 @@
+#!/bin/sh
+#
+# Bisecting through -mm with quilt.
+#
+# Assumptions:
+#	* X + linus.patch works
+#	* X-mmY doesn't
+#	* broken-out -mmY is in $QUILT_PATCHES
+#
+# Usage:
+#	./bisect-mm start	mark linus.patch as good, last patch as bad
+#		|
+# +------>------+
+# |		|
+# |	[manually edit series-bisect-mm:		]
+# |	[mark known good patches as "good $GOOD.patch"	]
+# ^	[mark known bad patches as "bad $BAD.patch"	]
+# |		|
+# |	./bisect-mm apply	quilt will apply/revert stuff
+# |		|
+# +------<------+
+# |		|
+# |	     rebuild
+# |	      retest
+# ^		|
+# |	./bisect-mm {bad,good}
+# |		|
+# |		|
+# +------<------+---->	Sucker is fix-typo.patch
+
+usage()
+{
+	echo "usage: bisect-mm [start | good | bad | apply]" >&2
+	exit 1
+}
+
+SERIES=series-bisect-mm
+
+apply()
+{
+	quilt push -q | sed -e "s/^Applying patch/+/" -e "/^Now at patch/d"
+}
+
+revert()
+{
+	quilt pop -q | sed -e "s/^Removing patch/-/" -e "/^Now at patch/d"
+}
+
+case "$#" in
+0)
+	usage
+	;;
+*)
+	case "$1" in
+	start)
+		echo -n "good " >$SERIES
+		quilt series >>$SERIES
+		sed -i "s/$(tail -n1 $SERIES)/bad &/" $SERIES
+		echo "+ $SERIES"
+		;;
+	bad)
+		TOP=$(quilt top)
+		sed -i "s/.*$TOP/bad $TOP/" $SERIES
+		GOOD=$(cat -n $SERIES | grep "good " | tail -n1 | awk '{print $1}')
+		BAD=$(cat -n $SERIES | grep "bad " | head -n1 | awk '{print $1}')
+		if [ $(($BAD - $GOOD)) = 1 ]; then
+			echo -n "Sucker is "
+			quilt top
+			exit 0
+		fi
+		;;
+	good)
+		TOP=$(quilt top)
+		sed -i "s/.*$TOP/good $TOP/" $SERIES
+		GOOD=$(cat -n $SERIES | grep "good " | tail -n1 | awk '{print $1}')
+		BAD=$(cat -n $SERIES | grep "bad " | head -n1 | awk '{print $1}')
+		if [ $(($BAD - $GOOD)) = 1 ]; then
+			apply
+			echo -n "Sucker is "
+			quilt top
+			exit 0
+		fi
+		;;
+	apply)
+		GOOD=$(cat -n $SERIES | grep "good " | tail -n1 | awk '{print $1}')
+		BAD=$(cat -n $SERIES | grep "bad " | head -n1 | awk '{print $1}')
+		MIDDLE=$((($GOOD + $BAD) / 2))
+		TOP=$(quilt top)
+		CUR=$(quilt applied | wc -l)
+
+		if [ $MIDDLE -lt $CUR ]; then
+			while [ $MIDDLE -lt $(quilt applied | wc -l) ]; do
+				revert
+			done
+			quilt top
+		else
+			while [ $MIDDLE -gt $(quilt applied | wc -l) ]; do
+				apply
+			done
+		fi
+		echo "[$GOOD .. => $MIDDLE <= .. $BAD]"
+		;;
+	*)
+		usage
+		;;
+	esac
+	;;
+esac

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux