Added test case for stg refresh
PATCH 1/1 Added test case for stg refresh
---
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
t/t2700-refresh.sh new file +65 -0
@@ -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
Signature · 5 lines
1.5.3.6.740.ge3d12 -- David Kågedal
Quoted 6 lines · David Kågedal
Signed-off-by David Kågedal <[email protected]>---
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?
Quoted 77 lines
t/t2700-refresh.sh | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 65 insertions(+), 0 deletions(-) create mode 100755 t/t2700-refresh.sht/t2700-refresh.sh new file +65
-0@@ -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_doneSignature · 1 line
1.5.3.6.740.ge3d12
Signature · 1 line
David Kågedal, Virtutech
Quoted 8 lines · David Kågedal
Quoted 3 lines · David Kågedal
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?
Quoted 1 line
And maybe it should be called t2301 instead?
Those numbers are just one big jumble anyway, so no need to bother. :-)
Signature · 2 lines
Karl Hasselström, [email protected] www.treskal.com/kalle
Quoted 7 lines · Karl Hasselström
Quoted 5 lines · David Kågedal
Quoted 3 lines · David Kågedal
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?
Signature · 1 line
Catalin
Quoted 3 lines · Catalin Marinas
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.)
Signature · 2 lines
Karl Hasselström, [email protected] www.treskal.com/kalle
Quoted 5 lines · Catalin Marinas
Quoted 4 lines · Karl Hasselström
Quoted 2 lines · David Kågedal
David Kågedal <[email protected]> writes:
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
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 :-)
Signature · 1 line
David Kågedal
Quoted 9 lines · David Kågedal
Quoted 3 lines · Catalin Marinas
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?
Signature · 1 line
Catalin
Quoted 6 lines · Catalin Marinas
Quoted 5 lines · David Kågedal
Quoted 3 lines · Catalin Marinas
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?
Quoted 7 lines
Quoted 4 lines
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.
Signature · 1 line
David Kågedal