Skip to content

Commit c7fc720

Browse files
committed
[lldb] Add more documentation on test variants
This formalizes some of the discussion on D121631. Differential Revision: https://reviews.llvm.org/D121900
1 parent 0f362f9 commit c7fc720

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

lldb/docs/resources/test.rst

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,22 @@ of variants. It's very tempting to add more variants because it's an easy way
185185
to increase test coverage. It doesn't scale. It's easy to set up, but increases
186186
the runtime of the tests and has a large ongoing cost.
187187

188-
The key take away is that the different variants don't obviate the need for
189-
focused tests. So relying on it to test say DWARF5 is a really bad idea.
190-
Instead you should write tests that check the specific DWARF5 feature, and have
191-
the variant as a nice-to-have.
188+
The test variants are most useful when developing a larger feature (e.g. support
189+
for a new DWARF version). The test suite contains a large number of fairly
190+
generic tests, so running the test suite with the feature enabled is a good way
191+
to gain confidence that you haven't missed an important aspect. However, this
192+
genericness makes them poor regression tests. Because it's not clear what a
193+
specific test covers, a random modification to the test case can make it start
194+
(or stop) testing a completely different part of your feature. And since these
195+
tests tend to look very similar, it's easy for a simple bug to cause hundreds of
196+
tests to fail in the same way.
197+
198+
For this reason, we recommend using test variants only while developing a new
199+
feature. This can often be done by running the test suite with different
200+
arguments -- without any modifications to the code. You can create a focused
201+
test for any bug found that way. Often, there will be many tests failing, but a
202+
lot of then will have the same root cause. These tests will be easier to debug
203+
and will not put undue burden on all other bots and developers.
192204

193205
In conclusion, you'll want to opt for an API test to test the API itself or
194206
when you need the expressivity, either for the test case itself or for the

0 commit comments

Comments
 (0)