# HG changeset patch # User Jun Wu # Date 1492906385 25200 # Node ID 44a98a2ea431edb69715f2f19873be0d7096e798 # Parent 9f0c055eebae8ad8fac00e4934050107ed9fd330 test-worker: exercise more about "killworkers" situation This patch adds some sleep and increases numcpus to exercise the "killworkers" situation. So race conditions could be discovered more easily, if someone changes worker.py incorrectly. Currently worker.py should be free of such issues. diff -r 9f0c055eebae -r 44a98a2ea431 tests/test-worker.t --- a/tests/test-worker.t Sat Apr 22 17:00:50 2017 -0700 +++ b/tests/test-worker.t Sat Apr 22 17:13:05 2017 -0700 @@ -2,6 +2,7 @@ $ cat > t.py < from __future__ import absolute_import, print_function + > import time > from mercurial import ( > cmdutil, > error, @@ -22,6 +23,7 @@ > for arg in args: > ui.status('run\n') > yield 1, arg + > time.sleep(0.1) # easier to trigger killworkers code path > functable = { > 'abort': abort, > 'exc': exc, @@ -74,20 +76,20 @@ Known exception should be caught, but printed if --traceback is enabled - $ hg --config "extensions.t=$abspath" --config 'worker.numcpus=2' \ - > test 100000.0 abort + $ hg --config "extensions.t=$abspath" --config 'worker.numcpus=8' \ + > test 100000.0 abort 2>&1 start abort: known exception [255] - $ hg --config "extensions.t=$abspath" --config 'worker.numcpus=2' \ + $ hg --config "extensions.t=$abspath" --config 'worker.numcpus=8' \ > test 100000.0 abort --traceback 2>&1 | egrep '^(SystemExit|Abort)' Abort: known exception SystemExit: 255 Traceback must be printed for unknown exceptions - $ hg --config "extensions.t=$abspath" --config 'worker.numcpus=2' \ + $ hg --config "extensions.t=$abspath" --config 'worker.numcpus=8' \ > test 100000.0 exc 2>&1 | grep '^Exception' Exception: unknown exception