* [StGit PATCH] Added test case for stg refresh
@ 2007-11-21 10:35 David Kågedal
2007-11-21 10:43 ` David Kågedal
0 siblings, 1 reply; 8+ messages in thread
From: David Kågedal @ 2007-11-21 10:35 UTC (permalink / raw)
To: Karl Hasselström; +Cc: Git Mailing List
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---
This test case fails on the kha/experimental branch. Using "stg
refresh -p <patch>" can cause all sorts of wieirdness, and there is no
test case for it.
t/t2700-refresh.sh | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 65 insertions(+), 0 deletions(-)
create mode 100755 t/t2700-refresh.sh
diff --git a/t/t2700-refresh.sh b/t/t2700-refresh.sh
new file mode 100755
index 0000000..2e7901c
--- /dev/null
+++ b/t/t2700-refresh.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+test_description='Run "stg refresh"'
+
+. ./test-lib.sh
+
+test_expect_success 'Initialize StGit stack' '
+ stg init &&
+ echo expected.txt >> .git/info/exclude &&
+ echo patches.txt >> .git/info/exclude &&
+ stg new p0 -m "base" &&
+ for i in 1 2 3; do
+ echo base >> foo$i.txt &&
+ git add foo$i.txt
+ done
+ stg refresh &&
+ for i in 1 2 3; do
+ stg new p$i -m "foo $i" &&
+ echo "foo $i" >> foo$i.txt &&
+ stg refresh
+ done
+'
+
+cat > expected.txt <<EOF
+p0
+p3
+EOF
+test_expect_success 'Refresh top patch' '
+ echo bar 3 >> foo3.txt &&
+ stg refresh &&
+ stg status &&
+ test -z "$(stg status)" &&
+ stg patches foo3.txt > patches.txt &&
+ diff -u expected.txt patches.txt
+'
+
+cat > expected.txt <<EOF
+p0
+p2
+EOF
+test_expect_success 'Refresh middle patch' '
+ stg status &&
+ echo bar 2 >> foo2.txt &&
+ stg refresh -p p2 &&
+ stg status &&
+ test -z "$(stg status)" &&
+ stg patches foo2.txt > patches.txt &&
+ diff -u expected.txt patches.txt
+'
+
+cat > expected.txt <<EOF
+p0
+p1
+EOF
+test_expect_success 'Refresh bottom patch' '
+ stg status &&
+ echo bar 1 >> foo1.txt &&
+ stg refresh -p p1 &&
+ stg status &&
+ test -z "$(stg status)" &&
+ stg patches foo1.txt > patches.txt &&
+ diff -u expected.txt patches.txt
+'
+
+test_done
--
1.5.3.6.740.ge3d12
--
David Kågedal
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [StGit PATCH] Added test case for stg refresh
2007-11-21 10:35 [StGit PATCH] Added test case for stg refresh David Kågedal
@ 2007-11-21 10:43 ` David Kågedal
2007-11-21 23:15 ` Karl Hasselström
0 siblings, 1 reply; 8+ messages in thread
From: David Kågedal @ 2007-11-21 10:43 UTC (permalink / raw)
To: Karl Hasselström; +Cc: Git Mailing List
David Kågedal <davidk@lysator.liu.se> writes:
> Signed-off-by: David Kågedal <davidk@lysator.liu.se>
> ---
>
> This test case fails on the kha/experimental branch. Using "stg
> refresh -p <patch>" can cause all sorts of wieirdness, and there is no
> test case for it.
I just checked, and it fails on kha/safe as well. So maybe there is
some problem with the test case, but I don't know what it is.
And maybe it should be called t2301 instead?
> t/t2700-refresh.sh | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 65 insertions(+), 0 deletions(-)
> create mode 100755 t/t2700-refresh.sh
>
> diff --git a/t/t2700-refresh.sh b/t/t2700-refresh.sh
> new file mode 100755
> index 0000000..2e7901c
> --- /dev/null
> +++ b/t/t2700-refresh.sh
> @@ -0,0 +1,65 @@
> +#!/bin/sh
> +
> +test_description='Run "stg refresh"'
> +
> +. ./test-lib.sh
> +
> +test_expect_success 'Initialize StGit stack' '
> + stg init &&
> + echo expected.txt >> .git/info/exclude &&
> + echo patches.txt >> .git/info/exclude &&
> + stg new p0 -m "base" &&
> + for i in 1 2 3; do
> + echo base >> foo$i.txt &&
> + git add foo$i.txt
> + done
> + stg refresh &&
> + for i in 1 2 3; do
> + stg new p$i -m "foo $i" &&
> + echo "foo $i" >> foo$i.txt &&
> + stg refresh
> + done
> +'
> +
> +cat > expected.txt <<EOF
> +p0
> +p3
> +EOF
> +test_expect_success 'Refresh top patch' '
> + echo bar 3 >> foo3.txt &&
> + stg refresh &&
> + stg status &&
> + test -z "$(stg status)" &&
> + stg patches foo3.txt > patches.txt &&
> + diff -u expected.txt patches.txt
> +'
> +
> +cat > expected.txt <<EOF
> +p0
> +p2
> +EOF
> +test_expect_success 'Refresh middle patch' '
> + stg status &&
> + echo bar 2 >> foo2.txt &&
> + stg refresh -p p2 &&
> + stg status &&
> + test -z "$(stg status)" &&
> + stg patches foo2.txt > patches.txt &&
> + diff -u expected.txt patches.txt
> +'
> +
> +cat > expected.txt <<EOF
> +p0
> +p1
> +EOF
> +test_expect_success 'Refresh bottom patch' '
> + stg status &&
> + echo bar 1 >> foo1.txt &&
> + stg refresh -p p1 &&
> + stg status &&
> + test -z "$(stg status)" &&
> + stg patches foo1.txt > patches.txt &&
> + diff -u expected.txt patches.txt
> +'
> +
> +test_done
> --
> 1.5.3.6.740.ge3d12
--
David Kågedal, Virtutech
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [StGit PATCH] Added test case for stg refresh
2007-11-21 10:43 ` David Kågedal
@ 2007-11-21 23:15 ` Karl Hasselström
2007-11-21 23:31 ` Catalin Marinas
0 siblings, 1 reply; 8+ messages in thread
From: Karl Hasselström @ 2007-11-21 23:15 UTC (permalink / raw)
To: David Kågedal; +Cc: Git Mailing List, Catalin Marinas
On 2007-11-21 11:43:00 +0100, David Kågedal wrote:
> David Kågedal <davidk@lysator.liu.se> writes:
>
> > This test case fails on the kha/experimental branch. Using "stg
> > refresh -p <patch>" can cause all sorts of wieirdness, and there
> > is no test case for it.
>
> I just checked, and it fails on kha/safe as well. So maybe there is
> some problem with the test case, but I don't know what it is.
Thanks, more tests are always welcome. But it doesn't fail for me.
I've just pushed out updated kha/safe and kha/experimental branches --
with this new test at the bottom of the stack -- and the whole test
suite passes at every step. Could you try the updated branches and see
if you can still make it fail?
> And maybe it should be called t2301 instead?
Those numbers are just one big jumble anyway, so no need to bother.
:-)
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [StGit PATCH] Added test case for stg refresh
2007-11-21 23:15 ` Karl Hasselström
@ 2007-11-21 23:31 ` Catalin Marinas
2007-11-21 23:55 ` Karl Hasselström
2007-11-22 7:59 ` David Kågedal
0 siblings, 2 replies; 8+ messages in thread
From: Catalin Marinas @ 2007-11-21 23:31 UTC (permalink / raw)
To: Karl Hasselström; +Cc: David Kågedal, Git Mailing List
On 21/11/2007, Karl Hasselström <kha@treskal.com> wrote:
> On 2007-11-21 11:43:00 +0100, David Kågedal wrote:
>
> > David Kågedal <davidk@lysator.liu.se> writes:
> >
> > > This test case fails on the kha/experimental branch. Using "stg
> > > refresh -p <patch>" can cause all sorts of wieirdness, and there
> > > is no test case for it.
I noticed the weirdness few days ago and fixed it in
e8813959aa3a7c41ffef61d06068b10519bd4830 (though no test caught it).
Do you still see problems after this commit?
--
Catalin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [StGit PATCH] Added test case for stg refresh
2007-11-21 23:31 ` Catalin Marinas
@ 2007-11-21 23:55 ` Karl Hasselström
2007-11-22 7:59 ` David Kågedal
1 sibling, 0 replies; 8+ messages in thread
From: Karl Hasselström @ 2007-11-21 23:55 UTC (permalink / raw)
To: Catalin Marinas; +Cc: David Kågedal, Git Mailing List
On 2007-11-21 23:31:45 +0000, Catalin Marinas wrote:
> I noticed the weirdness few days ago and fixed it in
> e8813959aa3a7c41ffef61d06068b10519bd4830 (though no test caught it).
> Do you still see problems after this commit?
Confirmed: the test fails before e8813959, and succeeds afterwards.
(You can pull the test from
git://repo.or.cz/stgit/kha.git safe
if you like.)
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [StGit PATCH] Added test case for stg refresh
2007-11-21 23:31 ` Catalin Marinas
2007-11-21 23:55 ` Karl Hasselström
@ 2007-11-22 7:59 ` David Kågedal
2007-11-22 8:15 ` Catalin Marinas
1 sibling, 1 reply; 8+ messages in thread
From: David Kågedal @ 2007-11-22 7:59 UTC (permalink / raw)
To: Karl Hasselström, Catalin Marinas; +Cc: Git Mailing List
"Catalin Marinas" <catalin.marinas@gmail.com> writes:
> On 21/11/2007, Karl Hasselström <kha@treskal.com> wrote:
>> On 2007-11-21 11:43:00 +0100, David Kågedal wrote:
>>
>> > David Kågedal <davidk@lysator.liu.se> writes:
>> >
>> > > This test case fails on the kha/experimental branch. Using "stg
>> > > refresh -p <patch>" can cause all sorts of wieirdness, and there
>> > > is no test case for it.
>
> I noticed the weirdness few days ago and fixed it in
> e8813959aa3a7c41ffef61d06068b10519bd4830 (though no test caught it).
> Do you still see problems after this commit?
The problem I see is that there still is no test case. That is bad and
means that it could break again tomorrow without anyone noticing.
Luckily, I just wrote one for you :-)
--
David Kågedal
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [StGit PATCH] Added test case for stg refresh
2007-11-22 7:59 ` David Kågedal
@ 2007-11-22 8:15 ` Catalin Marinas
2007-11-22 8:38 ` David Kågedal
0 siblings, 1 reply; 8+ messages in thread
From: Catalin Marinas @ 2007-11-22 8:15 UTC (permalink / raw)
To: David Kågedal; +Cc: Karl Hasselström, Git Mailing List
On 22/11/2007, David Kågedal <davidk@lysator.liu.se> wrote:
> "Catalin Marinas" <catalin.marinas@gmail.com> writes:
> > I noticed the weirdness few days ago and fixed it in
> > e8813959aa3a7c41ffef61d06068b10519bd4830 (though no test caught it).
> > Do you still see problems after this commit?
>
> The problem I see is that there still is no test case. That is bad and
> means that it could break again tomorrow without anyone noticing.
>
> Luckily, I just wrote one for you :-)
Thanks :-). We are still far from testing all the possible
combinations. Is there a way to do code coverage in Python?
--
Catalin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [StGit PATCH] Added test case for stg refresh
2007-11-22 8:15 ` Catalin Marinas
@ 2007-11-22 8:38 ` David Kågedal
0 siblings, 0 replies; 8+ messages in thread
From: David Kågedal @ 2007-11-22 8:38 UTC (permalink / raw)
To: Catalin Marinas; +Cc: Git Mailing List, Karl Hasselström
"Catalin Marinas" <catalin.marinas@gmail.com> writes:
> On 22/11/2007, David Kågedal <davidk@lysator.liu.se> wrote:
>> "Catalin Marinas" <catalin.marinas@gmail.com> writes:
>> > I noticed the weirdness few days ago and fixed it in
>> > e8813959aa3a7c41ffef61d06068b10519bd4830 (though no test caught it).
>> > Do you still see problems after this commit?
>>
>> The problem I see is that there still is no test case. That is bad and
>> means that it could break again tomorrow without anyone noticing.
>>
>> Luckily, I just wrote one for you :-)
>
> Thanks :-). We are still far from testing all the possible
> combinations. Is there a way to do code coverage in Python?
Being far from testing everything doesn't mean that you can't start
adding tests for the things you know have a tendency to break. And for
the things that you are going to refactor. And as regression tests
when you fix a bug. A test suite can be built up by adding small parts
at a time.
But no, I don't know of any useful code coverage tool for python, but
I haven't really looked.
--
David Kågedal
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-11-22 8:38 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-21 10:35 [StGit PATCH] Added test case for stg refresh David Kågedal
2007-11-21 10:43 ` David Kågedal
2007-11-21 23:15 ` Karl Hasselström
2007-11-21 23:31 ` Catalin Marinas
2007-11-21 23:55 ` Karl Hasselström
2007-11-22 7:59 ` David Kågedal
2007-11-22 8:15 ` Catalin Marinas
2007-11-22 8:38 ` David Kågedal
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).