Skip to content

Commit 4b63b60

Browse files
committed
rn-49: add article about --stress
1 parent 8cb5706 commit 4b63b60

File tree

1 file changed

+82
-2
lines changed

1 file changed

+82
-2
lines changed

rev_news/drafts/edition-49.md

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,89 @@ This edition covers what happened during the month of February 2019.
2121
### General
2222
-->
2323

24-
<!---
2524
### Reviews
26-
-->
25+
26+
* [test-lib: make '--stress' more bisect-friendly](https://public-inbox.org/git/[email protected]/)
27+
28+
`--stress` is an option that can be passed to a test script from the
29+
Git test suite to try to reproduce rare failures in the test script
30+
by running it many times in parallel.
31+
32+
Gábor Szeder had initially implemented this option starting
33+
[last december](https://public-inbox.org/git/[email protected]/)
34+
based on [a script](https://github.com/peff/git/blob/meta/stress)
35+
that Jeff King, alias Peff had developed and
36+
[mentioned](https://public-inbox.org/git/[email protected]/)
37+
on the mailing list.
38+
39+
That first iteration had been reviewed by Peff, Ævar Arnfjörð
40+
Bjarmason and Junio Hamano, and was followed by a
41+
[second iteration](https://public-inbox.org/git/[email protected]/)
42+
also reviewed by Peff.
43+
44+
A [third](https://public-inbox.org/git/[email protected]/) and
45+
[fourth](https://public-inbox.org/git/[email protected]/)
46+
iteration were sent with only minor changes. The latter then got merged last January,
47+
so the feature was released in Git 2.21.0.
48+
49+
On February 8th Gábor sent a patch to improve on top of his previous
50+
work on `--stress`. The goal was to make it easier to use the
51+
`--stress` along with `git bisect` to find the first commit that
52+
introduced a test failure when the test failure is not easy to
53+
reproduce.
54+
55+
Specifically the patch was addressing two issues with
56+
`--stress`. The first one is that `--stress` runs the test script
57+
endlessly when the test doesn't fail. This is fixed with a new
58+
`--stress-limit=<N>` option "to repeat the test script at most N
59+
times in each of the parallel jobs, and exit with success when the
60+
limit is reached".
61+
62+
The second issue is that when the test script used with `--stress`
63+
fails, it exits with a success error code. This is addressed by
64+
making it exit with a failure error code in this case.
65+
66+
This makes it possible to automatically find the commit that
67+
introduced a flakiness in for example `t1234-foo.sh` using something
68+
like:
69+
70+
```sh
71+
$ git bisect start origin/pu master
72+
$ git bisect run sh -c 'make && cd t && ./t1234-foo.sh --stress --stress-limit=300'
73+
```
74+
75+
Gábor and Peff then discussed a few things. About how to select a
76+
good N to pass to `--stress-limit=<N>`, Gábor suggested runnning the
77+
test script with `--stress` 3-5 times to trigger the failure, taking
78+
the highest repetition count that was necessary for the failure and
79+
multiplying it by 4-6 to get a round number".
80+
81+
Gábor later sent [a following patch](https://public-inbox.org/git/[email protected]/)
82+
to fix a minor issue in his previous patches, as it seems that some
83+
shells require the `!` character to start a non-matching pattern
84+
bracket expression instead of `^` that he had used.
85+
86+
These improvements to the `--stress` option made it in the Git
87+
2.21.0 release too.
88+
89+
Even more recently Johannes Schindelin, alias Dscho, sent
90+
[a small patch series](https://public-inbox.org/git/[email protected]/)
91+
to improve on the previous work by:
92+
93+
- having `--stress-limit=<N>` imply `--stress`
94+
- introducing `--stress-jobs=<N>`
95+
96+
The goal is to avoid mistakenly using `--stress=<N>` when one wants
97+
to limit the number of number of times the test script is run (which
98+
should be done using `--stress-limit=<N>`).
99+
100+
Dscho then sent a [second version](https://public-inbox.org/git/[email protected]/)
101+
of his patch series with a few improvements.
102+
103+
These patches were reviewed by Junio, Eric Sunshine, Peff and
104+
Gábor. The changes have been merged to the 'next' branch and are
105+
planned to be merged in the 'master' branch soon.
106+
27107

28108
<!---
29109
### Support

0 commit comments

Comments
 (0)