changeset 30881:92bca12328d1 stable

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.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 25 Feb 2017 12:33:37 +0900
parents 7074589cf22a
children a91c62752d08
files tests/test-simple-update.t
diffstat 1 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-simple-update.t	Thu Feb 23 11:23:17 2017 -0800
+++ b/tests/test-simple-update.t	Sat Feb 25 12:33:37 2017 +0900
@@ -56,3 +56,37 @@
   [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