~ubuntu-branches/ubuntu/intrepid/git-core/intrepid-security

« back to all changes in this revision

Viewing changes to t/t6002-rev-list-bisect.sh

  • Committer: Package Import Robot
  • Author(s): Gerrit Pape
  • Date: 2007-10-04 08:27:01 UTC
  • mfrom: (1.1.23)
  • Revision ID: package-import@ubuntu.com-20071004082701-rsd058ontoqz4i30
Tags: 1:1.5.3.4-1
new upstream point release (closes: #445188).

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#
3
3
# Copyright (c) 2005 Jon Seymour
4
4
#
5
 
test_description='Tests git-rev-list --bisect functionality'
 
5
test_description='Tests git rev-list --bisect functionality'
6
6
 
7
7
. ./test-lib.sh
8
8
. ../t6000lib.sh # t6xxx specific functions
16
16
        _max_diff=$1
17
17
        _bisect_option=$2
18
18
        shift 2
19
 
        _bisection=$(git-rev-list $_bisect_option "$@")
20
 
        _list_size=$(git-rev-list "$@" | wc -l)
 
19
        _bisection=$(git rev-list $_bisect_option "$@")
 
20
        _list_size=$(git rev-list "$@" | wc -l)
21
21
        _head=$1
22
22
        shift 1
23
 
        _bisection_size=$(git-rev-list $_bisection "$@" | wc -l)
 
23
        _bisection_size=$(git rev-list $_bisection "$@" | wc -l)
24
24
        [ -n "$_list_size" -a -n "$_bisection_size" ] ||
25
25
        error "test_bisection_diff failed"
26
26
 
27
27
        # Test if bisection size is close to half of list size within
28
28
        # tolerance.
29
 
        # 
 
29
        #
30
30
        _bisect_err=`expr $_list_size - $_bisection_size \* 2`
31
31
        test "$_bisect_err" -lt 0 && _bisect_err=`expr 0 - $_bisect_err`
32
32
        _bisect_err=`expr $_bisect_err / 2` ; # floor
37
37
}
38
38
 
39
39
date >path0
40
 
git-update-index --add path0
41
 
save_tag tree git-write-tree
 
40
git update-index --add path0
 
41
save_tag tree git write-tree
42
42
on_committer_date "1971-08-16 00:00:00" hide_error save_tag root unique_commit root tree
43
43
on_committer_date "1971-08-16 00:00:01" save_tag l0 unique_commit l0 tree -p root
44
44
on_committer_date "1971-08-16 00:00:02" save_tag l1 unique_commit l1 tree -p l0
58
58
on_committer_date "1971-08-16 00:00:16" save_tag l3 unique_commit l3 tree -p a4
59
59
on_committer_date "1971-08-16 00:00:17" save_tag l4 unique_commit l4 tree -p l3
60
60
on_committer_date "1971-08-16 00:00:18" save_tag l5 unique_commit l5 tree -p l4
61
 
git-update-ref HEAD $(tag l5)
 
61
git update-ref HEAD $(tag l5)
62
62
 
63
63
 
64
64
#     E
116
116
 
