git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
de59a757f866c928e2dcaa7c73f983a7ed32ba40 blob 9537 bytes (raw)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
 
#!/bin/sh

test_description='progress display'

. ./test-lib.sh

show_cr () {
	tr '\015' Q | sed -e "s/Q/<CR>\\$LF/g"
}

test_expect_success 'setup COLUMNS' '
	COLUMNS=80 &&
	export COLUMNS
'

test_expect_success 'simple progress display' '
	cat >expect <<-\EOF &&
	Working hard: 0, stalled.<CR>
	Working hard: 1          <CR>
	Working hard: 2<CR>
	Working hard: 5<CR>
	Working hard: 5, done.
	EOF

	cat >in <<-\EOF &&
	start 0
	signal
	progress 1
	update
	progress 2
	progress 3
	progress 4
	update
	progress 5
	stop
	EOF
	test-tool progress <in 2>stderr &&

	show_cr <stderr >out &&
	test_cmp expect out
'

test_expect_success 'progress display with total' '
	cat >expect <<-\EOF &&
	Working hard:  33% (1/3)<CR>
	Working hard:  66% (2/3)<CR>
	Working hard: 100% (3/3)<CR>
	Working hard: 100% (3/3), done.
	EOF

	cat >in <<-\EOF &&
	start 3
	progress 1
	progress 2
	progress 3
	stop
	EOF
	test-tool progress <in 2>stderr &&

	show_cr <stderr >out &&
	test_cmp expect out
'

test_expect_success 'stalled progress display' '
	cat >expect <<-\EOF &&
	Working hard:   0% (0/3), stalled.<CR>
	Working hard:  33% (1/3)          <CR>
	Working hard:  66% (2/3)<CR>
	Working hard: 100% (3/3)<CR>
	Working hard: 100% (3/3), done.
	EOF

	cat >in <<-\EOF &&
	start 3
	signal
	signal
	signal
	progress 1
	signal
	update
	signal
	progress 2
	update
	progress 3
	stop
	EOF
	STALLED=1 test-tool progress <in 2>stderr &&

	show_cr <stderr >out &&
	test_cmp expect out
'

test_expect_success 'progress display breaks long lines #0, stalled' '
	sed -e "s/Z$//" >expect <<\EOF &&
Working hard.......2.........3.........4.........5.........6.........7:
    0% (0/100), stalled.<CR>
    1% (1/100)          <CR>
   50% (50/100)<CR>
  100% (100/100)<CR>
  100% (100/100), done.
EOF

	cat >in <<-\EOF &&
	start 100 Working hard.......2.........3.........4.........5.........6.........7
	signal
	progress 1
	progress 50
	progress 100
	stop
	EOF
	test-tool progress <in 2>stderr &&

	show_cr <stderr >out &&
	test_cmp expect out
'

test_expect_success 'progress display breaks long lines #1' '
	sed -e "s/Z$//" >expect <<\EOF &&
Working hard.......2.........3.........4.........5.........6:   0% (100/100000)<CR>
Working hard.......2.........3.........4.........5.........6:   1% (1000/100000)<CR>
Working hard.......2.........3.........4.........5.........6:                   Z
   10% (10000/100000)<CR>
  100% (100000/100000)<CR>
  100% (100000/100000), done.
EOF

	cat >in <<-\EOF &&
	start 100000 Working hard.......2.........3.........4.........5.........6
	progress 100
	progress 1000
	progress 10000
	progress 100000
	stop
	EOF
	test-tool progress <in 2>stderr &&

	show_cr <stderr >out &&
	test_cmp expect out
'

test_expect_success 'progress display breaks long lines #2' '
	sed -e "s/Z$//" >expect <<\EOF &&
Working hard.......2.........3.........4.........5.........6:   0% (1/100000)<CR>
Working hard.......2.........3.........4.........5.........6:   0% (2/100000)<CR>
Working hard.......2.........3.........4.........5.........6:                Z
   10% (10000/100000)<CR>
  100% (100000/100000)<CR>
  100% (100000/100000), done.
EOF

	cat >in <<-\EOF &&
	start 100000 Working hard.......2.........3.........4.........5.........6
	progress 1
	update
	progress 2
	progress 10000
	progress 100000
	stop
	EOF
	test-tool progress <in 2>stderr &&

	show_cr <stderr >out &&
	test_cmp expect out
'

test_expect_success 'progress display breaks long lines #3 - even the first is too long' '
	sed -e "s/Z$//" >expect <<\EOF &&
