<div dir="ltr">Great idea! I had thought about doing something similar to this years ago to help diagnose when a test passes in isolation but somehow fails due to one of the bazillion of other tests that ran previously (which can be hard to narrow down if the failure is not early on in a test run).</div><br><div class="gmail_quote"><div dir="ltr">On Fri, 16 Jun 2017 at 09:06 Victor Stinner <<a href="mailto:victor.stinner@gmail.com">victor.stinner@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Last weeks, I worked on a new tool to bisect failing tests because<br>
it's painful to bisect manually reference leaks (I remove as much code<br>
as possible until the code is small enough to be reviewable manually).<br>
<br>
See the bisect_test.py script attached to this issue:<br>
<a href="http://bugs.python.org/issue29512" rel="noreferrer" target="_blank">http://bugs.python.org/issue29512</a><br>
<br>
With the help of Louie Lu, I added new --list-cases option to "python<br>
-m test", so you can now list all test cases and write it into a text<br>
file:<br>
<br>
   ./python -m test --list-cases test_os > tests<br>
<br>
I also added a new --matchfile option, to filter tests using a text<br>
file which contains one pattern per line:<br>
<br>
   ./python -m test --matchfile=tests test_os<br>
<br>
fnmatch is used to match test names, so "*" joker character can be<br>
used in test names.<br>
<br>
<br>
My bisection tool takes a text file with the --matchfile format (one<br>
pattern per line) and creates a random subset of tests with half of<br>
the tests. If tests still fail, use the subset. Otherwise, create a<br>
new random subset. Loop until the subset contains a single test<br>
(configurable threshold, -n command line option).<br>
<br>
The long term plan is to integrate the bisection feature directly into regrtest.<br>
<br>
<br>
<br>
Right now, my script is hardcoded to bisect reference leak bugs, but<br>
it should be easy to modify it to bisect other test issues like test<br>
creating files without removing it ("ENV_CHANGED" failure in<br>
regrtest).<br>
<br>
For example, a core file is dumped when running test_subprocess on<br>
FreeBSD buildbots:<br>
<br>
   <a href="http://bugs.python.org/issue30448" rel="noreferrer" target="_blank">http://bugs.python.org/issue30448</a><br>
<br>
But I'm unable to reproduce the issue on my FreeBSD. It would be nice<br>
to be able to automate the bisection on the buildbot directly.<br>
<br>
<br>
--list-cases and --matchfile options are now available in 2.7, 3.5,<br>
3.6 and master (3.7) branches.<br>
<br>
TODO: doctest tests are only partially supported, see:<br>
<br>
  <a href="http://bugs.python.org/issue30683" rel="noreferrer" target="_blank">http://bugs.python.org/issue30683</a><br>
<br>
Victor<br>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/brett%40python.org" rel="noreferrer" target="_blank">https://mail.python.org/mailman/options/python-dev/brett%40python.org</a><br>
</blockquote></div>