[PATCH -mm] Bisecting through -mm with quilt

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

 



Quick, Dirty, Fragile, Should Work (TM).

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

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

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

-
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