# HG changeset patch # User Augie Fackler # Date 2014-10-09 19:10:40 # Node ID 9a20f53e436f42c2704b609b2f6ae1ee23ff0a0e # Parent 2be7d5ebd4d0552493ce18c509686286ee712010 run-tests: handle --jobs and --first gracefully Without this change, --first causes currently-running tests to explode in violent and surprising ways when their temporary directory gets cleaned up. Now we just suppress failure messages from non-first failures when running in --first mode. diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -1189,6 +1189,11 @@ class TestResult(unittest._TextTestResul def addOutputMismatch(self, test, ret, got, expected): """Record a mismatch in test output for a particular test.""" + if self.shouldStop: + # don't print, some other test case already failed and + # printed, we're just stale and probably failed due to our + # temp dir getting cleaned up. + return accepted = False failed = False diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -215,8 +215,29 @@ Parallel runs python hash seed: * (glob) [1] +failures in parallel with --first should only print one failure + >>> f = open('test-nothing.t', 'w') + >>> f.write('foo\n' * 1024) + >>> f.write(' $ sleep 1') + $ $TESTDIR/run-tests.py --with-hg=`which hg` --jobs 2 --first + + --- $TESTTMP/test-failure*.t (glob) + +++ $TESTTMP/test-failure*.t.err (glob) + @@ -1,4 +1,4 @@ + $ echo babar + - rataxes + + babar + This is a noop statement so that + this test is still more bytes than success. + + Failed test-failure*.t: output changed (glob) + # Ran 2 tests, 0 skipped, 0 warned, 1 failed. + python hash seed: * (glob) + [1] + + (delete the duplicated test file) - $ rm test-failure-copy.t + $ rm test-failure-copy.t test-nothing.t Interactive run