From: Johannes Sixt <j6t@kdbg.org>
To: Thomas Rast <trast@student.ethz.ch>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH v3] Test fsck a bit harder
Date: Fri, 20 Feb 2009 21:29:51 +0100 [thread overview]
Message-ID: <499F12BF.4080405@kdbg.org> (raw)
In-Reply-To: <effac809336c1e05613eed315483ec32f3a4c75b.1235158438.git.trast@student.ethz.ch>
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
next prev parent reply other threads:[~2009-02-20 20:31 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-19 1:42 What's cooking in git.git (Feb 2009, #06; Wed, 18) Junio C Hamano
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 ` [PATCH v2 3/8] Test diff --dirstat functionality Thomas Rast
2009-02-19 11:13 ` [PATCH v2 4/8] Test log --graph Thomas Rast
2009-02-19 11:13 ` [PATCH v2 5/8] Test fsck a bit harder Thomas Rast
2009-02-20 19:40 ` [PATCH v3] " Thomas Rast
2009-02-20 20:29 ` Johannes Sixt [this message]
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
2009-03-03 7:31 ` Junio C Hamano
2009-02-19 11:13 ` [PATCH v2 6/8] Test log --decorate Thomas Rast
2009-02-19 11:13 ` [PATCH v2 7/8] Test rev-list --parents/--children Thomas Rast
2009-02-19 11:13 ` [PATCH v2 8/8] Test git-patch-id Thomas Rast
2009-02-19 13:46 ` [PATCH v2 0/8] Support coverage testing with GCC/gcov Johannes Schindelin
2009-02-19 14:11 ` Thomas Rast
2009-02-19 14:09 ` Sverre Rabbelier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=499F12BF.4080405@kdbg.org \
--to=j6t@kdbg.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=trast@student.ethz.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).