diff options
author | Julien Gilli <julien.gilli@joyent.com> | 2014-11-07 10:18:10 -0800 |
---|---|---|
committer | Julien Gilli <julien.gilli@joyent.com> | 2015-02-05 12:35:27 -0800 |
commit | ebfa7e350aed8f61b68a290be2e8fefca9db939e (patch) | |
tree | ff298943a9137637ec0435bddba729536b4211d7 | |
parent | 4312f8d760bdf574b5a461e426331f0b4d298f18 (diff) | |
download | node-new-ebfa7e350aed8f61b68a290be2e8fefca9db939e.tar.gz |
mdb_v8: add tests for ::findjsobjects -k KIND
Reviewed-By: Dave Pacheco <dap@joyent.com>
Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
-rw-r--r-- | test/common.js | 19 | ||||
-rw-r--r-- | test/pummel/test-postmortem-details.js | 24 |
2 files changed, 43 insertions, 0 deletions
diff --git a/test/common.js b/test/common.js index 5225e34bc7..a4825daae7 100644 --- a/test/common.js +++ b/test/common.js @@ -305,3 +305,22 @@ exports.hasMultiLocalhost = function hasMultiLocalhost() { t.close(); return ret === 0; }; + +exports.getNodeVersion = function getNodeVersion() { + assert(typeof process.version === 'string'); + + var matches = process.version.match(/v(\d+).(\d+).(\d+)-?(.*)/); + assert(Array.isArray(matches)); + + var major = +matches[1]; + var minor = +matches[2]; + var patch = +matches[3]; + var pre = matches[4]; + + return { + major: major, + minor: minor, + patch: patch, + pre: pre + }; +} diff --git a/test/pummel/test-postmortem-details.js b/test/pummel/test-postmortem-details.js index fcf2c56933..912dc8f078 100644 --- a/test/pummel/test-postmortem-details.js +++ b/test/pummel/test-postmortem-details.js @@ -52,6 +52,8 @@ mybuffer = myTestFunction(bufstr); mybuffer = myTestFunction(bufstr); mybuffer.my_buffer = true; +var OBJECT_KINDS = ['dict', 'inobject', 'numeric', 'props']; +var NODE_VERSION = common.getNodeVersion(); /* * Now we're going to fork ourselves to gcore @@ -174,6 +176,24 @@ gcore.on('exit', function (code) { assert.ok(content.indexOf('function myTestFunction()\n') != -1); assert.ok(content.indexOf('return (new Buffer(bufstr));\n') != -1); }); + OBJECT_KINDS.forEach(function (kind) { + verifiers.push(function verifyFindObjectsKind(testLines) { + // There should be at least one object for + // every kind of objects (except for the special cases + // below) + var expectedMinimumObjs = 1; + + if (kind === 'props' && + (NODE_VERSION.major > 0 || NODE_VERSION.minor > 10)) { + // On versions > 0.10.x, currently there's no object + // with the kind 'props'. There should be, but it's a minor + // issue we're or to live with for now. + expectedMinimumObjs = 0; + } + + assert.ok(testLines.length >= expectedMinimumObjs); + }); + }); var mod = util.format('::load %s\n', path.join(__dirname, @@ -206,5 +226,9 @@ gcore.on('exit', function (code) { mdb.stdin.write('::jsfunctions -n myTestFunction ! ' + 'awk \'NR == 2 {print $1}\' | head -1 > ' + tmpfile + '\n'); mdb.stdin.write('::cat ' + tmpfile + ' | ::jssource -n 0\n'); + OBJECT_KINDS.forEach(function (kind) { + mdb.stdin.write(util.format('!echo test: findjsobjects -k %s\n', kind)); + mdb.stdin.write(util.format('::findjsobjects -k %s\n', kind)); + }); mdb.stdin.end(); }); |