91
92
stderr.append(process.stderr.readline())
92
93
# Now it should be ready. If there were any errors, let's check, and
94
if process.poll() is not None or 'error' in ''.join(stderr).lower():
95
# Looks like there was a problem. We cannot use addDetail because
96
# we are not on a testcase. A "print" is the best we can do. That
97
# should still be visible on buildbot, which is where we have seen
98
# spurious failures so far.
95
if (process.poll() is not None or
96
not stderr[1].strip().startswith('Listening on socket')):
97
if process.poll() is None:
98
time.sleep(1) # Give the traceback a chance to render.
99
os.kill(process.pid, signal.SIGTERM)
102
# Looks like there was a problem. We cannot use the "addDetail"
103
# method because this class is not a TestCase and does not have
104
# access to one. It runs as part of a layer. A "print" is the
105
# best we can do. That should still be visible on buildbot, which
106
# is where we have seen spurious failures so far.
101
print self.process.stdout.read()
109
print process.stdout.read()
104
112
print ''.join(stderr)
105
print self.process.stderr.read()
113
print process.stderr.read()
107
115
raise RuntimeError(
108
'Bzr server did not start. See stdout and stderr reported '
109
'above. Command was "%s". PYTHONPATH was "%s". '
116
'Bzr server did not start correctly. See stdout and stderr '
117
'reported above. Command was "%s". PYTHONPATH was "%s". '
110
118
'BZR_PLUGIN_PATH was "%s".' %
111
119
(' '.join(command),
112
120
env.get('PYTHONPATH'),