Working hard.......2.........3.........4.........5.........6:
   25% (25000/100000)<CR>
   50% (50000/100000)<CR>
   75% (75000/100000)<CR>
  100% (100000/100000)<CR>
  100% (100000/100000), done.
EOF

	cat >in <<-\EOF &&
	start 100000 Working hard.......2.........3.........4.........5.........6
	progress 25000
	progress 50000
	progress 75000
	progress 100000
	stop
	EOF
	test-tool progress <in 2>stderr &&

	show_cr <stderr >out &&
	test_cmp expect out
'

test_expect_success 'progress display breaks long lines #4 - title line matches terminal width' '
	cat >expect <<\EOF &&
Working hard.......2.........3.........4.........5.........6.........7.........:
   25% (25000/100000)<CR>
   50% (50000/100000)<CR>
   75% (75000/100000)<CR>
  100% (100000/100000)<CR>
  100% (100000/100000), done.
EOF

	cat >in <<-\EOF &&
	start 100000 Working hard.......2.........3.........4.........5.........6.........7.........
	progress 25000
	progress 50000
	progress 75000
	progress 100000
	stop
	EOF
	test-tool progress <in 2>stderr &&

	show_cr <stderr >out &&
	test_cmp expect out
'

test_expect_success 'progress display with throughput' '
	cat >expect <<-\EOF &&
	Working hard: 0, stalled.<CR>
	Working hard: 10         <CR>
	Working hard: 20, 200.00 KiB | 100.00 KiB/s<CR>
	Working hard: 30, 300.00 KiB | 100.00 KiB/s<CR>
	Working hard: 40, 400.00 KiB | 100.00 KiB/s<CR>
	Working hard: 40, 400.00 KiB | 100.00 KiB/s, done.
	EOF

	cat >in <<-\EOF &&
	start
	throughput 102400 1000
	signal
	progress 10
	throughput 204800 2000
	update
	progress 20
	throughput 307200 3000
	update
	progress 30
	throughput 409600 4000
	update
	progress 40
	stop
	EOF
	test-tool progress <in 2>stderr &&

	show_cr <stderr >out &&
	test_cmp expect out
'

test_expect_success 'progress display with throughput and total' '
	cat >expect <<-\EOF &&
	Working hard:  25% (10/40)<CR>
	Working hard:  50% (20/40), 200.00 KiB | 100.00 KiB/s<CR>
	Working hard:  75% (30/40), 300.00 KiB | 100.00 KiB/s<CR>
	Working hard: 100% (40/40), 400.00 KiB | 100.00 KiB/s<CR>
	Working hard: 100% (40/40), 400.00 KiB | 100.00 KiB/s, done.
	EOF

	cat >in <<-\EOF &&
	start 40
	throughput 102400 1000
	progress 10
	throughput 204800 2000
	progress 20
	throughput 307200 3000
	progress 30
	throughput 409600 4000
	progress 40
	stop
	EOF
	test-tool progress <in 2>stderr &&

	show_cr <stderr >out &&
	test_cmp expect out
'

test_expect_success 'cover up after throughput shortens' '
	cat >expect <<-\EOF &&
	Working hard: 0, stalled.<CR>
	Working hard: 1          <CR>
	Working hard: 2, 800.00 KiB | 400.00 KiB/s<CR>
	Working hard: 3, 1.17 MiB | 400.00 KiB/s  <CR>
	Working hard: 4, 1.56 MiB | 400.00 KiB/s<CR>
	Working hard: 4, 1.56 MiB | 400.00 KiB/s, done.
	EOF

	cat >in <<-\EOF &&
	start
	throughput 409600 1000
	signal
	progress 1
	throughput 819200 2000
	update
	progress 2
	throughput 1228800 3000
	update
	progress 3
	throughput 1638400 4000
	update
	progress 4
	stop
	EOF
	test-tool progress <in 2>stderr &&

	show_cr <stderr >out &&
	test_cmp expect out
'

test_expect_success 'cover up after throughput shortens a lot' '
	cat >expect <<-\EOF &&
	Working hard: 0, stalled.<CR>
	Working hard: 1          <CR>
	Working hard: 2, 1000.00 KiB | 1000.00 KiB/s<CR>
	Working hard: 3, 3.00 MiB | 1.50 MiB/s      <CR>
	Working hard: 3, 3.00 MiB | 1024.00 KiB/s, done.
	EOF

	cat >in <<-\EOF &&
	start
	throughput 1 1000
	signal
	progress 1
	throughput 1024000 2000
	update
	progress 2
	throughput 3145728 3000
	update
	progress 3
	stop
	EOF
	test-tool progress <in 2>stderr &&

	show_cr <stderr >out &&
	test_cmp expect out
