Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/v0.10'
Browse files Browse the repository at this point in the history
Conflicts:
	configure
	lib/_stream_readable.js
	lib/http.js
	src/node_dtrace.cc
  • Loading branch information
indutny committed Mar 2, 2014
2 parents 34bf6e4 + 47abdd9 commit 78d245f
Show file tree
Hide file tree
Showing 12 changed files with 139 additions and 22 deletions.
8 changes: 5 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -464,13 +464,15 @@ def configure_node(o):
if not is_clang and cc_version < (4,0,0):
o['variables']['visibility'] = ''

if flavor in ('solaris', 'mac', 'linux'):
if flavor in ('solaris', 'mac', 'linux', 'freebsd'):
use_dtrace = not options.without_dtrace
# Don't enable by default on linux, it needs the sdt-devel package.
# Don't enable by default on linux and freebsd
if flavor in ('linux', 'freebsd'):
use_dtrace = options.with_dtrace

if flavor == 'linux':
if options.systemtap_includes:
o['include_dirs'] += [options.systemtap_includes]
use_dtrace = options.with_dtrace
o['variables']['node_use_dtrace'] = b(use_dtrace)
o['variables']['uv_use_dtrace'] = b(use_dtrace)
o['variables']['uv_parent_path'] = '/deps/uv/'
Expand Down
4 changes: 2 additions & 2 deletions doc/api/assert.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Tests strict non-equality, as determined by the strict not equal operator ( `!==

## assert.throws(block, [error], [message])

Expects `block` to throw an error. `error` can be constructor, regexp or
Expects `block` to throw an error. `error` can be constructor, `RegExp` or
validation function.

Validate instanceof using constructor:
Expand Down Expand Up @@ -76,7 +76,7 @@ Custom error validation:

## assert.doesNotThrow(block, [message])

Expects `block` not to throw an error, see assert.throws for details.
Expects `block` not to throw an error, see `assert.throws` for details.

## assert.ifError(value)

Expand Down
6 changes: 3 additions & 3 deletions lib/_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function ClientRequest(options, cb) {
var defaultAgent = options._defaultAgent || Agent.globalAgent;
if (agent === false) {
agent = new defaultAgent.constructor();
} else if (util.isNullOrUndefined(agent)) {
} else if (util.isNullOrUndefined(agent) && !options.createConnection) {
agent = defaultAgent;
}
self.agent = agent;
Expand All @@ -70,9 +70,9 @@ function ClientRequest(options, cb) {
throw new Error('Protocol:' + options.protocol + ' not supported.');
}

var defaultPort = options.defaultPort || self.agent.defaultPort;
var defaultPort = options.defaultPort || self.agent && self.agent.defaultPort;

var port = options.port = options.port || defaultPort;
var port = options.port = options.port || defaultPort || 80;
var host = options.host = options.hostname || options.host || 'localhost';

if (util.isUndefined(options.setHost)) {
Expand Down
3 changes: 1 addition & 2 deletions lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,7 @@ function chunkInvalid(state, chunk) {
if (!util.isBuffer(chunk) &&
!util.isString(chunk) &&
!util.isNullOrUndefined(chunk) &&
!state.objectMode &&
!er) {
!state.objectMode) {
er = new TypeError('Invalid non-string/buffer chunk');
}
return er;
Expand Down
3 changes: 3 additions & 0 deletions lib/_tls_wrap.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Copyright Joyent, Inc. and other Node contributors.
//
// // Emit `beforeExit` if the loop became alive either after emitting
// event, or after running some callbacks.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
Expand Down
9 changes: 5 additions & 4 deletions lib/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,11 @@ function objEquiv(a, b) {
if (a.prototype !== b.prototype) return false;
//~~~I've managed to break Object.keys through screwy arguments passing.
// Converting to array solves the problem.
if (isArguments(a)) {
if (!isArguments(b)) {
return false;
}
var aIsArgs = isArguments(a),
bIsArgs = isArguments(b);
if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
return false;
if (aIsArgs) {
a = pSlice.call(a);
b = pSlice.call(b);
return _deepEqual(a, b);
Expand Down
34 changes: 32 additions & 2 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,12 @@
}],
[ 'node_use_dtrace=="true"', {
'defines': [ 'HAVE_DTRACE=1' ],
'dependencies': [ 'node_dtrace_header' ],
'dependencies': [
'node_dtrace_header',
'specialize_node_d',
],
'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],

#
# DTrace is supported on linux, solaris, mac, and bsd. There are
# three object files associated with DTrace support, but they're
Expand Down Expand Up @@ -544,10 +548,36 @@
]
} ],
]
}
},
]
} ],
]
},
{
'target_name': 'specialize_node_d',
'type': 'none',
'conditions': [
[ 'node_use_dtrace=="true"', {
'actions': [
{
'action_name': 'specialize_node_d',
'inputs': [
'src/node.d'
],
'outputs': [
'<(PRODUCT_DIR)/node.d',
],
'action': [
'tools/specialize_node_d.py',
'<@(_outputs)',
'<@(_inputs)',
'<@(OS)',
'<@(target_arch)',
],
},
],
} ],
]
}
] # end targets
}
4 changes: 2 additions & 2 deletions src/node_dtrace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ void DTRACE_HTTP_CLIENT_RESPONSE(const FunctionCallbackInfo<Value>& args) {
}


static int dtrace_gc_start(GCType type, GCCallbackFlags flags) {
int dtrace_gc_start(GCType type, GCCallbackFlags flags) {
NODE_GC_START(type, flags);
/*
* We avoid the tail-call elimination of the USDT probe (which screws up
Expand All @@ -297,7 +297,7 @@ static int dtrace_gc_start(GCType type, GCCallbackFlags flags) {
}


static int dtrace_gc_done(GCType type, GCCallbackFlags flags) {
int dtrace_gc_done(GCType type, GCCallbackFlags flags) {
NODE_GC_DONE(type, flags);
return 0;
}
Expand Down
5 changes: 5 additions & 0 deletions test/simple/test-assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ try {
gotError = true;
}

// GH-7178. Ensure reflexivity of deepEqual with `arguments` objects.
var args = (function() { return arguments; })();
a.throws(makeBlock(a.deepEqual, [], args));
a.throws(makeBlock(a.deepEqual, args, []));

console.log('All OK');
assert.ok(gotError);

Expand Down
47 changes: 47 additions & 0 deletions test/simple/test-http-createConnection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

var common = require('../common');
var assert = require('assert');
var http = require('http');
var net = require('net');

var create = 0;
var response = 0;
process.on('exit', function() {
assert.equal(1, create, 'createConnection() http option was not called');
assert.equal(1, response, 'http server "request" callback was not called');
});

var server = http.createServer(function(req, res) {
res.end();
response++;
}).listen(common.PORT, '127.0.0.1', function() {
http.get({ createConnection: createConnection }, function (res) {
res.resume();
server.close();
});
});

function createConnection() {
create++;
return net.createConnection(common.PORT, '127.0.0.1');
}
6 changes: 2 additions & 4 deletions tools/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,8 @@ def subdir_files(path, dest, action):
def files(action):
action(['out/Release/node'], 'bin/node')

# install unconditionally, checking if the platform supports dtrace doesn't
# work when cross-compiling and besides, there's at least one linux flavor
# with dtrace support now (oracle's "unbreakable" linux)
action(['src/node.d'], 'lib/dtrace/')
if 'true' == variables.get('node_use_dtrace'):
action(['out/Release/node.d'], 'lib/dtrace/node.d')

# behave similarly for systemtap
action(['src/node.stp'], 'share/systemtap/tapset/')
Expand Down
32 changes: 32 additions & 0 deletions tools/specialize_node_d.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python

#
# specialize_node_d.py output_file src/node.d flavor arch
#
# Specialize node.d for given flavor (`freebsd`) and arch (`x64` or `ia32`)
#

import re
import subprocess
import sys
import errno

if len(sys.argv) != 5:
print "usage: specialize_node_d.py outfile src/node.d flavor arch"
sys.exit(2);

outfile = file(sys.argv[1], 'w');
infile = file(sys.argv[2], 'r');
flavor = sys.argv[3];
arch = sys.argv[4];

model = r'curpsinfo->pr_dmodel == PR_MODEL_ILP32'

for line in infile:
if flavor == 'freebsd':
line = re.sub('procfs.d', 'psinfo.d', line);
if arch == 'x64':
line = re.sub(model, '0', line);
else:
line = re.sub(model, '1', line);
outfile.write(line);

0 comments on commit 78d245f

Please sign in to comment.