mirror of
https://github.com/hanzoai/node-dtrace-provider.git
synced 2026-09-23 23:48:45 +00:00
Update libusdt for "prevent fire after disable" bug.
Also updates tests which were actually expecting a fired probe on a disabled provider.
This commit is contained in:
+1
-1
Submodule libusdt updated: ff4eca94e8...83e85bf317
@@ -2,13 +2,12 @@ var test = require('tap').test;
|
||||
var format = require('util').format;
|
||||
var dtest = require('./dtrace-test').dtraceTest;
|
||||
|
||||
if (process.platform == 'sunos') {
|
||||
var dscript = 'testlibusdt*:::32probe{ printf("%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\\n", copyinstr((uintptr_t)args[0]), copyinstr((uintptr_t)args[1]), copyinstr((uintptr_t)args[2]), copyinstr((uintptr_t)args[3]), copyinstr((uintptr_t)args[4]), copyinstr((uintptr_t)args[5]), copyinstr((uintptr_t)args[6]), copyinstr((uintptr_t)args[7]), copyinstr((uintptr_t)args[8]), copyinstr((uintptr_t)args[9]), copyinstr((uintptr_t)args[10]), copyinstr((uintptr_t)args[11]), copyinstr((uintptr_t)args[12]), copyinstr((uintptr_t)args[13]), copyinstr((uintptr_t)args[14]), copyinstr((uintptr_t)args[15]), copyinstr((uintptr_t)args[16]), copyinstr((uintptr_t)args[17]), copyinstr((uintptr_t)args[18]), copyinstr((uintptr_t)args[19]), copyinstr((uintptr_t)args[20]), copyinstr((uintptr_t)args[21]), copyinstr((uintptr_t)args[22]), copyinstr((uintptr_t)args[23]), copyinstr((uintptr_t)args[24]), copyinstr((uintptr_t)args[25]), copyinstr((uintptr_t)args[26]), copyinstr((uintptr_t)args[27]), copyinstr((uintptr_t)args[28]), copyinstr((uintptr_t)args[29]), copyinstr((uintptr_t)args[30]), copyinstr((uintptr_t)args[31])); }';
|
||||
}
|
||||
|
||||
if (process.platform == 'darwin') {
|
||||
var dscript = 'testlibusdt*:::32probe{ printf("%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\\n", copyinstr((user_addr_t)args[0]), copyinstr((user_addr_t)args[1]), copyinstr((user_addr_t)args[2]), copyinstr((user_addr_t)args[3]), copyinstr((user_addr_t)args[4]), copyinstr((user_addr_t)args[5]), copyinstr((user_addr_t)args[6]), copyinstr((user_addr_t)args[7]), copyinstr((user_addr_t)args[8]), copyinstr((user_addr_t)args[9]), copyinstr((user_addr_t)args[10]), copyinstr((user_addr_t)args[11]), copyinstr((user_addr_t)args[12]), copyinstr((user_addr_t)args[13]), copyinstr((user_addr_t)args[14]), copyinstr((user_addr_t)args[15]), copyinstr((user_addr_t)args[16]), copyinstr((user_addr_t)args[17]), copyinstr((user_addr_t)args[18]), copyinstr((user_addr_t)args[19]), copyinstr((user_addr_t)args[20]), copyinstr((user_addr_t)args[21]), copyinstr((user_addr_t)args[22]), copyinstr((user_addr_t)args[23]), copyinstr((user_addr_t)args[24]), copyinstr((user_addr_t)args[25]), copyinstr((user_addr_t)args[26]), copyinstr((user_addr_t)args[27]), copyinstr((user_addr_t)args[28]), copyinstr((user_addr_t)args[29]), copyinstr((user_addr_t)args[30]), copyinstr((user_addr_t)args[31])); }';
|
||||
}
|
||||
else {
|
||||
var dscript = 'testlibusdt*:::32probe{ printf("%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\\n", copyinstr((uintptr_t)args[0]), copyinstr((uintptr_t)args[1]), copyinstr((uintptr_t)args[2]), copyinstr((uintptr_t)args[3]), copyinstr((uintptr_t)args[4]), copyinstr((uintptr_t)args[5]), copyinstr((uintptr_t)args[6]), copyinstr((uintptr_t)args[7]), copyinstr((uintptr_t)args[8]), copyinstr((uintptr_t)args[9]), copyinstr((uintptr_t)args[10]), copyinstr((uintptr_t)args[11]), copyinstr((uintptr_t)args[12]), copyinstr((uintptr_t)args[13]), copyinstr((uintptr_t)args[14]), copyinstr((uintptr_t)args[15]), copyinstr((uintptr_t)args[16]), copyinstr((uintptr_t)args[17]), copyinstr((uintptr_t)args[18]), copyinstr((uintptr_t)args[19]), copyinstr((uintptr_t)args[20]), copyinstr((uintptr_t)args[21]), copyinstr((uintptr_t)args[22]), copyinstr((uintptr_t)args[23]), copyinstr((uintptr_t)args[24]), copyinstr((uintptr_t)args[25]), copyinstr((uintptr_t)args[26]), copyinstr((uintptr_t)args[27]), copyinstr((uintptr_t)args[28]), copyinstr((uintptr_t)args[29]), copyinstr((uintptr_t)args[30]), copyinstr((uintptr_t)args[31])); }';
|
||||
}
|
||||
|
||||
test(
|
||||
'32-arg probe',
|
||||
|
||||
@@ -13,10 +13,14 @@ test(
|
||||
],
|
||||
function(t, exit_code, traces) {
|
||||
t.notOk(exit_code, 'dtrace exited cleanly');
|
||||
t.equal(traces.length, 10);
|
||||
t.equal(traces.length, 46);
|
||||
traces.sort(function(a, b) { return a - b });
|
||||
for (var i = 0; i < 10; i++) {
|
||||
t.equal(traces[i], [i].toString());
|
||||
t.equal(traces[0], '0');
|
||||
var x = 1;
|
||||
for (var i = 1; i < 10; i++) {
|
||||
for (var j = 0; j < i; j++) {
|
||||
t.equal(traces[x++], [i].toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -8,5 +8,7 @@ for (var i = 1; i < 10; i++) {
|
||||
dtp.addProbe("probe" + i, "int");
|
||||
dtp.disable();
|
||||
dtp.enable();
|
||||
dtp.fire("probe" + i, function(p) { return [i]; });
|
||||
for (var j = 0; j < i; j++) {
|
||||
dtp.fire("probe" + j, function(p) { return [i]; });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
var test = require('tap').test;
|
||||
var format = require('util').format;
|
||||
var dtest = require('./dtrace-test').dtraceTest;
|
||||
|
||||
test(
|
||||
'creating and destroying a provider',
|
||||
dtest(
|
||||
function() { },
|
||||
[
|
||||
'dtrace', '-Zqn',
|
||||
'nodeapp*:::{ printf("%d\\n", arg0); }',
|
||||
'-c', format('node %s/create-destroy_fire.js', __dirname)
|
||||
],
|
||||
function(t, exit_code, traces) {
|
||||
t.notOk(exit_code, 'dtrace exited cleanly');
|
||||
t.equal(traces.length, 10);
|
||||
traces.sort(function(a, b) { return a - b });
|
||||
for (var i = 0; i < 10; i++) {
|
||||
t.equal(traces[i], [i].toString());
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,12 @@
|
||||
var d = require('../dtrace-provider');
|
||||
|
||||
for (var i = 0; i < 10; i++) {
|
||||
//gc();
|
||||
var dtp = d.createDTraceProvider("nodeapp");
|
||||
dtp.addProbe("probe1", "int");
|
||||
dtp.enable();
|
||||
dtp.fire("probe1", function(p) { return [i]; });
|
||||
//dtp.disable();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,12 +13,11 @@ test(
|
||||
],
|
||||
function(t, exit_code, traces) {
|
||||
t.notOk(exit_code, 'dtrace exited cleanly');
|
||||
t.equal(traces.length, 12);
|
||||
t.equal(traces.length, 11);
|
||||
traces.sort(function(a, b) { return a - b });
|
||||
for (var i = 0; i < 10; i++) {
|
||||
t.equal(traces[i], [i].toString());
|
||||
}
|
||||
t.equal(traces[11], '42');
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user