[PATCH 1 of 2 STABLE] worker: add basic test to ensure child processes are managed well

Yuya Nishihara yuya at tcha.org
Sat Feb 25 04:27:48 UTC 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1487993617 -32400
#      Sat Feb 25 12:33:37 2017 +0900
# Branch stable
# Node ID 21b8ba399a3ba480f66b53d97842ff61d5ec0f28
# Parent  18fb3cf572b49ad25a0f0e62ce1f737c7cef4ec1
worker: add basic test to ensure child processes are managed well

This should catch the bug fixed by "worker: ignore meaningless exit status
indication returned by os.waitpid()."

Before, worker.py was untested since test repositories are relatively small.

diff --git a/tests/test-simple-update.t b/tests/test-simple-update.t
--- a/tests/test-simple-update.t
+++ b/tests/test-simple-update.t
@@ -56,3 +56,37 @@ update to rev 0 with a date
   [255]
 
   $ cd ..
+
+update with worker processes
+
+#if no-windows
+
+  $ cat <<EOF > forceworker.py
+  > from mercurial import extensions, worker
+  > def nocost(orig, ui, costperop, nops):
+  >     return worker._numworkers(ui) > 1
+  > def uisetup(ui):
+  >     extensions.wrapfunction(worker, 'worthwhile', nocost)
+  > EOF
+
+  $ hg init worker
+  $ cd worker
+  $ cat <<EOF >> .hg/hgrc
+  > [extensions]
+  > forceworker = $TESTTMP/forceworker.py
+  > [worker]
+  > numcpus = 4
+  > EOF
+  $ for i in `python $TESTDIR/seq.py 1 100`; do
+  >   echo $i > $i
+  > done
+  $ hg ci -qAm 'add 100 files'
+
+  $ hg update null
+  0 files updated, 0 files merged, 100 files removed, 0 files unresolved
+  $ hg update
+  100 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ cd ..
+
+#endif


More information about the Mercurial-devel mailing list