From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Subject: [PATCH v4 20/23] t: add basic bitmap functionality tests
Date: Sat, 21 Dec 2013 09:00:38 -0500 [thread overview]
Message-ID: <20131221140038.GT21145@sigill.intra.peff.net> (raw)
In-Reply-To: <20131221135651.GA20818@sigill.intra.peff.net>
Now that we can read and write bitmaps, we can exercise them
with some basic functionality tests. These tests aren't
particularly useful for seeing the benefit, as the test
repo is too small for it to make a difference. However, we
can at least check that using bitmaps does not break anything.
Signed-off-by: Jeff King <peff@peff.net>
---
t/t5310-pack-bitmaps.sh | 138 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 138 insertions(+)
create mode 100755 t/t5310-pack-bitmaps.sh
diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh
new file mode 100755
index 0000000..d2b0c45
--- /dev/null
+++ b/t/t5310-pack-bitmaps.sh
@@ -0,0 +1,138 @@
+#!/bin/sh
+
+test_description='exercise basic bitmap functionality'
+. ./test-lib.sh
+
+test_expect_success 'setup repo with moderate-sized history' '
+ for i in $(test_seq 1 10); do
+ test_commit $i
+ done &&
+ git checkout -b other HEAD~5 &&
+ for i in $(test_seq 1 10); do
+ test_commit side-$i
+ done &&
+ git checkout master &&
+ blob=$(echo tagged-blob | git hash-object -w --stdin) &&
+ git tag tagged-blob $blob &&
+ git config pack.writebitmaps true
+'
+
+test_expect_success 'full repack creates bitmaps' '
+ git repack -ad &&
+ ls .git/objects/pack/ | grep bitmap >output &&
+ test_line_count = 1 output
+'
+
+test_expect_success 'rev-list --test-bitmap verifies bitmaps' '
+ git rev-list --test-bitmap HEAD
+'
+
+rev_list_tests() {
+ state=$1
+
+ test_expect_success "counting commits via bitmap ($state)" '
+ git rev-list --count HEAD >expect &&
+ git rev-list --use-bitmap-index --count HEAD >actual &&
+ test_cmp expect actual
+ '
+
+ test_expect_success "counting partial commits via bitmap ($state)" '
+ git rev-list --count HEAD~5..HEAD >expect &&
+ git rev-list --use-bitmap-index --count HEAD~5..HEAD >actual &&
+ test_cmp expect actual
+ '
+
+ test_expect_success "counting non-linear history ($state)" '
+ git rev-list --count other...master >expect &&
+ git rev-list --use-bitmap-index --count other...master >actual &&
+ test_cmp expect actual
+ '
+
+ test_expect_success "enumerate --objects ($state)" '
+ git rev-list --objects --use-bitmap-index HEAD >tmp &&
+ cut -d" " -f1 <tmp >tmp2 &&
+ sort <tmp2 >actual &&
+ git rev-list --objects HEAD >tmp &&
+ cut -d" " -f1 <tmp >tmp2 &&
+ sort <tmp2 >expect &&
+ test_cmp expect actual
+ '
+
+ test_expect_success "bitmap --objects handles non-commit objects ($state)" '
+ git rev-list --objects --use-bitmap-index HEAD tagged-blob >actual &&
+ grep $blob actual
+ '
+}
+
+rev_list_tests 'full bitmap'
+
+test_expect_success 'clone from bitmapped repository' '
+ git clone --no-local --bare . clone.git &&
+ git rev-parse HEAD >expect &&
+ git --git-dir=clone.git rev-parse HEAD >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'setup further non-bitmapped commits' '
+ for i in $(test_seq 1 10); do
+ test_commit further-$i
+ done
+'
+
+rev_list_tests 'partial bitmap'
+
+test_expect_success 'fetch (partial bitmap)' '
+ git --git-dir=clone.git fetch origin master:master &&
+ git rev-parse HEAD >expect &&
+ git --git-dir=clone.git rev-parse HEAD >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'incremental repack cannot create bitmaps' '
+ test_commit more-1 &&
+ test_must_fail git repack -d
+'
+
+test_expect_success 'incremental repack can disable bitmaps' '
+ test_commit more-2 &&
+ git repack -d --no-write-bitmap-index
+'
+
+test_expect_success 'full repack, reusing previous bitmaps' '
+ git repack -ad &&
+ ls .git/objects/pack/ | grep bitmap >output &&
+ test_line_count = 1 output
+'
+
+test_expect_success 'fetch (full bitmap)' '
+ git --git-dir=clone.git fetch origin master:master &&
+ git rev-parse HEAD >expect &&
+ git --git-dir=clone.git rev-parse HEAD >actual &&
+ test_cmp expect actual
+'
+
+test_lazy_prereq JGIT '
+ type jgit
+'
+
+test_expect_success JGIT 'we can read jgit bitmaps' '
+ git clone . compat-jgit &&
+ (
+ cd compat-jgit &&
+ rm -f .git/objects/pack/*.bitmap &&
+ jgit gc &&
+ git rev-list --test-bitmap HEAD
+ )
+'
+
+test_expect_success JGIT 'jgit can read our bitmaps' '
+ git clone . compat-us &&
+ (
+ cd compat-us &&
+ git repack -adb &&
+ # jgit gc will barf if it does not like our bitmaps
+ jgit gc
+ )
+'
+
+test_done
--
1.8.5.1.399.g900e7cd
next prev parent reply other threads:[~2013-12-21 14:00 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-21 13:56 [PATCH v4 0/22] pack bitmaps Jeff King
2013-12-21 13:59 ` [PATCH v4 01/23] sha1write: make buffer const-correct Jeff King
2013-12-22 9:06 ` Christian Couder
2013-12-21 13:59 ` [PATCH v4 02/23] revindex: Export new APIs Jeff King
2013-12-21 13:59 ` [PATCH v4 03/23] pack-objects: Refactor the packing list Jeff King
2013-12-21 13:59 ` [PATCH v4 04/23] pack-objects: factor out name_hash Jeff King
2013-12-21 13:59 ` [PATCH v4 05/23] revision: allow setting custom limiter function Jeff King
2013-12-21 13:59 ` [PATCH v4 06/23] sha1_file: export `git_open_noatime` Jeff King
2013-12-21 13:59 ` [PATCH v4 07/23] compat: add endianness helpers Jeff King
2013-12-21 13:59 ` [PATCH v4 08/23] ewah: compressed bitmap implementation Jeff King
2014-01-23 2:05 ` Jonathan Nieder
2014-01-23 18:33 ` Jeff King
2014-01-23 18:35 ` [PATCH 1/2] compat: move unaligned helpers to bswap.h Jeff King
2014-01-23 19:41 ` Jonathan Nieder
2014-01-23 19:44 ` Jeff King
2014-01-23 19:56 ` Jonathan Nieder
2014-01-23 20:04 ` Jeff King
2014-01-23 20:08 ` Jonathan Nieder
2014-01-23 20:09 ` Jeff King
2014-01-23 18:35 ` [PATCH 2/2] ewah: support platforms that require aligned reads Jeff King
2014-01-23 19:52 ` [PATCH v4 08/23] ewah: compressed bitmap implementation Jonathan Nieder
2014-01-23 20:03 ` Jeff King
2014-01-23 20:12 ` Jonathan Nieder
2014-01-23 20:13 ` Jeff King
2014-01-23 20:23 ` Jonathan Nieder
2014-01-23 20:29 ` Jeff King
2014-01-23 20:38 ` Jeff King
2014-01-23 20:14 ` Shawn Pearce
2014-01-23 20:26 ` Jeff King
2014-01-23 21:53 ` brian m. carlson
2014-01-23 22:07 ` Jeff King
2014-01-23 22:17 ` Jonathan Nieder
2014-01-23 22:26 ` Jeff King
2014-01-23 22:33 ` Jonathan Nieder
2014-01-23 20:18 ` Jonathan Nieder
2014-01-23 21:20 ` [PATCH v2 0/3] unaligned reads from .bitmap files Jeff King
2014-01-23 21:23 ` [PATCH 1/3] block-sha1: factor out get_be and put_be wrappers Jeff King
2014-01-23 23:19 ` Jonathan Nieder
2014-01-23 21:26 ` [PATCH 2/3] read-cache: use get_be32 instead of hand-rolled ntoh_l Jeff King
2014-01-23 23:34 ` Jonathan Nieder
2014-01-24 2:22 ` Jeff King
2014-01-23 21:27 ` [PATCH 3/3] ewah: support platforms that require aligned reads Jeff King
2014-01-23 23:44 ` Jonathan Nieder
2014-01-23 23:49 ` Vicent Martí
2014-01-24 0:15 ` Jonathan Nieder
2014-01-23 23:17 ` [PATCH v2 0/3] unaligned reads from .bitmap files Jonathan Nieder
2013-12-21 13:59 ` [PATCH v4 09/23] documentation: add documentation for the bitmap format Jeff King
2013-12-21 14:00 ` [PATCH v4 10/23] pack-bitmap: add support for bitmap indexes Jeff King
2013-12-21 14:00 ` [PATCH v4 11/23] pack-objects: split add_object_entry Jeff King
2013-12-21 14:00 ` [PATCH v4 12/23] pack-objects: use bitmaps when packing objects Jeff King
2013-12-21 14:00 ` [PATCH v4 13/23] rev-list: add bitmap mode to speed up object lists Jeff King
2013-12-21 14:00 ` [PATCH v4 14/23] pack-objects: implement bitmap writing Jeff King
2013-12-21 14:00 ` [PATCH v4 15/23] repack: stop using magic number for ARRAY_SIZE(exts) Jeff King
2013-12-21 14:00 ` [PATCH v4 16/23] repack: turn exts array into array-of-struct Jeff King
2013-12-21 14:00 ` [PATCH v4 17/23] repack: handle optional files created by pack-objects Jeff King
2013-12-21 14:00 ` [PATCH v4 18/23] repack: consider bitmaps when performing repacks Jeff King
2013-12-21 14:00 ` [PATCH v4 19/23] count-objects: recognize .bitmap in garbage-checking Jeff King
2013-12-21 14:00 ` Jeff King [this message]
2013-12-21 14:00 ` [PATCH v4 21/23] t/perf: add tests for pack bitmaps Jeff King
2013-12-21 14:00 ` [PATCH v4 22/23] pack-bitmap: implement optional name_hash cache Jeff King
2013-12-21 14:00 ` [PATCH v4 23/23] compat/mingw.h: Fix the MinGW and msvc builds Jeff King
2013-12-25 22:08 ` Erik Faye-Lund
2013-12-28 10:00 ` Jeff King
2013-12-28 10:06 ` Vicent Martí
2013-12-28 15:58 ` Ramsay Jones
2013-12-21 14:03 ` [PATCH v4 0/22] pack bitmaps Jeff King
2013-12-21 14:05 ` Jeff King
2013-12-21 18:34 ` Thomas Rast
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=20131221140038.GT21145@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
/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).