Commit 90d6814
authored
CA-423576: fix cli_progress_bar crashes (#6892)
cli_progress_bar is used by `xe --progress`, and I've reused it in my
test code in #6858.
However >90% of my test runs failed on various machines due to a
`String.blit` exception from `cli_progress_bar`.
There are 2 possible reasons, not sure which one caused the failure, but
I've fixed both, and now I have a lot more green tests (and the failures
are due to actual bugs in the product, not bugs in the progress bar):
* if the ETA printed would be >99h (even just temporarily) then we'd
overflow the buffer's size and raise an exception. `%02d` means at least
2 digits, not at most!
* if time goes backwards then we'd get a negative ETA and try to print a
`-` and overflow the buffer size again and raise an exception. Replaced
it with monotonic time
This also contains an improvement I've made on the other PR to print
total time in `ms` (to avoid having to solve rebase conflicts twice in
the 2 PRs). This avoids printing awkward looking lines like Total time
00:00:00, when it actually took 0.9s maybe.2 files changed
Lines changed: 27 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
| |||
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
73 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
74 | 87 | | |
75 | 88 | | |
76 | | - | |
| 89 | + | |
77 | 90 | | |
78 | 91 | | |
79 | 92 | | |
| |||
108 | 121 | | |
109 | 122 | | |
110 | 123 | | |
111 | | - | |
112 | | - | |
| 124 | + | |
| 125 | + | |
113 | 126 | | |
114 | 127 | | |
115 | 128 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
11 | 17 | | |
12 | 18 | | |
13 | 19 | | |
| 20 | + | |
14 | 21 | | |
15 | 22 | | |
16 | 23 | | |
| |||
37 | 44 | | |
38 | 45 | | |
39 | 46 | | |
| 47 | + | |
40 | 48 | | |
41 | 49 | | |
42 | 50 | | |
| |||
0 commit comments