Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
Merge nodejs/master
Browse files Browse the repository at this point in the history
Merge 41b65b9 as of 2017-10-08.
This is an automatically created merge. For any problems please
contact @kunalspathak.
  • Loading branch information
chakrabot committed Oct 10, 2017
2 parents adbea0f + 41b65b9 commit 3e1b61e
Show file tree
Hide file tree
Showing 21 changed files with 111 additions and 63 deletions.
34 changes: 33 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ exec python "$0" "$@"
del _

import sys
from distutils.spawn import find_executable as which
if sys.version_info[0] != 2 or sys.version_info[1] not in (6, 7):
sys.stderr.write('Please use either Python 2.6 or 2.7')

from distutils.spawn import find_executable as which
python2 = which('python2') or which('python2.6') or which('python2.7')

if python2:
Expand Down Expand Up @@ -1400,6 +1400,34 @@ def configure_engine(o):
o['variables']['chakracore_use_lto'] = "false"
o['variables']['chakracore_lto_build_flags'] = [ ]

def get_bin_override():
# If the system python is not the python we are running (which should be
# python 2), then create a directory with a symlink called `python` to our
# sys.executable. This directory will be prefixed to the PATH, so that
# other tools that shell out to `python` will use the appropriate python

if os.path.realpath(which('python')) == os.path.realpath(sys.executable):
return

bin_override = os.path.abspath('out/tools/bin')
try:
os.makedirs(bin_override)
except OSError as e:
if e.errno != errno.EEXIST: raise e

python_link = os.path.join(bin_override, 'python')
try:
os.unlink(python_link)
except OSError as e:
if e.errno != errno.ENOENT: raise e
os.symlink(sys.executable, python_link)

# We need to set the environment right now so that when gyp (in run_gyp)
# shells out, it finds the right python (specifically at
# https://github.com/nodejs/node/blob/d82e107/deps/v8/gypfiles/toolchain.gypi#L43)
os.environ['PATH'] = bin_override + ':' + os.environ['PATH']

return bin_override


