* [PATCH v2 1/8] Support coverage testing with GCC/gcov
2009-02-19 11:13 ` [PATCH v2 0/8] Support coverage testing with GCC/gcov Thomas Rast
@ 2009-02-19 11:13 ` Thomas Rast
2009-02-19 11:13 ` [PATCH v2 2/8] Test that diff can read from stdin Thomas Rast
` (8 subsequent siblings)
9 siblings, 0 replies; 19+ messages in thread
From: Thomas Rast @ 2009-02-19 11:13 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
With gcc's --coverage option, we can perform automatic coverage data
collection for the test suite.
Add a new Makefile target 'coverage' that scraps all previous coverage
results, recompiles git with the required compiler/linker flags (in
addition to any flags you specify manually), then runs the test suite
and compiles a report.
The compilation must be done with all optimizations disabled, since
inlined functions (and for line-by-line coverage, also optimized
branches/loops) break coverage tracking.
The tests are run serially (with -j1). The coverage code should
theoretically allow concurrent access to its data files, but the
author saw random test failures. Obviously this could be improved.
The report currently consists of a list of functions that were never
executed during the tests, which is written to
'coverage-untested-functions'. Once this list becomes reasonably
short, we would also want to look at branches that were never taken.
Currently only toplevel *.c files are considered. It would be nice to
at least include xdiff, but --coverage did not save data to
subdirectories on the system used to write this (gcc 4.3.2).
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
Let the 'all' sub-build of 'coverage' run with the caller's -j setting
so that it can parallelize.
Interdiff:
--- a/Makefile
+++ b/Makefile
@@ -21,8 +21,9 @@
+COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
+
+coverage-build: coverage-clean
++ $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
+ $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
-+ -j1 all test
++ -j1 test
+
+coverage-report:
+ gcov -b *.c
Makefile | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index b040a96..c32881b 100644
--- a/Makefile
+++ b/Makefile
@@ -1640,3 +1640,27 @@ check-docs::
check-builtins::
./check-builtins.sh
+### Test suite coverage testing
+#
+.PHONY: coverage coverage-clean coverage-build coverage-report
+
+coverage:
+ $(MAKE) coverage-build
+ $(MAKE) coverage-report
+
+coverage-clean:
+ rm -f *.gcda *.gcno
+
+COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
+COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
+
+coverage-build: coverage-clean
+ $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
+ $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
+ -j1 test
+
+coverage-report:
+ gcov -b *.c
+ grep '^function.*called 0 ' *.c.gcov \
+ | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
+ | tee coverage-untested-functions
--
1.6.2.rc1.266.gce6c4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 2/8] Test that diff can read from stdin
2009-02-19 11:13 ` [PATCH v2 0/8] Support coverage testing with GCC/gcov Thomas Rast
2009-02-19 11:13 ` [PATCH v2 1/8] " Thomas Rast
@ 2009-02-19 11:13 ` Thomas Rast
2009-02-19 11:13 ` [PATCH v2 3/8] Test diff --dirstat functionality Thomas Rast
` (7 subsequent siblings)
9 siblings, 0 replies; 19+ messages in thread
From: Thomas Rast @ 2009-02-19 11:13 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
Same as v1.
t/t4002-diff-basic.sh | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/t/t4002-diff-basic.sh b/t/t4002-diff-basic.sh
index cc3681f..18695ce 100755
--- a/t/t4002-diff-basic.sh
+++ b/t/t4002-diff-basic.sh
@@ -258,4 +258,12 @@ test_expect_success \
git diff-tree -r -R $tree_A $tree_B >.test-b &&
cmp -s .test-a .test-b'
+test_expect_success \
+ 'diff can read from stdin' \
+ 'test_must_fail git diff --no-index -- MN - < NN |
+ grep -v "^index" | sed "s#/-#/NN#" >.test-a &&
+ test_must_fail git diff --no-index -- MN NN |
+ grep -v "^index" >.test-b &&
+ test_cmp .test-a .test-b'
+
test_done
--
1.6.2.rc1.266.gce6c4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 3/8] Test diff --dirstat functionality
2009-02-19 11:13 ` [PATCH v2 0/8] Support coverage testing with GCC/gcov Thomas Rast
2009-02-19 11:13 ` [PATCH v2 1/8] " Thomas Rast
2009-02-19 11:13 ` [PATCH v2 2/8] Test that diff can read from stdin Thomas Rast
@ 2009-02-19 11:13 ` Thomas Rast
2009-02-19 11:13 ` [PATCH v2 4/8] Test log --graph Thomas Rast
` (6 subsequent siblings)
9 siblings, 0 replies; 19+ messages in thread
From: Thomas Rast @ 2009-02-19 11:13 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
This is only a very rudimentary test, but it was untested before.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
Same as v1.
t/t4013-diff-various.sh | 1 +
t/t4013/diff.diff_--dirstat_master~1_master~2 | 3 +++
2 files changed, 4 insertions(+), 0 deletions(-)
create mode 100644 t/t4013/diff.diff_--dirstat_master~1_master~2
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index 9c70902..0289336 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -268,6 +268,7 @@ diff --no-index --name-status dir2 dir
diff --no-index --name-status -- dir2 dir
diff --no-index dir dir3
diff master master^ side
+diff --dirstat master~1 master~2
EOF
test_done
diff --git a/t/t4013/diff.diff_--dirstat_master~1_master~2 b/t/t4013/diff.diff_--dirstat_master~1_master~2
new file mode 100644
index 0000000..b672e1c
--- /dev/null
+++ b/t/t4013/diff.diff_--dirstat_master~1_master~2
@@ -0,0 +1,3 @@
+$ git diff --dirstat master~1 master~2
+ 40.0% dir/
+$
--
1.6.2.rc1.266.gce6c4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 4/8] Test log --graph
2009-02-19 11:13 ` [PATCH v2 0/8] Support coverage testing with GCC/gcov Thomas Rast
` (2 preceding siblings ...)
2009-02-19 11:13 ` [PATCH v2 3/8] Test diff --dirstat functionality Thomas Rast
@ 2009-02-19 11:13 ` Thomas Rast
2009-02-19 11:13 ` [PATCH v2 5/8] Test fsck a bit harder Thomas Rast
` (5 subsequent siblings)
9 siblings, 0 replies; 19+ messages in thread
From: Thomas Rast @ 2009-02-19 11:13 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
So far there were no tests checking that log --graph actually works.
Note that the tests strip trailing whitespace, as the current --graph
emits trailing whitespace on lines that do not contain anything but
graph lines.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
Same as v1.
t/t4202-log.sh | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 148 insertions(+), 0 deletions(-)
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 7b976ee..93966f7 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -134,5 +134,153 @@ test_expect_success 'log --grep -i' '
test_cmp expect actual
'
+cat > expect <<EOF
+* Second
+* sixth
+* fifth
+* fourth
+* third
+* second
+* initial
+EOF
+
+test_expect_success 'simple log --graph' '
+ git log --graph --pretty=tformat:%s >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'set up merge history' '
+ git checkout -b side HEAD~4 &&
+ test_commit side-1 1 1 &&
+ test_commit side-2 2 2 &&
+ git checkout master &&
+ git merge side
+'
+
+cat > expect <<\EOF
+* Merge branch 'side'
+|\
+| * side-2
+| * side-1
+* | Second
+* | sixth
+* | fifth
+* | fourth
+|/
+* third
+* second
+* initial
+EOF
+
+test_expect_success 'log --graph with merge' '
+ git log --graph --date-order --pretty=tformat:%s |
+ sed "s/ *$//" >actual &&
+ test_cmp expect actual
+'
+
+cat > expect <<\EOF
+* commit master
+|\ Merge: A B
+| | Author: A U Thor <author@example.com>
+| |
+| | Merge branch 'side'
+| |
+| * commit side
+| | Author: A U Thor <author@example.com>
+| |
+| | side-2
+| |
+| * commit tags/side-1
+| | Author: A U Thor <author@example.com>
+| |
+| | side-1
+| |
+* | commit master~1
+| | Author: A U Thor <author@example.com>
+| |
+| | Second
+| |
+* | commit master~2
+| | Author: A U Thor <author@example.com>
+| |
+| | sixth
+| |
+* | commit master~3
+| | Author: A U Thor <author@example.com>
+| |
+| | fifth
+| |
+* | commit master~4
+|/ Author: A U Thor <author@example.com>
+|
+| fourth
+|
+* commit tags/side-1~1
+| Author: A U Thor <author@example.com>
+|
+| third
+|
+* commit tags/side-1~2
+| Author: A U Thor <author@example.com>
+|
+| second
+|
+* commit tags/side-1~3
+ Author: A U Thor <author@example.com>
+
+ initial
+EOF
+
+test_expect_success 'log --graph with full output' '
+ git log --graph --date-order --pretty=short |
+ git name-rev --name-only --stdin |
+ sed "s/Merge:.*/Merge: A B/;s/ *$//" >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'set up more tangled history' '
+ git checkout -b tangle HEAD~6 &&
+ test_commit tangle-a tangle-a a &&
+ git merge master~3 &&
+ git merge side~1 &&
+ git checkout master &&
+ git merge tangle
+'
+
+cat > expect <<\EOF
+* Merge branch 'tangle'
+|\
+| * Merge branch 'side' (early part) into tangle
+| |\
+| * \ Merge branch 'master' (early part) into tangle
+| |\ \
+| * | | tangle-a
+* | | | Merge branch 'side'
+|\ \ \ \
+| * | | | side-2
+| | | |/
+| | |/|
+| |/| |
+| * | | side-1
+* | | | Second
+* | | | sixth
+| | |/
+| |/|
+|/| |
+* | | fifth
+* | | fourth
+|/ /
+* | third
+|/
+* second
+* initial
+EOF
+
+test_expect_success 'log --graph with merge' '
+ git log --graph --date-order --pretty=tformat:%s |
+ sed "s/ *$//" >actual &&
+ test_cmp expect actual
+'
+
test_done
--
1.6.2.rc1.266.gce6c4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 5/8] Test fsck a bit harder
2009-02-19 11:13 ` [PATCH v2 0/8] Support coverage testing with GCC/gcov Thomas Rast
` (3 preceding siblings ...)
2009-02-19 11:13 ` [PATCH v2 4/8] Test log --graph Thomas Rast
@ 2009-02-19 11:13 ` Thomas Rast
2009-02-20 19:40 ` [PATCH v3] " Thomas Rast
2009-02-19 11:13 ` [PATCH v2 6/8] Test log --decorate Thomas Rast
` (4 subsequent siblings)
9 siblings, 1 reply; 19+ messages in thread
From: Thomas Rast @ 2009-02-19 11:13 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
git-fsck, of all tools, has very few tests. This adds some more:
* a corrupted object;
* a branch pointing to a non-commit;
* a tag pointing to a nonexistent object;
* and a tag pointing to an object of a type other than what the tag
itself claims.
Only the first two are caught. At least the third probably should,
too, but currently slips through.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
Fixed a missing --stdin when calling git-hash-object. I also added
some debugging 'cat out' to make it easier to fix the 'grep'
invocation when fsck actually starts printing errors for these
corruptions.
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
-@@ -28,4 +28,69 @@ test_expect_success 'loose objects borrowed from alternate are not missing' '
+@@ -28,4 +28,71 @@ test_expect_success 'loose objects borrowed from alternate are not missing' '
)
'
@@ -79,12 +80,13 @@
+ tag=$(git hash-object -w --stdin < invalid-tag) &&
+ echo $tag > .git/refs/tags/invalid &&
+ git fsck --tags 2>out &&
++ cat out &&
+ grep "could not load tagged object" out &&
+ rm .git/refs/tags/invalid
+'
+
+cat > wrong-tag <<EOF
-+object $(echo blob | git hash-object -w)
++object $(echo blob | git hash-object -w --stdin)
+type commit
+tag wrong
+tagger T A Gger <tagger@example.com> 1234567890 -0000
@@ -96,6 +98,7 @@
+ tag=$(git hash-object -w --stdin < wrong-tag) &&
+ echo $tag > .git/refs/tags/wrong &&
+ git fsck --tags 2>out &&
++ cat out &&
+ grep "some sane error message" out &&
+ rm .git/refs/tags/wrong
+'
t/t1450-fsck.sh | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index 4597af0..a22632f 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -28,4 +28,71 @@ test_expect_success 'loose objects borrowed from alternate are not missing' '
)
'
+# Corruption tests follow. Make sure to remove all traces of the
+# specific corruption you test afterwards, lest a later test trip over
+# it.
+
+test_expect_success 'object with bad sha1' '
+ sha=$(echo blob | git hash-object -w --stdin) &&
+ echo $sha &&
+ old=$(echo $sha | sed "s+^..+&/+") &&
+ new=$(dirname $old)/ffffffffffffffffffffffffffffffffffffff &&
+ sha="$(dirname $new)$(basename $new)"
+ mv .git/objects/$old .git/objects/$new &&
+ git update-index --add --cacheinfo 100644 $sha foo &&
+ tree=$(git write-tree) &&
+ cmt=$(echo bogus | git commit-tree $tree) &&
+ git update-ref refs/heads/bogus $cmt &&
+ (git fsck 2>out; true) &&
+ grep "$sha.*corrupt" out &&
+ rm -f .git/objects/$new &&
+ git update-ref -d refs/heads/bogus &&
+ git read-tree -u --reset HEAD
+'
+
+test_expect_success 'branch pointing to non-commit' '
+ git rev-parse HEAD^{tree} > .git/refs/heads/invalid &&
+ git fsck 2>out &&
+ grep "not a commit" out &&
+ git update-ref -d refs/heads/invalid
+'
+
+cat > invalid-tag <<EOF
+object ffffffffffffffffffffffffffffffffffffffff
+type commit
+tag invalid
+tagger T A Gger <tagger@example.com> 1234567890 -0000
+
+This is an invalid tag.
+EOF
+
+test_expect_failure 'tag pointing to nonexistent' '
+ tag=$(git hash-object -w --stdin < invalid-tag) &&
+ echo $tag > .git/refs/tags/invalid &&
+ git fsck --tags 2>out &&
+ cat out &&
+ grep "could not load tagged object" out &&
+ rm .git/refs/tags/invalid
+'
+
+cat > wrong-tag <<EOF
+object $(echo blob | git hash-object -w --stdin)
+type commit
+tag wrong
+tagger T A Gger <tagger@example.com> 1234567890 -0000
+
+This is an invalid tag.
+EOF
+
+test_expect_failure 'tag pointing to something else than its type' '
+ tag=$(git hash-object -w --stdin < wrong-tag) &&
+ echo $tag > .git/refs/tags/wrong &&
+ git fsck --tags 2>out &&
+ cat out &&
+ grep "some sane error message" out &&
+ rm .git/refs/tags/wrong
+'
+
+
+
test_done
--
1.6.2.rc1.266.gce6c4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v3] Test fsck a bit harder
2009-02-19 11:13 ` [PATCH v2 5/8] Test fsck a bit harder Thomas Rast
@ 2009-02-20 19:40 ` Thomas Rast
2009-02-20 20:29 ` Johannes Sixt
0 siblings, 1 reply; 19+ messages in thread
From: Thomas Rast @ 2009-02-20 19:40 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
git-fsck, of all tools, has very few tests. This adds some more:
* a corrupted object;
* a branch pointing to a non-commit;
* a tag pointing to a nonexistent object;
* and a tag pointing to an object of a type other than what the tag
itself claims.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
I investigated the test failures with v2, and it turns out the problem
was in my use of hash-object. When correctly passing '-t tag' for the
tags, fsck does detect the breakage. So here's an updated version of
this test. Interdiff:
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index 628db19..a22632f 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -66,13 +66,13 @@ tagger T A Gger <tagger@example.com> 1234567890 -0000
This is an invalid tag.
EOF
-test_expect_success 'tag pointing to nonexistent' '
- tag=$(git hash-object -t tag -w --stdin < invalid-tag) &&
+test_expect_failure 'tag pointing to nonexistent' '
+ tag=$(git hash-object -w --stdin < invalid-tag) &&
echo $tag > .git/refs/tags/invalid &&
- git fsck 2>&1 | tee out &&
- grep "missing commit ffffffffffffffffffffffffffffffffffffffff" out &&
- rm .git/refs/tags/invalid &&
- rm -f .git/objects/$(echo $tag | sed "s#^..#&/#")
+ git fsck --tags 2>out &&
+ cat out &&
+ grep "could not load tagged object" out &&
+ rm .git/refs/tags/invalid
'
cat > wrong-tag <<EOF
@@ -84,11 +84,12 @@ tagger T A Gger <tagger@example.com> 1234567890 -0000
This is an invalid tag.
EOF
-test_expect_success 'tag pointing to something else than its type' '
- tag=$(git hash-object -t tag -w --stdin < wrong-tag) &&
+test_expect_failure 'tag pointing to something else than its type' '
+ tag=$(git hash-object -w --stdin < wrong-tag) &&
echo $tag > .git/refs/tags/wrong &&
- git fsck 2>&1 | tee out &&
- grep "Object.*is a blob, not a commit" out &&
+ git fsck --tags 2>out &&
+ cat out &&
+ grep "some sane error message" out &&
rm .git/refs/tags/wrong
'
t/t1450-fsck.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 66 insertions(+), 0 deletions(-)
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index 4597af0..628db19 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -28,4 +28,70 @@ test_expect_success 'loose objects borrowed from alternate are not missing' '
)
'
+# Corruption tests follow. Make sure to remove all traces of the
+# specific corruption you test afterwards, lest a later test trip over
+# it.
+
+test_expect_success 'object with bad sha1' '
+ sha=$(echo blob | git hash-object -w --stdin) &&
+ echo $sha &&
+ old=$(echo $sha | sed "s+^..+&/+") &&
+ new=$(dirname $old)/ffffffffffffffffffffffffffffffffffffff &&
+ sha="$(dirname $new)$(basename $new)"
+ mv .git/objects/$old .git/objects/$new &&
+ git update-index --add --cacheinfo 100644 $sha foo &&
+ tree=$(git write-tree) &&
+ cmt=$(echo bogus | git commit-tree $tree) &&
+ git update-ref refs/heads/bogus $cmt &&
+ (git fsck 2>out; true) &&
+ grep "$sha.*corrupt" out &&
+ rm -f .git/objects/$new &&
+ git update-ref -d refs/heads/bogus &&
+ git read-tree -u --reset HEAD
+'
+
+test_expect_success 'branch pointing to non-commit' '
+ git rev-parse HEAD^{tree} > .git/refs/heads/invalid &&
+ git fsck 2>out &&
+ grep "not a commit" out &&
+ git update-ref -d refs/heads/invalid
+'
+
+cat > invalid-tag <<EOF
+object ffffffffffffffffffffffffffffffffffffffff
+type commit
+tag invalid
+tagger T A Gger <tagger@example.com> 1234567890 -0000
+
+This is an invalid tag.
+EOF
+
+test_expect_success 'tag pointing to nonexistent' '
+ tag=$(git hash-object -t tag -w --stdin < invalid-tag) &&
+ echo $tag > .git/refs/tags/invalid &&
+ git fsck 2>&1 | tee out &&
+ grep "missing commit ffffffffffffffffffffffffffffffffffffffff" out &&
+ rm .git/refs/tags/invalid &&
+ rm -f .git/objects/$(echo $tag | sed "s#^..#&/#")
+'
+
+cat > wrong-tag <<EOF
+object $(echo blob | git hash-object -w --stdin)
+type commit
+tag wrong
+tagger T A Gger <tagger@example.com> 1234567890 -0000
+
+This is an invalid tag.
+EOF
+
+test_expect_success 'tag pointing to something else than its type' '
+ tag=$(git hash-object -t tag -w --stdin < wrong-tag) &&
+ echo $tag > .git/refs/tags/wrong &&
+ git fsck 2>&1 | tee out &&
+ grep "Object.*is a blob, not a commit" out &&
+ rm .git/refs/tags/wrong
+'
+
+
+
test_done
--
1.6.2.rc1.310.g364d6
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH v3] Test fsck a bit harder
2009-02-20 19:40 ` [PATCH v3] " Thomas Rast
@ 2009-02-20 20:29 ` Johannes Sixt
2009-02-21 11:25 ` [PATCH v4] " Thomas Rast
0 siblings, 1 reply; 19+ messages in thread
From: Johannes Sixt @ 2009-02-20 20:29 UTC (permalink / raw)
To: Thomas Rast; +Cc: Junio C Hamano, git
Thomas Rast schrieb:
> +test_expect_success 'object with bad sha1' '
> + sha=$(echo blob | git hash-object -w --stdin) &&
> + echo $sha &&
> + old=$(echo $sha | sed "s+^..+&/+") &&
> + new=$(dirname $old)/ffffffffffffffffffffffffffffffffffffff &&
new=${old%/*}/ffffffffffffffffffffffffffffffffffffff &&
> + sha="$(dirname $new)$(basename $new)"
sha=${new%/*}${new##*/} &&
note the '&&'!
> + mv .git/objects/$old .git/objects/$new &&
> + git update-index --add --cacheinfo 100644 $sha foo &&
> + tree=$(git write-tree) &&
> + cmt=$(echo bogus | git commit-tree $tree) &&
> + git update-ref refs/heads/bogus $cmt &&
> + (git fsck 2>out; true) &&
Any particular reason not to use
test_must_fail git fsck 2>out &&
here?
> + grep "$sha.*corrupt" out &&
> + rm -f .git/objects/$new &&
> + git update-ref -d refs/heads/bogus &&
> + git read-tree -u --reset HEAD
> +'
Shouldn't the cleanup be outside the test_expect_success so that later
tests work even if this one fails? (Ditto for subsequent tests.)
> +test_expect_success 'tag pointing to nonexistent' '
> + tag=$(git hash-object -t tag -w --stdin < invalid-tag) &&
> + echo $tag > .git/refs/tags/invalid &&
> + git fsck 2>&1 | tee out &&
test_must_fail git fsck > out 2>&1 &&
> + grep "missing commit ffffffffffffffffffffffffffffffffffffffff" out &&
...
> +test_expect_success 'tag pointing to something else than its type' '
> + tag=$(git hash-object -t tag -w --stdin < wrong-tag) &&
> + echo $tag > .git/refs/tags/wrong &&
> + git fsck 2>&1 | tee out &&
test_must_fail git fsck > out 2>&1 &&
> + grep "Object.*is a blob, not a commit" out &&
...
-- Hannes
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v4] Test fsck a bit harder
2009-02-20 20:29 ` Johannes Sixt
@ 2009-02-21 11:25 ` Thomas Rast
2009-02-21 19:21 ` Johannes Sixt
0 siblings, 1 reply; 19+ messages in thread
From: Thomas Rast @ 2009-02-21 11:25 UTC (permalink / raw)
To: Junio C Hamano, Johannes Sixt; +Cc: git
git-fsck, of all tools, has very few tests. This adds some more:
* a corrupted object;
* a branch pointing to a non-commit;
* a tag pointing to a nonexistent object;
* and a tag pointing to an object of a type other than what the tag
itself claims.
Some of the involved shell programming is due to Johannes Sixt.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
Johannes Sixt wrote:
> Any particular reason not to use
>
> test_must_fail git fsck 2>out &&
>
> here?
I thought I had seen instances where it notices something wrong, but
still exits with success.
I checked again, and apparently I was dreaming. I changed the tests
to use
test_must_fail git fsck 2>&1 | tee out
instead, which both checks the exit status and makes the tests more
verbose with -v.
> Shouldn't the cleanup be outside the test_expect_success so that later
> tests work even if this one fails? (Ditto for subsequent tests.)
Indeed. I have a tendency to try and wrap as much as possible into
the tests so that it's visible with -v, but here I clearly overshot.
I also used all your shell programming suggestions, thanks a lot.
t/t1450-fsck.sh | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 69 insertions(+), 0 deletions(-)
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index 4597af0..0906b1d 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -28,4 +28,73 @@ test_expect_success 'loose objects borrowed from alternate are not missing' '
)
'
+# Corruption tests follow. Make sure to remove all traces of the
+# specific corruption you test afterwards, lest a later test trip over
+# it.
+
+test_expect_success 'object with bad sha1' '
+ sha=$(echo blob | git hash-object -w --stdin) &&
+ echo $sha &&
+ old=$(echo $sha | sed "s+^..+&/+") &&
+ new=${old%/*}/ffffffffffffffffffffffffffffffffffffff &&
+ sha=${new%/*}${new##*/} &&
+ mv .git/objects/$old .git/objects/$new &&
+ git update-index --add --cacheinfo 100644 $sha foo &&
+ tree=$(git write-tree) &&
+ cmt=$(echo bogus | git commit-tree $tree) &&
+ git update-ref refs/heads/bogus $cmt &&
+ test_must_fail git fsck 2>&1 | tee out &&
+ grep "$sha.*corrupt" out
+'
+
+rm -f .git/objects/$new
+git update-ref -d refs/heads/bogus
+git read-tree -u --reset HEAD
+
+test_expect_success 'branch pointing to non-commit' '
+ git rev-parse HEAD^{tree} > .git/refs/heads/invalid &&
+ git fsck 2>&1 | tee out &&
+ grep "not a commit" out
+'
+
+git update-ref -d refs/heads/invalid
+
+cat > invalid-tag <<EOF
+object ffffffffffffffffffffffffffffffffffffffff
+type commit
+tag invalid
+tagger T A Gger <tagger@example.com> 1234567890 -0000
+
+This is an invalid tag.
+EOF
+
+test_expect_success 'tag pointing to nonexistent' '
+ tag=$(git hash-object -t tag -w --stdin < invalid-tag) &&
+ echo $tag > .git/refs/tags/invalid &&
+ test_must_fail git fsck 2>&1 | tee out &&
+ grep "missing commit ffffffffffffffffffffffffffffffffffffffff" out
+'
+
+rm .git/refs/tags/invalid
+rm -f .git/objects/$(echo $tag | sed "s#^..#&/#")
+
+cat > wrong-tag <<EOF
+object $(echo blob | git hash-object -w --stdin)
+type commit
+tag wrong
+tagger T A Gger <tagger@example.com> 1234567890 -0000
+
+This is an invalid tag.
+EOF
+
+test_expect_success 'tag pointing to something else than its type' '
+ tag=$(git hash-object -t tag -w --stdin < wrong-tag) &&
+ echo $tag > .git/refs/tags/wrong &&
+ test_must_fail git fsck 2>&1 | tee out &&
+ grep "Object.*is a blob, not a commit" out
+'
+
+rm .git/refs/tags/wrong
+
+
test_done
--
1.6.2.rc1.310.ga3b4a
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH v4] Test fsck a bit harder
2009-02-21 11:25 ` [PATCH v4] " Thomas Rast
@ 2009-02-21 19:21 ` Johannes Sixt
2009-03-01 22:32 ` [PATCH v5] " Thomas Rast
0 siblings, 1 reply; 19+ messages in thread
From: Johannes Sixt @ 2009-02-21 19:21 UTC (permalink / raw)
To: Thomas Rast; +Cc: Junio C Hamano, git
On Samstag, 21. Februar 2009, Thomas Rast wrote:
> I changed the tests
> to use
>
> test_must_fail git fsck 2>&1 | tee out
>
> instead, which both checks the exit status and makes the tests more
> verbose with -v.
This is wrong: It does not test the exist status. In a pipeline, the shell
looks only at the exit status of the last command. You really want this as
test_must_fail git fsck >out 2>&1 &&
If you want to have it more verbose, add 'cat out &&'. But IMHO that is
overengineered. If the test detects a regression in the future, it is easy to
inspect the file out if necessary.
-- Hannes
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v5] Test fsck a bit harder
2009-02-21 19:21 ` Johannes Sixt
@ 2009-03-01 22:32 ` Thomas Rast
2009-03-03 7:31 ` Junio C Hamano
0 siblings, 1 reply; 19+ messages in thread
From: Thomas Rast @ 2009-03-01 22:32 UTC (permalink / raw)
To: Johannes Sixt, Junio C Hamano; +Cc: git
git-fsck, of all tools, has very few tests. This adds some more:
* a corrupted object;
* a branch pointing to a non-commit;
* a tag pointing to a nonexistent object;
* and a tag pointing to an object of a type other than what the tag
itself claims.
Some of the involved shell programming is due to Johannes Sixt.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
Sorry for taking so long to fix this.
Johannes Sixt wrote:
> This is wrong: It does not test the exist status. In a pipeline, the shell
> looks only at the exit status of the last command. You really want this as
>
> test_must_fail git fsck >out 2>&1 &&
You're right.
> If you want to have it more verbose, add 'cat out &&'. But IMHO that is
> overengineered. If the test detects a regression in the future, it is easy to
> inspect the file out if necessary.
I usually try to write the tests such that the cause of failure should
be reasonably obvious from the verbose output. But I don't really
care enough to insert stray cats either...
t/t1450-fsck.sh | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 69 insertions(+), 0 deletions(-)
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index 4597af0..d4a83a1 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -28,4 +28,73 @@ test_expect_success 'loose objects borrowed from alternate are not missing' '
)
'
+# Corruption tests follow. Make sure to remove all traces of the
+# specific corruption you test afterwards, lest a later test trip over
+# it.
+
+test_expect_success 'object with bad sha1' '
+ sha=$(echo blob | git hash-object -w --stdin) &&
+ echo $sha &&
+ old=$(echo $sha | sed "s+^..+&/+") &&
+ new=${old%/*}/ffffffffffffffffffffffffffffffffffffff &&
+ sha=${new%/*}${new##*/} &&
+ mv .git/objects/$old .git/objects/$new &&
+ git update-index --add --cacheinfo 100644 $sha foo &&
+ tree=$(git write-tree) &&
+ cmt=$(echo bogus | git commit-tree $tree) &&
+ git update-ref refs/heads/bogus $cmt &&
+ test_must_fail git fsck >out 2>&1 &&
+ grep "$sha.*corrupt" out
+'
+
+rm -f .git/objects/$new
+git update-ref -d refs/heads/bogus
+git read-tree -u --reset HEAD
+
+test_expect_success 'branch pointing to non-commit' '
+ git rev-parse HEAD^{tree} > .git/refs/heads/invalid &&
+ git fsck 2>&1 | tee out &&
+ grep "not a commit" out
+'
+
+git update-ref -d refs/heads/invalid
+
+cat > invalid-tag <<EOF
+object ffffffffffffffffffffffffffffffffffffffff
+type commit
+tag invalid
+tagger T A Gger <tagger@example.com> 1234567890 -0000
+
+This is an invalid tag.
+EOF
+
+test_expect_success 'tag pointing to nonexistent' '
+ tag=$(git hash-object -t tag -w --stdin < invalid-tag) &&
+ echo $tag > .git/refs/tags/invalid &&
+ test_must_fail git fsck >out 2>&1 &&
+ grep "missing commit ffffffffffffffffffffffffffffffffffffffff" out
+'
+
+rm .git/refs/tags/invalid
+rm -f .git/objects/$(echo $tag | sed "s#^..#&/#")
+
+cat > wrong-tag <<EOF
+object $(echo blob | git hash-object -w --stdin)
+type commit
+tag wrong
+tagger T A Gger <tagger@example.com> 1234567890 -0000
+
+This is an invalid tag.
+EOF
+
+test_expect_success 'tag pointing to something else than its type' '
+ tag=$(git hash-object -t tag -w --stdin < wrong-tag) &&
+ echo $tag > .git/refs/tags/wrong &&
+ test_must_fail git fsck >out 2>&1 &&
+ grep "Object.*is a blob, not a commit" out
+'
+
+rm .git/refs/tags/wrong
+
+
test_done
--
1.6.2.rc2.289.g2fa25
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH v5] Test fsck a bit harder
2009-03-01 22:32 ` [PATCH v5] " Thomas Rast
@ 2009-03-03 7:31 ` Junio C Hamano
0 siblings, 0 replies; 19+ messages in thread
From: Junio C Hamano @ 2009-03-03 7:31 UTC (permalink / raw)
To: Thomas Rast; +Cc: Johannes Sixt, git
Thomas Rast <trast@student.ethz.ch> writes:
> Johannes Sixt wrote:
>> This is wrong: It does not test the exist status. In a pipeline, the shell
>> looks only at the exit status of the last command. You really want this as
>>
>> test_must_fail git fsck >out 2>&1 &&
>
> You're right.
And you still write this after the lesson?
> +test_expect_success 'branch pointing to non-commit' '
> + git rev-parse HEAD^{tree} > .git/refs/heads/invalid &&
> + git fsck 2>&1 | tee out &&
> + grep "not a commit" out
> +'
> +git update-ref -d refs/heads/invalid
> +
> +cat > invalid-tag <<EOF
> +object ffffffffffffffffffffffffffffffffffffffff
> +type commit
> +tag invalid
> +tagger T A Gger <tagger@example.com> 1234567890 -0000
> +
> +This is an invalid tag.
> +EOF
Technically speaking, the tag is perfectly valid. It just points to a
commit you do not have.
> +cat > wrong-tag <<EOF
> +object $(echo blob | git hash-object -w --stdin)
> +type commit
> +tag wrong
> +tagger T A Gger <tagger@example.com> 1234567890 -0000
> +
> +This is an invalid tag.
> +EOF
This is indeed invalid.
> +test_expect_success 'tag pointing to something else than its type' '
> + tag=$(git hash-object -t tag -w --stdin < wrong-tag) &&
> + echo $tag > .git/refs/tags/wrong &&
> + test_must_fail git fsck >out 2>&1 &&
> + grep "Object.*is a blob, not a commit" out
> +'
> +
> +rm .git/refs/tags/wrong
I'd rather want to see test_expect_success around this "rm", and replace
that rm with something more git-ish, like "tag -d" or "update-ref -d".
By the way, is it just me or would we want to reword the subject of the
commit to tame it a little bit?
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v2 6/8] Test log --decorate
2009-02-19 11:13 ` [PATCH v2 0/8] Support coverage testing with GCC/gcov Thomas Rast
` (4 preceding siblings ...)
2009-02-19 11:13 ` [PATCH v2 5/8] Test fsck a bit harder Thomas Rast
@ 2009-02-19 11:13 ` Thomas Rast
2009-02-19 11:13 ` [PATCH v2 7/8] Test rev-list --parents/--children Thomas Rast
` (3 subsequent siblings)
9 siblings, 0 replies; 19+ messages in thread
From: Thomas Rast @ 2009-02-19 11:13 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
Same as v1.
t/t4013-diff-various.sh | 1 +
t/t4013/diff.log_--decorate_--all | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 0 deletions(-)
create mode 100644 t/t4013/diff.log_--decorate_--all
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index 0289336..ef16f69 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -207,6 +207,7 @@ log --root -c --patch-with-stat --summary master
log --root --cc --patch-with-stat --summary master
log -SF master
log -SF -p master
+log --decorate --all
whatchanged master
whatchanged -p master
diff --git a/t/t4013/diff.log_--decorate_--all b/t/t4013/diff.log_--decorate_--all
new file mode 100644
index 0000000..12da8ac
--- /dev/null
+++ b/t/t4013/diff.log_--decorate_--all
@@ -0,0 +1,34 @@
+$ git log --decorate --all
+commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (refs/heads/master)
+Merge: 9a6d494 c7a2ab9
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:04:00 2006 +0000
+
+ Merge branch 'side'
+
+commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a (refs/heads/side)
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:03:00 2006 +0000
+
+ Side
+
+commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:02:00 2006 +0000
+
+ Third
+
+commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:01:00 2006 +0000
+
+ Second
+
+ This is the second commit.
+
+commit 444ac553ac7612cc88969031b02b3767fb8a353a (refs/heads/initial)
+Author: A U Thor <author@example.com>
+Date: Mon Jun 26 00:00:00 2006 +0000
+
+ Initial
+$
--
1.6.2.rc1.266.gce6c4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 7/8] Test rev-list --parents/--children
2009-02-19 11:13 ` [PATCH v2 0/8] Support coverage testing with GCC/gcov Thomas Rast
` (5 preceding siblings ...)
2009-02-19 11:13 ` [PATCH v2 6/8] Test log --decorate Thomas Rast
@ 2009-02-19 11:13 ` Thomas Rast
2009-02-19 11:13 ` [PATCH v2 8/8] Test git-patch-id Thomas Rast
` (2 subsequent siblings)
9 siblings, 0 replies; 19+ messages in thread
From: Thomas Rast @ 2009-02-19 11:13 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
Same as v1.
t/t4013-diff-various.sh | 3 +++
t/t4013/diff.rev-list_--children_HEAD | 7 +++++++
t/t4013/diff.rev-list_--parents_HEAD | 7 +++++++
3 files changed, 17 insertions(+), 0 deletions(-)
create mode 100644 t/t4013/diff.rev-list_--children_HEAD
create mode 100644 t/t4013/diff.rev-list_--parents_HEAD
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index ef16f69..9cd5a6e 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -209,6 +209,9 @@ log -SF master
log -SF -p master
log --decorate --all
+rev-list --parents HEAD
+rev-list --children HEAD
+
whatchanged master
whatchanged -p master
whatchanged --root master
diff --git a/t/t4013/diff.rev-list_--children_HEAD b/t/t4013/diff.rev-list_--children_HEAD
new file mode 100644
index 0000000..e7f17d5
--- /dev/null
+++ b/t/t4013/diff.rev-list_--children_HEAD
@@ -0,0 +1,7 @@
+$ git rev-list --children HEAD
+59d314ad6f356dd08601a4cd5e530381da3e3c64
+c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a 59d314ad6f356dd08601a4cd5e530381da3e3c64
+9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0 59d314ad6f356dd08601a4cd5e530381da3e3c64
+1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
+444ac553ac7612cc88969031b02b3767fb8a353a 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
+$
diff --git a/t/t4013/diff.rev-list_--parents_HEAD b/t/t4013/diff.rev-list_--parents_HEAD
new file mode 100644
index 0000000..65d2a80
--- /dev/null
+++ b/t/t4013/diff.rev-list_--parents_HEAD
@@ -0,0 +1,7 @@
+$ git rev-list --parents HEAD
+59d314ad6f356dd08601a4cd5e530381da3e3c64 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0 c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
+c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a 444ac553ac7612cc88969031b02b3767fb8a353a
+9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44
+1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 444ac553ac7612cc88969031b02b3767fb8a353a
+444ac553ac7612cc88969031b02b3767fb8a353a
+$
--
1.6.2.rc1.266.gce6c4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 8/8] Test git-patch-id
2009-02-19 11:13 ` [PATCH v2 0/8] Support coverage testing with GCC/gcov Thomas Rast
` (6 preceding siblings ...)
2009-02-19 11:13 ` [PATCH v2 7/8] Test rev-list --parents/--children Thomas Rast
@ 2009-02-19 11:13 ` Thomas Rast
2009-02-19 13:46 ` [PATCH v2 0/8] Support coverage testing with GCC/gcov Johannes Schindelin
2009-02-19 14:09 ` Sverre Rabbelier
9 siblings, 0 replies; 19+ messages in thread
From: Thomas Rast @ 2009-02-19 11:13 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
So far, git-patch-id was untested. Add some simple checks for output
format and patch (in)equality.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
Same as v1.
t/t4203-patch-id.sh | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
create mode 100755 t/t4203-patch-id.sh
diff --git a/t/t4203-patch-id.sh b/t/t4203-patch-id.sh
new file mode 100755
index 0000000..04f7bae
--- /dev/null
+++ b/t/t4203-patch-id.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+test_description='git patch-id'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ test_commit initial foo a &&
+ test_commit first foo b &&
+ git checkout -b same HEAD^ &&
+ test_commit same-msg foo b &&
+ git checkout -b notsame HEAD^ &&
+ test_commit notsame-msg foo c
+'
+
+test_expect_success 'patch-id output is well-formed' '
+ git log -p -1 | git patch-id > output &&
+ grep "^[a-f0-9]\{40\} $(git rev-parse HEAD)$" output
+'
+
+get_patch_id () {
+ git log -p -1 "$1" | git patch-id |
+ sed "s# .*##" > patch-id_"$1"
+}
+
+test_expect_success 'patch-id detects equality' '
+ get_patch_id master &&
+ get_patch_id same &&
+ test_cmp patch-id_master patch-id_same
+'
+
+test_expect_success 'patch-id detects inequality' '
+ get_patch_id master &&
+ get_patch_id notsame &&
+ ! test_cmp patch-id_master patch-id_notsame
+'
+
+test_done
--
1.6.2.rc1.266.gce6c4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH v2 0/8] Support coverage testing with GCC/gcov
2009-02-19 11:13 ` [PATCH v2 0/8] Support coverage testing with GCC/gcov Thomas Rast
` (7 preceding siblings ...)
2009-02-19 11:13 ` [PATCH v2 8/8] Test git-patch-id Thomas Rast
@ 2009-02-19 13:46 ` Johannes Schindelin
2009-02-19 14:11 ` Thomas Rast
2009-02-19 14:09 ` Sverre Rabbelier
9 siblings, 1 reply; 19+ messages in thread
From: Johannes Schindelin @ 2009-02-19 13:46 UTC (permalink / raw)
To: Thomas Rast; +Cc: Junio C Hamano, git
Hi,
On Thu, 19 Feb 2009, Thomas Rast wrote:
> Junio C Hamano wrote:
> > [Will merge to 'next' soon]
> >
> > * tr/gcov (Sun Feb 15 23:25:45 2009 +0100) 8 commits
> > - Test git-patch-id
> > - Test rev-list --parents/--children
> > - Test log --decorate
> > - Test fsck a bit harder
> > - Test log --graph
> > - Test diff --dirstat functionality
> > - Test that diff can read from stdin
> > - Support coverage testing with GCC/gcov
>
> I noticed two small things that I'd like to fix before this goes
> 'next', so here they are:
>
> * [1/8] Support coverage testing with GCC/gcov
>
> Changed it so the compilation (but not the testing) uses the same -j
> flags as the caller, so that compilation can be done in parallel.
> (It's rather minor compared to the slow testing with optimizations
> turned off, but still.)
I strongly disagree that it is minor. _Especially_ since the tests are
slow, -j makes a huge difference.
And also without making the tests slower, -j makes a dramatic difference
here:
$ /usr/bin/time make -j50 test
...
60.41user 213.92system 2:49.34elapsed 162%CPU
(0avgtext+0avgdata 0maxresident)k
160inputs+401944outputs
(0major+37204627minor)pagefaults 0swaps
$ /usr/bin/time make test
...
88.08user 314.96system 7:28.28elapsed 89%CPU
(0avgtext+0avgdata 0maxresident)k
0inputs+401008outputs
(0major+37223584minor)pagefaults 0swaps
Ciao,
Dscho
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 0/8] Support coverage testing with GCC/gcov
2009-02-19 13:46 ` [PATCH v2 0/8] Support coverage testing with GCC/gcov Johannes Schindelin
@ 2009-02-19 14:11 ` Thomas Rast
0 siblings, 0 replies; 19+ messages in thread
From: Thomas Rast @ 2009-02-19 14:11 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, git
[-- Attachment #1: Type: text/plain, Size: 1918 bytes --]
Johannes Schindelin wrote:
> On Thu, 19 Feb 2009, Thomas Rast wrote:
> > I noticed two small things that I'd like to fix before this goes
> > 'next', so here they are:
> >
> > * [1/8] Support coverage testing with GCC/gcov
> >
> > Changed it so the compilation (but not the testing) uses the same -j
> > flags as the caller, so that compilation can be done in parallel.
> > (It's rather minor compared to the slow testing with optimizations
> > turned off, but still.)
>
> I strongly disagree that it is minor. _Especially_ since the tests are
> slow, -j makes a huge difference.
>
> And also without making the tests slower, -j makes a dramatic difference
> here:
>
> $ /usr/bin/time make -j50 test
That's not the point.
I agree that for the test suite, -j makes a huge impact, since it
takes so long. But even though the docs claim it should be possible,
I've been getting "random" test failures when compiled with coverage
support, that went away with -j1. So the tests still run with -j1, as
with the first version of the series.
However, the first version used a single make invocation for the'all'
and 'test' targets, which of course also means that the _compilation_
('all') happens with -j1. That's not necessary as far as I can see,
and I split them into separate commands in v2, where 'all' doesn't
pass a -j option any more (so that the caller's choice remains in
effect).
What I meant by the above remark is that the maybe 30 seconds you gain
by compiling in parallel are a very minor gain when compared to the
enormous running time of the _sequential_ test suite _without
optimizations_, which feels like 15-20min here, I haven't even timed
it. (I always mount t/ on a tmpfs which does away with the fsync()
bottleneck and lets me do ordinary test runs, with NO_SVN_TESTS, in
under 3min.)
--
Thomas Rast
trast@{inf,student}.ethz.ch
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 0/8] Support coverage testing with GCC/gcov
2009-02-19 11:13 ` [PATCH v2 0/8] Support coverage testing with GCC/gcov Thomas Rast
` (8 preceding siblings ...)
2009-02-19 13:46 ` [PATCH v2 0/8] Support coverage testing with GCC/gcov Johannes Schindelin
@ 2009-02-19 14:09 ` Sverre Rabbelier
9 siblings, 0 replies; 19+ messages in thread
From: Sverre Rabbelier @ 2009-02-19 14:09 UTC (permalink / raw)
To: Thomas Rast; +Cc: Junio C Hamano, git
Heya,
On Thu, Feb 19, 2009 at 12:13, Thomas Rast <trast@student.ethz.ch> wrote:
> I noticed two small things that I'd like to fix before this goes
> 'next', so here they are:
<snip>
> Apart from that it's the same.
I think in this case, where it is the second iteration of the series,
with only few, and minor changes to the series as a whole it's better
to just send the updates as reply to the original version?
--
Cheers,
Sverre Rabbelier
^ permalink raw reply [flat|nested] 19+ messages in thread