Bug 1296280 (part 0b) - Make debugging node h2 server work better r?mcmanus
MozReview-Commit-ID: 6QoGiUKGTzA
--- a/testing/xpcshell/moz-http2/moz-http2.js
+++ b/testing/xpcshell/moz-http2/moz-http2.js
@@ -738,23 +738,26 @@ function handleRequest(req, res) {
res.setHeader('Connection', 'close');
}
res.writeHead(200);
res.end(content);
}
// Set up the SSL certs for our server - this server has a cert for foo.example.com
// signed by netwerk/tests/unit/CA.cert.der
-//var log_module = node_http2_root + "/test/util";
var options = {
key: fs.readFileSync(__dirname + '/http2-key.pem'),
cert: fs.readFileSync(__dirname + '/http2-cert.pem'),
- //, log: require(log_module).createLogger('server')
};
+if (process.env.HTTP2_LOG !== undefined) {
+ var log_module = node_http2_root + "/test/util";
+ options.log = require(log_module).createLogger('server')
+}
+
var server = http2.createServer(options, handleRequest);
server.on('connection', function(socket) {
socket.on('error', function() {
// Ignoring SSL socket errors, since they usually represent a connection that was tore down
// by the browser because of an untrusted certificate. And this happens at least once, when
// the first test case if done.
});
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -990,17 +990,20 @@ class XPCShellTests(object):
nodeBin = None
# We try to find the node executable in the path given to us by the user in
# the MOZ_NODE_PATH environment variable
localPath = os.getenv('MOZ_NODE_PATH', None)
if localPath and os.path.exists(localPath) and os.path.isfile(localPath):
nodeBin = localPath
- if nodeBin:
+ if os.getenv('MOZ_ASSUME_NODE_RUNNING', None):
+ self.log.info('Assuming required node servers are already running')
+ nodeMozInfo['hasNode'] = True
+ elif nodeBin:
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
@@ -1018,19 +1021,16 @@ class XPCShellTests(object):
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'))
- elif os.getenv('MOZ_ASSUME_NODE_RUNNING', None):
- self.log.info('Assuming required node servers are already running')
- nodeMozInfo['hasNode'] = True
mozinfo.update(nodeMozInfo)
def shutdownNode(self):
"""
Shut down our node process, if it exists
"""
for name, proc in self.nodeProc.iteritems():