'

test_expect_success 'progress generates traces' '
	cat >in <<-\EOF &&
	start 40
	throughput 102400 1000
	signal
	progress 10
	throughput 204800 2000
	update
	progress 20
	throughput 307200 3000
	update
	progress 30
	throughput 409600 4000
	update
	progress 40
	stop
	EOF

	GIT_TRACE2_EVENT="$(pwd)/trace.event" test-tool progress \
		<in 2>stderr &&

	# t0212/parse_events.perl intentionally omits regions and data.
	test_region progress "Working hard" trace.event &&
	grep "\"key\":\"total_objects\",\"value\":\"40\"" trace.event &&
	grep "\"key\":\"total_bytes\",\"value\":\"409600\"" trace.event
'

test_expect_success 'progress generates traces: stop / start' '
	cat >in <<-\EOF &&
	start
	stop
	EOF

	GIT_TRACE2_EVENT="$(pwd)/trace-startstop.event" test-tool progress \
		<in 2>stderr &&
	test_region progress "Working hard" trace-startstop.event
'

test_expect_success 'progress generates traces: start without stop' '
	cat >in <<-\EOF &&
	start
	EOF

	GIT_TRACE2_EVENT="$(pwd)/trace-start.event" test-tool progress \
		<in 2>stderr &&
	grep region_enter.*progress trace-start.event &&
	! grep region_leave.*progress trace-start.event
'

test_expect_success 'progress generates traces: stop without start' '
	cat >in <<-\EOF &&
	stop
	EOF

	GIT_TRACE2_EVENT="$(pwd)/trace-stop.event" test-tool progress \
		<in 2>stderr &&
	! grep region_enter.*progress trace-stop.event &&
	! grep region_leave.*progress trace-stop.event
'

test_expect_success 'BUG: start two concurrent progress bars' '
	cat >in <<-\EOF &&
	start 0 one
	start 0 two
	EOF

	test_must_fail test-tool progress \
		<in 2>stderr &&
	grep -E "^BUG: .*: should have no global_progress in set_progress_signal\(\)$" stderr
'

test_expect_success 'BUG: display_progress() goes past declared "total"' '
	cat >in <<-\EOF &&
	start 3
	progress 1
	progress 2
	progress 4
	stop
	EOF

	test_must_fail test-tool progress <in 2>stderr &&
	grep "BUG:.*total progress does not match" stderr
'

test_expect_success 'BUG: display_progress() does not reach declared "total"' '
	cat >in <<-\EOF &&
	start 5
	progress 1
	progress 2
	progress 4
	stop
	EOF

	test_must_fail test-tool progress <in 2>stderr &&
	grep "BUG:.*total progress does not match" stderr
'

test_expect_success 'BUG: display_progres() counting backwards' '
	cat >in <<-\EOF &&
	start 3
	progress 1
	progress 2
	progress 1
	EOF

	test_must_fail test-tool progress <in 2>stderr &&
	grep "BUG:.*counting backwards" stderr
'

test_done
debug log:

solving de59a757f86 ...
found de59a757f86 in https://public-inbox.org/git/patch-25.25-099e9c019a9-20210623T155626Z-avarab@gmail.com/
found 3f00e52ce46 in https://public-inbox.org/git/patch-24.25-37b3d1e4d9d-20210623T155626Z-avarab@gmail.com/
found bc458cfc28b in https://public-inbox.org/git/patch-18.25-e21fc66623f-20210623T155626Z-avarab@gmail.com/
found 883e044fe64 in https://public-inbox.org/git/patch-17.25-8f2ba566aae-20210623T155626Z-avarab@gmail.com/
found 476a31222a3 in https://public-inbox.org/git/patch-12.25-c4e7179e957-20210623T155626Z-avarab@gmail.com/
found 66c1989b176 in https://public-inbox.org/git/patch-04.25-900eeb0b115-20210623T155626Z-avarab@gmail.com/
found 50eced31f03 in https://public-inbox.org/git/patch-03.25-397291e0f65-20210623T155626Z-avarab@gmail.com/
found ce6c3434673 in https://public-inbox.org/git/patch-02.25-75e949e21d7-20210623T155626Z-avarab@gmail.com/
found 66c092a0fe3 in https://public-inbox.org/git/patch-1.1-cba5d88ca35-20210621T070114Z-avarab@gmail.com/ ||
	https://public-inbox.org/git/patch-01.25-cba5d88ca35-20210623T155626Z-avarab@gmail.com/
