equal
deleted
inserted
replaced
89 |
89 |
90 $ hg --config "extensions.t=$abspath" --config 'worker.numcpus=2' \ |
90 $ hg --config "extensions.t=$abspath" --config 'worker.numcpus=2' \ |
91 > test 100000.0 exc 2>&1 | grep '^Traceback' |
91 > test 100000.0 exc 2>&1 | grep '^Traceback' |
92 Traceback (most recent call last): |
92 Traceback (most recent call last): |
93 |
93 |
|
94 Workers should not do cleanups in all cases |
|
95 |
|
96 $ cat > $TESTTMP/detectcleanup.py <<EOF |
|
97 > from __future__ import absolute_import |
|
98 > import atexit |
|
99 > import os |
|
100 > import time |
|
101 > oldfork = os.fork |
|
102 > count = 0 |
|
103 > parentpid = os.getpid() |
|
104 > def delayedfork(): |
|
105 > global count |
|
106 > count += 1 |
|
107 > pid = oldfork() |
|
108 > # make it easier to test SIGTERM hitting other workers when they have |
|
109 > # not set up error handling yet. |
|
110 > if count > 1 and pid == 0: |
|
111 > time.sleep(0.1) |
|
112 > return pid |
|
113 > os.fork = delayedfork |
|
114 > def cleanup(): |
|
115 > if os.getpid() != parentpid: |
|
116 > os.write(1, 'should never happen\n') |
|
117 > atexit.register(cleanup) |
|
118 > EOF |
|
119 |
|
120 $ hg --config "extensions.t=$abspath" --config worker.numcpus=8 --config \ |
|
121 > "extensions.d=$TESTTMP/detectcleanup.py" test 100000 abort |
|
122 start |
|
123 abort: known exception |
|
124 [255] |
|
125 |
94 #endif |
126 #endif |