Patchwork [2,of,2,STABLE] test-worker: make the test stronger

login
register
mail settings
Submitter Jun Wu
Date April 20, 2017, 4:18 p.m.
Message ID <2131b2f373c93d6d6bfc.1492705082@x1c>
Download mbox | patch
Permalink /patch/20272/
State Changes Requested
Headers show

Comments

Jun Wu - April 20, 2017, 4:18 p.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1492704139 25200
#      Thu Apr 20 09:02:19 2017 -0700
# Node ID 2131b2f373c93d6d6bfc834436208c36363b85cf
# Parent  f0bd43ca0d5659a1e49bf4948a9d3d0f30a69e34
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 2131b2f373c9
test-worker: make the test stronger

This patch makes it easier to exercise the "killworkers" code path, to
verify the fix of the former patch.

Patch

diff --git a/tests/test-worker.t b/tests/test-worker.t
--- a/tests/test-worker.t
+++ b/tests/test-worker.t
@@ -3,4 +3,5 @@  Test UI worker interaction
   $ cat > t.py <<EOF
   > from __future__ import absolute_import, print_function
+  > import time
   > from mercurial import (
   >     cmdutil,
@@ -23,4 +24,5 @@  Test UI worker interaction
   >         ui.status('run\n')
   >         yield 1, arg
+  >     time.sleep(0.1) # easier to trigger killworkers code path
   > functable = {
   >     'abort': abort,
@@ -73,11 +75,11 @@  Run tests without worker by forcing a lo
 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 | grep '^Traceback'
   Traceback (most recent call last):