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

Commit ebfa7e3

Browse files
author
Julien Gilli
committed
mdb_v8: add tests for ::findjsobjects -k KIND
Reviewed-By: Dave Pacheco <[email protected]> Reviewed-By: Timothy J Fontaine <[email protected]>
1 parent 4312f8d commit ebfa7e3

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

test/common.js

+19
Original file line numberDiff line numberDiff line change
@@ -305,3 +305,22 @@ exports.hasMultiLocalhost = function hasMultiLocalhost() {
305305
t.close();
306306
return ret === 0;
307307
};
308+
309+
exports.getNodeVersion = function getNodeVersion() {
310+
assert(typeof process.version === 'string');
311+
312+
var matches = process.version.match(/v(\d+).(\d+).(\d+)-?(.*)/);
313+
assert(Array.isArray(matches));
314+
315+
var major = +matches[1];
316+
var minor = +matches[2];
317+
var patch = +matches[3];
318+
var pre = matches[4];
319+
320+
return {
321+
major: major,
322+
minor: minor,
323+
patch: patch,
324+
pre: pre
325+
};
326+
}

test/pummel/test-postmortem-details.js

+24
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ mybuffer = myTestFunction(bufstr);
5252
mybuffer = myTestFunction(bufstr);
5353
mybuffer.my_buffer = true;
5454

55+
var OBJECT_KINDS = ['dict', 'inobject', 'numeric', 'props'];
56+
var NODE_VERSION = common.getNodeVersion();
5557

5658
/*
5759
* Now we're going to fork ourselves to gcore
@@ -174,6 +176,24 @@ gcore.on('exit', function (code) {
174176
assert.ok(content.indexOf('function myTestFunction()\n') != -1);
175177
assert.ok(content.indexOf('return (new Buffer(bufstr));\n') != -1);
176178
});
179+
OBJECT_KINDS.forEach(function (kind) {
180+
verifiers.push(function verifyFindObjectsKind(testLines) {
181+
// There should be at least one object for
182+
// every kind of objects (except for the special cases
183+
// below)
184+
var expectedMinimumObjs = 1;
185+
186+
if (kind === 'props' &&
187+
(NODE_VERSION.major > 0 || NODE_VERSION.minor > 10)) {
188+
// On versions > 0.10.x, currently there's no object
189+
// with the kind 'props'. There should be, but it's a minor
190+
// issue we're or to live with for now.
191+
expectedMinimumObjs = 0;
192+
}
193+
194+
assert.ok(testLines.length >= expectedMinimumObjs);
195+
});
196+
});
177197

178198
var mod = util.format('::load %s\n',
179199
path.join(__dirname,
@@ -206,5 +226,9 @@ gcore.on('exit', function (code) {
206226
mdb.stdin.write('::jsfunctions -n myTestFunction ! ' +
207227
'awk \'NR == 2 {print $1}\' | head -1 > ' + tmpfile + '\n');
208228
mdb.stdin.write('::cat ' + tmpfile + ' | ::jssource -n 0\n');
229+
OBJECT_KINDS.forEach(function (kind) {
230+
mdb.stdin.write(util.format('!echo test: findjsobjects -k %s\n', kind));
231+
mdb.stdin.write(util.format('::findjsobjects -k %s\n', kind));
232+
});
209233
mdb.stdin.end();
210234
});

0 commit comments

Comments
 (0)