@matheusbsbs / matheus-bagliano / commits / 2dee8af676
Fork 0

Test suite for sliding window mmap implementation.

This is a basic set of tests for the sliding window mmap. We mostly focus on the verify-pack and pack-objects implementations (including delta reuse) as these commands appear to cover the bulk of the affected portions of sha1_file.c. The test cases don't verify the virtual memory size used, as this can differ from system to system. Instead it just verifies that we can run with very low values for core.packedGitLimit and core.packedGitWindowSize. Adding pack_report() to the end of both builtin-verify-pack.c and builtin-pack-objects.c and manually inspecting the statistics output can help to verify that the total virtual memory size attributed to pack mmap usage is what one might expect on the current system. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Shawn O. Pearce committed Dec 23, 2006 at 02:34 UTC 2dee8af67688bb24575dd6b07106bc41d9997923
1 file changed +60
t/t5301-sliding-window.sh new
+60
@@ -0,0 +1,60 @@
1 +#!/bin/sh
2 +#
3 +# Copyright (c) 2006 Shawn Pearce
4 +#
5 +
6 +test_description='mmap sliding window tests'
7 +. ./test-lib.sh
8 +
9 +test_expect_success \
10 + 'setup' \
11 + 'rm -f .git/index*
12 + for i in a b c
13 + do
14 + echo $i >$i &&
15 + dd if=/dev/urandom bs=32k count=1 >>$i &&
16 + git-update-index --add $i || return 1
17 + done &&
18 + echo d >d && cat c >>d && git-update-index --add d &&
19 + tree=`git-write-tree` &&
20 + commit1=`git-commit-tree $tree </dev/null` &&
21 + git-update-ref HEAD $commit1 &&
22 + git-repack -a -d &&
23 + test "`git-count-objects`" = "0 objects, 0 kilobytes" &&
24 + pack1=`ls .git/objects/pack/*.pack` &&
25 + test -f "$pack1"'
26 +
27 +test_expect_success \
28 + 'verify-pack -v, defaults' \
29 + 'git-verify-pack -v "$pack1"'
30 +
31 +test_expect_success \
32 + 'verify-pack -v, packedGitWindowSize == 1 page' \
33 + 'git-repo-config core.packedGitWindowSize 512 &&
34 + git-verify-pack -v "$pack1"'
35 +
36 +test_expect_success \
37 + 'verify-pack -v, packedGit{WindowSize,Limit} == 1 page' \
38 + 'git-repo-config core.packedGitWindowSize 512 &&
39 + git-repo-config core.packedGitLimit 512 &&
40 + git-verify-pack -v "$pack1"'
41 +
42 +test_expect_success \
43 + 'repack -a -d, packedGit{WindowSize,Limit} == 1 page' \
44 + 'git-repo-config core.packedGitWindowSize 512 &&
45 + git-repo-config core.packedGitLimit 512 &&
46 + commit2=`git-commit-tree $tree -p $commit1 </dev/null` &&
47 + git-update-ref HEAD $commit2 &&
48 + git-repack -a -d &&
49 + test "`git-count-objects`" = "0 objects, 0 kilobytes" &&
50 + pack2=`ls .git/objects/pack/*.pack` &&
51 + test -f "$pack2"
52 + test "$pack1" \!= "$pack2"'
53 +
54 +test_expect_success \
55 + 'verify-pack -v, defaults' \
56 + 'git-repo-config --unset core.packedGitWindowSize &&
57 + git-repo-config --unset core.packedGitLimit &&
58 + git-verify-pack -v "$pack2"'
59 +
60 +test_done