* [PATCH -mm] Bisecting through -mm with quilt
@ 2005-09-23 0:32 Alexey Dobriyan
2005-09-23 0:42 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Alexey Dobriyan @ 2005-09-23 0:32 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
Quick, Dirty, Fragile, Should Work (TM).
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -mm] Bisecting through -mm with quilt
2005-09-23 0:32 [PATCH -mm] Bisecting through -mm with quilt Alexey Dobriyan
@ 2005-09-23 0:42 ` Andrew Morton
2005-09-23 15:20 ` [PATCH -mm v2] " Alexey Dobriyan
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2005-09-23 0:42 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: linux-kernel
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH -mm v2] Bisecting through -mm with quilt
2005-09-23 0:42 ` Andrew Morton
@ 2005-09-23 15:20 ` Alexey Dobriyan
2005-09-23 15:33 ` Alexey Dobriyan
0 siblings, 1 reply; 4+ messages in thread
From: Alexey Dobriyan @ 2005-09-23 15:20 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
On Thu, Sep 22, 2005 at 05:42:50PM -0700, Andrew Morton wrote:
> 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.
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 <adobriyan@gmail.com>
---
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -mm v2] Bisecting through -mm with quilt
2005-09-23 15:20 ` [PATCH -mm v2] " Alexey Dobriyan
@ 2005-09-23 15:33 ` Alexey Dobriyan
0 siblings, 0 replies; 4+ messages in thread
From: Alexey Dobriyan @ 2005-09-23 15:33 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
On Fri, Sep 23, 2005 at 07:20:25PM +0400, Alexey Dobriyan wrote:
> On Thu, Sep 22, 2005 at 05:42:50PM -0700, Andrew Morton wrote:
> > 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?
If "./bisect-mm apply" landed you to obviously wrong kernel, with v2 you
can do a couple of "quilt {push,pop}" by hand. "./bisect {bad,good}"
marks _current_ patch as reported by "quilt top".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-09-23 15:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-23 0:32 [PATCH -mm] Bisecting through -mm with quilt Alexey Dobriyan
2005-09-23 0:42 ` Andrew Morton
2005-09-23 15:20 ` [PATCH -mm v2] " Alexey Dobriyan
2005-09-23 15:33 ` Alexey Dobriyan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).