Sometimes it's required to temporary disable tests, reduce number of iterations or scale
timeouts under race detector.
We use this extensively for C++ race detector and memory checker in large projects that
develop quickly (e.g. Chromium).
Currently it's quite difficult to do, you need to add 2 new files (+build race/!race).
When the test is fixed, you need to delete the files consequently.
where we have to completely disable the test, while we want to do it only under race
The proposal is to add something like
const IsEnabled = true/false
The text was updated successfully, but these errors were encountered:
Will not fix.
Text added in my rejection of this CL:
testing.Short is used to make a test suite run fast enough on small machines.
Proper use expects that correctness is well covered even if long tests are
Code that skips a test when the operating system is Windows, for example, is
dealing with unpleasant realities. Ideally such tests would be protected by a
build tag, but it is inconvenient to break them out just for the sake of one
peculiar property of a host operating system. Also, it's important to remember
to revisit such tests from time to time and make sure they really do need to be
This CL suggests a third category: correctness under the race detector. (If it's
just a matter of slowness, there's testing.Short for that.) All tests should
pass under the race detector, unless the race detector has a bug, in which case
that should be fixed. Here the idea of skipping a test for correctness issues
feels very wrong, since tests will pass but the code is incorrect - it has a
race! Therefore it seems very unwise to encourage people to skip tests that
should succeed, and the addition of a special function to do this is
For those rare cases where, for whatever reason, it is necessary, custom
solutions are easy enough to implement. But making it feel normal to deny the
race detector a chance to verify a test is working goes against the very idea of