changeset 32114:44a98a2ea431

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.
author Jun Wu <quark@fb.com>
date Sat, 22 Apr 2017 17:13:05 -0700
parents 9f0c055eebae
children ef966bcf48a5
files tests/test-worker.t
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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 <<EOF
   > 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