[-mm] Bisecting through -mm with quilt
diff mbox series

Message ID 20050923003217.GA18675@mipter.zuzino.mipt.ru
State New, archived
Headers show
Series
  • [-mm] Bisecting through -mm with quilt
Related show

Commit Message

Alexey Dobriyan Sept. 23, 2005, 12:32 a.m. UTC
Quick, Dirty, Fragile, Should Work (TM).

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

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


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

Comments

Andrew Morton Sept. 23, 2005, 12:42 a.m. UTC | #1
Alexey Dobriyan <adobriyan@gmail.com> 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.

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

Patch
diff mbox series

diff -uprN linux-vanilla/mm-bisect linux-mm-bisect/mm-bisect
--- linux-vanilla/mm-bisect	1970-01-01 03:00:00.000000000 +0300
+++ linux-mm-bisect/mm-bisect	2005-09-23 04:25:26.000000000 +0400
@@ -0,0 +1,82 @@ 
+#!/bin/sh
+#
+# Bisecting through -mm.
+#
+# Assumptions
+# -----------
+# 1) X works
+# 2) X-mmY doesn't
+# 3) -mmY in broken-out form is in $QUILT_PATCHES, "quilt push -a"'d
+#
+# Usage cycle
+# -----------
+#	mm-bisect start
+#		...			<=== applying/reverting patches
+#	[recompile]
+#	[retest]
+# 	mm-bisect good			<=== if it works
+#		...
+#	[recompile]
+#	[retest]
+#	mm-bisect bad			<=== if it doesn't
+#		[...]
+#	Sucker is fix-typo.patch	<=== who to blame
+
+usage()
+{
+	echo >&2 'usage: mm-bisect [start | good | bad]'
+	exit 1
+}
+
+case "$#" in
+0)
+	usage
+	;;
+*)
+	CUR=$(quilt applied | wc -l)
+	case "$1" in
+	start)
+		echo 0 >.mm-bisect-good
+		echo $CUR >.mm-bisect-bad
+		;;
+	good)
+		if [ $(($(cat .mm-bisect-bad) - $CUR)) = 1 ]; then
+			quilt push -q >/dev/null
+			echo -n "Sucker is "
+			quilt top
+			rm -f .mm-bisect-bad .mm-bisect-good
+			exit 0
+		fi
+		echo $CUR >.mm-bisect-good
+		;;
+	bad)
+		if [ $(($CUR - $(cat .mm-bisect-good))) = 1 ]; then
+			echo -n "Sucker is "
+			quilt top
+			rm -f .mm-bisect-bad .mm-bisect-good
+			exit 0
+		fi
+		echo $CUR >.mm-bisect-bad
+		;;
+	*)
+		usage
+		;;
+	esac
+	GOOD=$(cat .mm-bisect-good)
+	BAD=$(cat .mm-bisect-bad)
+	MIDDLE=$((($BAD + $GOOD) / 2))
+	echo "[$GOOD .. $BAD] => $MIDDLE"
+	if [ $MIDDLE -lt $CUR ]; then
+		while [ $MIDDLE -lt $(quilt applied | wc -l) ]; do
+			quilt pop -q | sed -e "s/^Removing patch/-/" \
+						-e "/^Now at patch /d"
+		done
+	else
+		while [ $MIDDLE -gt $(quilt applied | wc -l) ]; do
+			quilt push -q | sed -e "s/^Applying patch/+/" \
+						-e "/^Now at patch /d"
+		done
+	fi
+	quilt top
+	echo "[$GOOD .. => $MIDDLE <= .. $BAD]"
+esac