117
117
test_sequence()
118
118
{
119
 
        _bisect_option=$1       
120
 
        
 
119
        _bisect_option=$1
 
120
 
121
121
        test_bisection_diff 0 $_bisect_option l0 ^root
122
122
        test_bisection_diff 0 $_bisect_option l1 ^root
123
123
        test_bisection_diff 0 $_bisect_option l2 ^root
152
152
        test_bisection_diff 0 $_bisect_option u3 ^U
153
153
        test_bisection_diff 0 $_bisect_option u4 ^U
154
154
        test_bisection_diff 0 $_bisect_option u5 ^U
155
 
        
 
155
 
156
156
#
157
157
# the following illustrates Linus' binary bug blatt idea.
158
158
#
163
163
# the bisection point is the head - this is the bad point.
164
164
#
165
165
 
166
 
test_output_expect_success "$_bisect_option l5 ^root" 'git-rev-list $_bisect_option l5 ^root' <<EOF
 
166
test_output_expect_success "$_bisect_option l5 ^root" 'git rev-list $_bisect_option l5 ^root' <<EOF
167
167
c3
168
168
EOF
169
169
 
170
 
test_output_expect_success "$_bisect_option l5 ^root ^c3" 'git-rev-list $_bisect_option l5 ^root ^c3' <<EOF
 
170
test_output_expect_success "$_bisect_option l5 ^root ^c3" 'git rev-list $_bisect_option l5 ^root ^c3' <<EOF
171
171
b4
172
172
EOF
173
173
 
174
 
test_output_expect_success "$_bisect_option l5 ^root ^c3 ^b4" 'git-rev-list $_bisect_option l5 ^c3 ^b4' <<EOF
 
174
test_output_expect_success "$_bisect_option l5 ^root ^c3 ^b4" 'git rev-list $_bisect_option l5 ^c3 ^b4' <<EOF
175
175
l3
176
176
EOF
177
177
 
178
 
test_output_expect_success "$_bisect_option l3 ^root ^c3 ^b4" 'git-rev-list $_bisect_option l3 ^root ^c3 ^b4' <<EOF
 
178
test_output_expect_success "$_bisect_option l3 ^root ^c3 ^b4" 'git rev-list $_bisect_option l3 ^root ^c3 ^b4' <<EOF
179
179
a4
180
180
EOF
181
181
 
182
 
test_output_expect_success "$_bisect_option l5 ^b3 ^a3 ^b4 ^a4" 'git-rev-list $_bisect_option l3 ^b3 ^a3 ^a4' <<EOF
 
182
test_output_expect_success "$_bisect_option l5 ^b3 ^a3 ^b4 ^a4" 'git rev-list $_bisect_option l3 ^b3 ^a3 ^a4' <<EOF
183
183
l3
184
184
EOF
185
185
 
187
187
# if l3 is bad, then l4 is bad too - so advance the bad pointer by making b4 the known bad head
188
188
#
189
189
 
190
 
test_output_expect_success "$_bisect_option l4 ^a2 ^a3 ^b ^a4" 'git-rev-list $_bisect_option l4 ^a2 ^a3 ^a4' <<EOF
 
190
test_output_expect_success "$_bisect_option l4 ^a2 ^a3 ^b ^a4" 'git rev-list $_bisect_option l4 ^a2 ^a3 ^a4' <<EOF
191
191
l3
192
192
EOF
193
193
 
194
 
test_output_expect_success "$_bisect_option l3 ^a2 ^a3 ^b ^a4" 'git-rev-list $_bisect_option l3 ^a2 ^a3 ^a4' <<EOF
 
194
test_output_expect_success "$_bisect_option l3 ^a2 ^a3 ^b ^a4" 'git rev-list $_bisect_option l3 ^a2 ^a3 ^a4' <<EOF
195
195
l3
196
196
EOF
197
197
 
201
201
# as another example, let's consider a4 to be the bad head, in which case
202
202
#
203
203
 
204
 
test_output_expect_success "$_bisect_option a4 ^a2 ^a3 ^b4" 'git-rev-list $_bisect_option a4 ^a2 ^a3 ^b4' <<EOF
 
204
test_output_expect_success "$_bisect_option a4 ^a2 ^a3 ^b4" 'git rev-list $_bisect_option a4 ^a2 ^a3 ^b4' <<EOF
205
205
c2
206
206
EOF
207
207
 
208
 
test_output_expect_success "$_bisect_option a4 ^a2 ^a3 ^b4 ^c2" 'git-rev-list $_bisect_option a4 ^a2 ^a3 ^b4 ^c2' <<EOF
 
208
test_output_expect_success "$_bisect_option a4 ^a2 ^a3 ^b4 ^c2" 'git rev-list $_bisect_option a4 ^a2 ^a3 ^b4 ^c2' <<EOF
209
209
c3
210
210
EOF
211
211
 
212
 
test_output_expect_success "$_bisect_option a4 ^a2 ^a3 ^b4 ^c2 ^c3" 'git-rev-list $_bisect_option a4 ^a2 ^a3 ^b4 ^c2 ^c3' <<EOF
 
212
test_output_expect_success "$_bisect_option a4 ^a2 ^a3 ^b4 ^c2 ^c3" 'git rev-list $_bisect_option a4 ^a2 ^a3 ^b4 ^c2 ^c3' <<EOF
213
213
a4
214
214
EOF
215
215
 
219
219
# or consider c3 to be the bad head
220
220
#
221
221
 
222
 
test_output_expect_success "$_bisect_option a4 ^a2 ^a3 ^b4" 'git-rev-list $_bisect_option a4 ^a2 ^a3 ^b4' <<EOF
 
222
test_output_expect_success "$_bisect_option a4 ^a2 ^a3 ^b4" 'git rev-list $_bisect_option a4 ^a2 ^a3 ^b4' <<EOF
223
223
c2
224
224
EOF
225
225
 
226
 
test_output_expect_success "$_bisect_option c3 ^a2 ^a3 ^b4 ^c2" 'git-rev-list $_bisect_option c3 ^a2 ^a3 ^b4 ^c2' <<EOF
 
226
test_output_expect_success "$_bisect_option c3 ^a2 ^a3 ^b4 ^c2" 'git rev-list $_bisect_option c3 ^a2 ^a3 ^b4 ^c2' <<EOF
227
227
c3
228
228
EOF
229
229