Bug 1336776 - Part 4: trySetupNode: log error message if moz-http2.js is not found. r?nwgh
MozReview-Commit-ID: 60YxMcS2d9w
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -999,36 +999,39 @@ class XPCShellTests(object):
if not os.path.exists(nodeBin) or not os.path.isfile(nodeBin):
self.log.error('node not found at MOZ_NODE_PATH %s' % (nodeBin))
return
self.log.info('Found node at %s' % (nodeBin,))
def startServer(name, serverJs):
- if os.path.exists(serverJs):
- # OK, we found our server, let's try to get it running
- self.log.info('Found %s at %s' % (name, serverJs))
- try:
- # We pipe stdin to node because the server will exit when its
- # stdin reaches EOF
- process = Popen([nodeBin, serverJs], stdin=PIPE, stdout=PIPE,
- stderr=PIPE, env=self.env, cwd=os.getcwd())
- self.nodeProc[name] = process
+ if not os.path.exists(serverJs):
+ self.log.error('%s not found at %s' % (name, serverJs))
+ return
- # Check to make sure the server starts properly by waiting for it to
- # tell us it's started
- msg = process.stdout.readline()
- if 'server listening' in msg:
- searchObj = re.search( r'HTTP2 server listening on port (.*)', msg, 0)
- if searchObj:
- self.env["MOZHTTP2_PORT"] = searchObj.group(1)
- except OSError, e:
- # This occurs if the subprocess couldn't be started
- self.log.error('Could not run %s server: %s' % (name, str(e)))
+ # OK, we found our server, let's try to get it running
+ self.log.info('Found %s at %s' % (name, serverJs))
+ try:
+ # We pipe stdin to node because the server will exit when its
+ # stdin reaches EOF
+ process = Popen([nodeBin, serverJs], stdin=PIPE, stdout=PIPE,
+ stderr=PIPE, env=self.env, cwd=os.getcwd())
+ self.nodeProc[name] = process
+
+ # Check to make sure the server starts properly by waiting for it to
+ # tell us it's started
+ msg = process.stdout.readline()
+ if 'server listening' in msg:
+ searchObj = re.search( r'HTTP2 server listening on port (.*)', msg, 0)
+ if searchObj:
+ self.env["MOZHTTP2_PORT"] = searchObj.group(1)
+ except OSError, e:
+ # This occurs if the subprocess couldn't be started
+ self.log.error('Could not run %s server: %s' % (name, str(e)))
myDir = os.path.split(os.path.abspath(__file__))[0]
startServer('moz-http2', os.path.join(myDir, 'moz-http2', 'moz-http2.js'))
def shutdownNode(self):
"""
Shut down our node process, if it exists
"""