Rev 4178: Cosmetic changes. in file:///home/vila/src/bzr/experimental/parallel-selftest/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Sun Mar 22 17:40:34 GMT 2009
At file:///home/vila/src/bzr/experimental/parallel-selftest/
------------------------------------------------------------
revno: 4178
revision-id: v.ladeuil+lp at free.fr-20090322174033-hmbyijy5jbt93nlu
parent: v.ladeuil+lp at free.fr-20090321181648-f5xlxmcwrcrrt3wc
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: make-it-work
timestamp: Sun 2009-03-22 18:40:33 +0100
message:
Cosmetic changes.
* bzrlib/tests/__init__.py:
(fork_for_tests): Give semantic names to pipes. Use the same
buffering scheme for both sides of the feedback pipe.
-------------- next part --------------
=== modified file 'BRANCH.TODO'
--- a/BRANCH.TODO 2009-03-19 17:43:37 +0000
+++ b/BRANCH.TODO 2009-03-22 17:40:33 +0000
@@ -3,10 +3,6 @@
#
#
-- fix 'bzr server' handing around (probably in test_serve)
-- rename c2pread, c2pwrite to control/feedback
-- print pid for debug
-
- better desrialization for UnavailableFeature and KnownFailure
on the assumption that both can be built from a string only and
- that the backtrace is only used in a stringified way.
\ No newline at end of file
+ that the backtrace is only used in a stringified way.
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2009-03-21 18:15:59 +0000
+++ b/bzrlib/tests/__init__.py 2009-03-22 17:40:33 +0000
@@ -2672,7 +2672,9 @@
suite = TestUtil.TestSuite(suites)
else:
suite = order_changer(filter_suite_by_re(suite, pattern))
+ # FIXME: All the above is about creating/filtering/shuffling the test list
+ # FIXME: we should create specific runner classes below
strategy = os.environ.get('BZR_PARALLEL', '')
# Need options.
if strategy == 'forked':
@@ -2683,7 +2685,7 @@
concurrency = local_concurrency()
if concurrency > 1:
suite = ConcurrentTestSuite(suite, concurrency, reinvoke_for_tests)
- # FIXME: All the above is about creating/filtering/shuffling the test list
+ # FIXME: we should create specific runner classes above
if runner_class is None:
runner_class = TextTestRunner
@@ -2741,26 +2743,31 @@
for process_tests in test_blocks:
process_suite = TestSuite()
process_suite.addTests(process_tests)
- c2pread, c2pwrite = os.pipe()
+ pipe_read, pipe_write = os.pipe()
pid = os.fork()
if pid == 0:
try:
- os.close(c2pread)
+ control, feedback = pipe_read, pipe_write
+ os.close(control)
# Leave stderr and stdout open so we can see test noise
# Close stdin so that the child goes away if it decides to
# read from stdin (otherwise its a roulette to see what
# child actually gets keystrokes for pdb etc.
sys.stdin.close()
sys.stdin = None
- stream = os.fdopen(c2pwrite, 'wb', 0)
- subunit_result = TestProtocolClient(stream)
+ feedback = os.fdopen(feedback, 'wb', 1)
+ subunit_result = TestProtocolClient(feedback)
+ # Run the test suite slice into the child process
process_suite.run(subunit_result)
finally:
os._exit(0)
else:
- os.close(c2pwrite)
- stream = os.fdopen(c2pread, 'rb', 1)
- test = TestInOtherProcess(stream, pid)
+ feedback, control = pipe_read, pipe_write
+ os.close(control)
+ feedback = os.fdopen(feedback, 'rb', 1)
+ # Add the test that will process the test results from the child
+ # into the test suite handled by the parent.
+ test = TestInOtherProcess(feedback, pid)
result.append(test)
return result
@@ -2880,11 +2887,9 @@
del threads[finished_test]
def _run_test(self, test, process_result, queue):
-# print '[%d] start' % pid
try:
test.run(process_result)
finally:
-# print '[%d] done' % pid
queue.put(test)
More information about the bazaar-commits
mailing list