@matheusbsbs / matheus-bagliano / commits / 7f732c632f
Fork 0

t5500: test fix

Relying on eye-candy progress bar was fragile to begin with. Run fetch-pack with -k option, and count the objects that are in the pack that were transferred from the other end. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Apr 13, 2006 at 22:28 UTC 7f732c632ff7a1adc2309257becdc0c1fe76b514
1 file changed +14 -19
t/t5500-fetch-pack.sh
+14 -19
@@ -12,11 +12,6 @@ test_description='Testing multi_ack pack fetching
12
13 # Some convenience functions
14
15 -function show_count () {
16 - commit_count=$(($commit_count+1))
17 - printf " %d\r" $commit_count
18 -}
19 -
15 function add () {
16 local name=$1
17 local text="$@"
@@ -55,13 +50,6 @@ function test_expect_object_count () {
50 "test $count = $output"
51 }
52
58 -function test_repack () {
59 - local rep=$1
60 -
61 - test_expect_success "repack && prune-packed in $rep" \
62 - '(git-repack && git-prune-packed)2>>log.txt'
63 -}
64 -
53 function pull_to_client () {
54 local number=$1
55 local heads=$2
@@ -70,13 +58,23 @@ function pull_to_client () {
58
59 cd client
60 test_expect_success "$number pull" \
73 - "git-fetch-pack -v .. $heads > log.txt 2>&1"
61 + "git-fetch-pack -k -v .. $heads"
62 case "$heads" in *A*) echo $ATIP > .git/refs/heads/A;; esac
63 case "$heads" in *B*) echo $BTIP > .git/refs/heads/B;; esac
64 git-symbolic-ref HEAD refs/heads/${heads:0:1}
65 +
66 test_expect_success "fsck" 'git-fsck-objects --full > fsck.txt 2>&1'
78 - test_expect_object_count "after $number pull" $count
79 - pack_count=$(grep Unpacking log.txt|tr -dc "0-9")
67 +
68 + test_expect_success 'check downloaded results' \
69 + 'mv .git/objects/pack/pack-* . &&
70 + p=`ls -1 pack-*.pack` &&
71 + git-unpack-objects <$p &&
72 + git-fsck-objects --full'
73 +
74 + test_expect_success "new object count after $number pull" \
75 + 'idx=`echo pack-*.idx` &&
76 + pack_count=`git-show-index <$idx | wc -l` &&
77 + test $pack_count = $count'
78 test -z "$pack_count" && pack_count=0
79 if [ -z "$no_strict_count_check" ]; then
80 test_expect_success "minimal count" "test $count = $pack_count"
@@ -84,6 +82,7 @@ function pull_to_client () {
82 test $count != $pack_count && \
83 echo "WARNING: $pack_count objects transmitted, only $count of which were needed"
84 fi
85 + rm -f pack-*
86 cd ..
87 }
88
@@ -117,8 +116,6 @@ git-symbolic-ref HEAD refs/heads/B
116
117 pull_to_client 1st "B A" $((11*3))
118
120 -(cd client; test_repack client)
121 -
119 add A11 $A10
120
121 prev=1; cur=2; while [ $cur -le 65 ]; do
@@ -129,8 +126,6 @@ done
126
127 pull_to_client 2nd "B" $((64*3))
128
132 -(cd client; test_repack client)
133 -
129 pull_to_client 3rd "A" $((1*3)) # old fails
130
131 test_done