output = {
Expand Down Expand Up @@ -1481,6 +1509,10 @@ if options.prefix:

config = '\n'.join(map('='.join, config.iteritems())) + '\n'

bin_override = get_bin_override()
if bin_override:
config = 'export PATH:=' + bin_override + ':$(PATH)\n' + config

write('config.mk', do_not_edit + config)

gyp_args = ['--no-parallel']
Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/inspector/v8-inspector-impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -286,18 +286,22 @@ std::unique_ptr<V8StackTrace> V8InspectorImpl::captureStackTrace(

void V8InspectorImpl::asyncTaskScheduled(const StringView& taskName, void* task,
bool recurring) {
if (!task) return;
m_debugger->asyncTaskScheduled(taskName, task, recurring);
}

void V8InspectorImpl::asyncTaskCanceled(void* task) {
if (!task) return;
m_debugger->asyncTaskCanceled(task);
}

void V8InspectorImpl::asyncTaskStarted(void* task) {
if (!task) return;
m_debugger->asyncTaskStarted(task);
}

void V8InspectorImpl::asyncTaskFinished(void* task) {
if (!task) return;
m_debugger->asyncTaskFinished(task);
}

Expand Down
2 changes: 0 additions & 2 deletions doc/STYLE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
topic the document will describe (e.g., `child_process`).
* Filenames should be **lowercase**.
* Some files, such as top-level markdown files, are exceptions.
* Older files may use the `.markdown` extension. These may be ported to `.md`
at will. **Prefer `.md` for all new documents.**
* Documents should be word-wrapped at 80 characters.
* The formatting described in `.editorconfig` is preferred.
* A [plugin][] is available for some editors to automatically apply these
Expand Down
4 changes: 2 additions & 2 deletions test/inspector/test-exception.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');

common.skipIfInspectorDisabled();

const assert = require('assert');
const { NodeInstance } = require('./inspector-helper.js');
const path = require('path');

const script = path.join(common.fixturesDir, 'throws_error.js');
const script = fixtures.path('throws_error.js');

async function testBreakpointOnStart(session) {
console.log('[test]',
Expand Down
11 changes: 11 additions & 0 deletions test/parallel/test-benchmark-querystring.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';

require('../common');

const runBenchmark = require('../common/benchmark');

runBenchmark('querystring', [
'n=1',
'input="there is nothing to unescape here"',
'type=noencode'
]);
4 changes: 2 additions & 2 deletions test/parallel/test-error-reporting.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
const common = require('../common');
const assert = require('assert');
const exec = require('child_process').exec;
const path = require('path');
const fixtures = require('../common/fixtures');

function errExec(script, callback) {
const cmd = `"${process.argv[0]}" "${path.join(common.fixturesDir, script)}"`;
const cmd = `"${process.argv[0]}" "${fixtures.path(script)}"`;
return exec(cmd, function(err, stdout, stderr) {
// There was some error
assert.ok(err);
Expand Down
3 changes: 2 additions & 1 deletion test/parallel/test-fs-write-stream-encoding.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
'use strict';
const common = require('../common');
const assert = require('assert');
const fixtures = require('../common/fixtures');
const fs = require('fs');
const path = require('path');
const stream = require('stream');
const firstEncoding = 'base64';
const secondEncoding = 'latin1';

const examplePath = path.join(common.fixturesDir, 'x.txt');
const examplePath = fixtures.path('x.txt');
const dummyPath = path.join(common.tmpDir, 'x.txt');

common.refreshTmpDir();
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-http-url.parse-https.request.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const { readKey } = require('../common/fixtures');

const assert = require('assert');
const https = require('https');
const url = require('url');
const fs = require('fs');

// https options
const httpsOptions = {
key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
key: readKey('agent1-key.pem'),
cert: readKey('agent1-cert.pem')
};

function check(request) {
Expand Down
7 changes: 3 additions & 4 deletions test/parallel/test-http2-create-client-connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const fs = require('fs');
const fixtures = require('../common/fixtures');
const h2 = require('http2');
const path = require('path');
const url = require('url');
const URL = url.URL;

Expand Down Expand Up @@ -51,8 +50,8 @@ const URL = url.URL;
{

const options = {
key: fs.readFileSync(path.join(common.fixturesDir, 'keys/agent3-key.pem')),
cert: fs.readFileSync(path.join(common.fixturesDir, 'keys/agent3-cert.pem'))
key: fixtures.readKey('agent3-key.pem'),
cert: fixtures.readKey('agent3-cert.pem')
};

const server = h2.createSecureServer(options);
Expand Down
13 changes: 4 additions & 9 deletions test/parallel/test-http2-https-fallback.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
'use strict';

const common = require('../common');
const fixtures = require('../common/fixtures');

if (!common.hasCrypto)
common.skip('missing crypto');

const { strictEqual } = require('assert');
const { join } = require('path');
const { readFileSync } = require('fs');
const { createSecureContext } = require('tls');
const { createSecureServer, connect } = require('http2');
const { get } = require('https');
Expand All @@ -16,13 +15,9 @@ const { connect: tls } = require('tls');

const countdown = (count, done) => () => --count === 0 && done();

function loadKey(keyname) {
return readFileSync(join(common.fixturesDir, 'keys', keyname));
}

const key = loadKey('agent8-key.pem');
const cert = loadKey('agent8-cert.pem');
const ca = loadKey('fake-startcom-root-cert.pem');
const key = fixtures.readKey('agent8-key.pem');
const cert = fixtures.readKey('agent8-cert.pem');
const ca = fixtures.readKey('fake-startcom-root-cert.pem');

const clientOptions = { secureContext: createSecureContext({ ca }) };

Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-http2-respond-file-fd.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
'use strict';

const common = require('../common');
const fixtures = require('../common/fixtures');
if (!common.hasCrypto)
common.skip('missing crypto');
const http2 = require('http2');
const assert = require('assert');
const path = require('path');
const fs = require('fs');

const {
HTTP2_HEADER_CONTENT_TYPE,
HTTP2_HEADER_CONTENT_LENGTH
} = http2.constants;

const fname = path.resolve(common.fixturesDir, 'elipses.txt');
const fname = fixtures.path('elipses.txt');
const data = fs.readFileSync(fname);
const stat = fs.statSync(fname);
const fd = fs.openSync(fname, 'r');
Expand Down
7 changes: 3 additions & 4 deletions test/parallel/test-https-agent-create-connection.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const common = require('../common');
const fixtures = require('../common/fixtures');
if (!common.hasCrypto)
common.skip('missing crypto');

Expand All @@ -9,11 +10,9 @@ const https = require('https');

const agent = new https.Agent();

const fs = require('fs');

const options = {
key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
key: fixtures.readKey('agent1-key.pem'),
cert: fixtures.readKey('agent1-cert.pem'),
};

const expectedHeader = /^HTTP\/1\.1 200 OK/;
Expand Down
8 changes: 4 additions & 4 deletions test/parallel/test-https-agent-secure-protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ if (!common.hasCrypto)

const assert = require('assert');
const https = require('https');
const fs = require('fs');
const fixtures = require('../common/fixtures');

const options = {
key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
ca: fs.readFileSync(`${common.fixturesDir}/keys/ca1-cert.pem`)
key: fixtures.readKey('agent1-key.pem'),
cert: fixtures.readKey('agent1-cert.pem'),
ca: fixtures.readKey('ca1-cert.pem')
};

const server = https.Server(options, function(req, res) {
Expand Down
8 changes: 4 additions & 4 deletions test/parallel/test-https-agent-servername.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ if (!common.hasCrypto)
common.skip('missing crypto');

const https = require('https');
const fs = require('fs');
const fixtures = require('../common/fixtures');

const options = {
key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
ca: fs.readFileSync(`${common.fixturesDir}/keys/ca1-cert.pem`)
key: fixtures.readKey('agent1-key.pem'),
cert: fixtures.readKey('agent1-cert.pem'),
ca: fixtures.readKey('ca1-cert.pem')
};


Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-https-agent-sni.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');
if (!common.hasCrypto)
common.skip('missing crypto');

const assert = require('assert');
const https = require('https');
const fs = require('fs');

const options = {
key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`)
key: fixtures.readKey('agent1-key.pem'),
cert: fixtures.readKey('agent1-cert.pem')
};

const TOTAL = 4;
Expand Down
11 changes: 5 additions & 6 deletions test/parallel/test-https-client-checkServerIdentity.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ if (!common.hasCrypto)
common.skip('missing crypto');

const assert = require('assert');
const fixtures = require('../common/fixtures');
const https = require('https');
const fs = require('fs');
const path = require('path');

const options = {
key: fs.readFileSync(path.join(common.fixturesDir, 'keys/agent3-key.pem')),
cert: fs.readFileSync(path.join(common.fixturesDir, 'keys/agent3-cert.pem'))
key: fixtures.readKey('agent3-key.pem'),
cert: fixtures.readKey('agent3-cert.pem')
};

const server = https.createServer(options, common.mustCall(function(req, res) {
Expand All @@ -46,7 +45,7 @@ function authorized() {
const req = https.request({
port: server.address().port,
rejectUnauthorized: true,
ca: [fs.readFileSync(path.join(common.fixturesDir, 'keys/ca2-cert.pem'))]
ca: [fixtures.readKey('ca2-cert.pem')]
}, common.mustNotCall());
req.on('error', function(err) {
override();
Expand All @@ -58,7 +57,7 @@ function override() {
const options = {
port: server.address().port,
rejectUnauthorized: true,
ca: [fs.readFileSync(path.join(common.fixturesDir, 'keys/ca2-cert.pem'))],
ca: [fixtures.readKey('ca2-cert.pem')],
checkServerIdentity: function(host, cert) {
return false;
}
Expand Down
10 changes: 5 additions & 5 deletions test/parallel/test-https-client-reject.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');

const fixtures = require('../common/fixtures');

const assert = require('assert');
const https = require('https');
const fs = require('fs');
const path = require('path');

const options = {
key: fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem')),
cert: fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem'))
key: fixtures.readSync('test_key.pem'),
cert: fixtures.readSync('test_cert.pem')
};

const server = https.createServer(options, common.mustCall(function(req, res) {
Expand Down Expand Up @@ -72,7 +72,7 @@ function rejectUnauthorized() {
function authorized() {
const options = {
port: server.address().port,
ca: [fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem'))]
ca: [fixtures.readSync('test_cert.pem')]
};
options.agent = new https.Agent(options);
const req = https.request(options, function(res) {
Expand Down
Loading

0 comments on commit 3e1b61e

Please sign in to comment.