found 22058b503ac in git.git.git
preparing index
index prepared:
100755 22058b503ac78c41f542eb02a5a3dbd1cb200d3e	t/t0500-progress-display.sh

applying [1/10] https://public-inbox.org/git/patch-1.1-cba5d88ca35-20210621T070114Z-avarab@gmail.com/
diff --git a/t/t0500-progress-display.sh b/t/t0500-progress-display.sh
index 22058b503ac..66c092a0fe3 100755

Checking patch t/t0500-progress-display.sh...
Applied patch t/t0500-progress-display.sh cleanly.

skipping https://public-inbox.org/git/patch-01.25-cba5d88ca35-20210623T155626Z-avarab@gmail.com/ for 66c092a0fe3
index at:
100755 66c092a0fe370f93f1741327e7303981da032760	t/t0500-progress-display.sh

applying [2/10] https://public-inbox.org/git/patch-02.25-75e949e21d7-20210623T155626Z-avarab@gmail.com/
diff --git a/t/t0500-progress-display.sh b/t/t0500-progress-display.sh
index 66c092a0fe3..ce6c3434673 100755


applying [3/10] https://public-inbox.org/git/patch-03.25-397291e0f65-20210623T155626Z-avarab@gmail.com/
diff --git a/t/t0500-progress-display.sh b/t/t0500-progress-display.sh
index ce6c3434673..50eced31f03 100755


applying [4/10] https://public-inbox.org/git/patch-04.25-900eeb0b115-20210623T155626Z-avarab@gmail.com/
diff --git a/t/t0500-progress-display.sh b/t/t0500-progress-display.sh
index 50eced31f03..66c1989b176 100755


applying [5/10] https://public-inbox.org/git/patch-12.25-c4e7179e957-20210623T155626Z-avarab@gmail.com/
diff --git a/t/t0500-progress-display.sh b/t/t0500-progress-display.sh
index 66c1989b176..476a31222a3 100755


applying [6/10] https://public-inbox.org/git/patch-17.25-8f2ba566aae-20210623T155626Z-avarab@gmail.com/
diff --git a/t/t0500-progress-display.sh b/t/t0500-progress-display.sh
index 476a31222a3..883e044fe64 100755


applying [7/10] https://public-inbox.org/git/patch-18.25-e21fc66623f-20210623T155626Z-avarab@gmail.com/
diff --git a/t/t0500-progress-display.sh b/t/t0500-progress-display.sh
index 883e044fe64..bc458cfc28b 100755


applying [8/10] https://public-inbox.org/git/patch-24.25-37b3d1e4d9d-20210623T155626Z-avarab@gmail.com/
diff --git a/t/t0500-progress-display.sh b/t/t0500-progress-display.sh
index bc458cfc28b..3f00e52ce46 100755


applying [9/10] https://public-inbox.org/git/patch-25.25-099e9c019a9-20210623T155626Z-avarab@gmail.com/
diff --git a/t/t0500-progress-display.sh b/t/t0500-progress-display.sh
index 3f00e52ce46..de59a757f86 100755

Checking patch t/t0500-progress-display.sh...
Applied patch t/t0500-progress-display.sh cleanly.
Checking patch t/t0500-progress-display.sh...
Applied patch t/t0500-progress-display.sh cleanly.
Checking patch t/t0500-progress-display.sh...
Applied patch t/t0500-progress-display.sh cleanly.
Checking patch t/t0500-progress-display.sh...
Applied patch t/t0500-progress-display.sh cleanly.
Checking patch t/t0500-progress-display.sh...
Applied patch t/t0500-progress-display.sh cleanly.
Checking patch t/t0500-progress-display.sh...
Applied patch t/t0500-progress-display.sh cleanly.
Checking patch t/t0500-progress-display.sh...
Applied patch t/t0500-progress-display.sh cleanly.
Checking patch t/t0500-progress-display.sh...
Applied patch t/t0500-progress-display.sh cleanly.

index at:
100755 de59a757f866c928e2dcaa7c73f983a7ed32ba40	t/t0500-progress-display.sh

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).