diff options
author | Rich Trott <rtrott@gmail.com> | 2019-03-22 14:51:19 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-03-24 14:59:14 -0700 |
commit | 4ba33c90c6c50f625e071301f1ad4ba256d28246 (patch) | |
tree | 294de74c3290f1a3eb3f702ccb61bff40ce1d2a1 /test/pummel | |
parent | 26f8af9feba624c418be1ec270c8de30bf6ee512 (diff) | |
download | node-new-4ba33c90c6c50f625e071301f1ad4ba256d28246.tar.gz |
test: delete pummel/test-dtrace-jsstack
The test pummel/test-dtrace-jsstack is broken and probably has been for
a very long time. Remove it.
It gets skipped on anything that is non-SunOS. In our CI, that means
skipped everywhere but SmartOS.
When run on SmartOS in our CI (which never happens because it's in
pummel, but I moved it into sequential to test it), it fails because it
needs elevated privileges.
When I log into the SmartOS machine and run the test as root, it fails
with:
AssertionError [ERR_ASSERTION]: did not find expected frame stalloogle
Since I have dtrace installed on my macOS machine, I tried running it
locally but removing the SunOS check. It failed because the test leaks a
global variable. I removed the global leak check, and the test failed
because I have System Integrity Protection enabled.
In short, the test does not work in its current form, has almost
certainly not worked in a long time, and is very likely to be brittle if
we ever do fix it. I'm inclined to remove it.
PR-URL: https://github.com/nodejs/node/pull/26869
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'test/pummel')
-rw-r--r-- | test/pummel/test-dtrace-jsstack.js | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/test/pummel/test-dtrace-jsstack.js b/test/pummel/test-dtrace-jsstack.js deleted file mode 100644 index dc70354ee8..0000000000 --- a/test/pummel/test-dtrace-jsstack.js +++ /dev/null @@ -1,102 +0,0 @@ -// 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. - -'use strict'; -const common = require('../common'); -if (!common.isSunOS) - common.skip('no DTRACE support'); - -const assert = require('assert'); -const os = require('os'); - -/* - * Some functions to create a recognizable stack. - */ -const frames = [ 'stalloogle', 'bagnoogle', 'doogle' ]; - -const stalloogle = (str) => { - global.expected = str; - os.loadavg(); -}; - -const bagnoogle = (arg0, arg1) => { - stalloogle(`${arg0} is ${arg1} except that it is read-only`); -}; - -let done = false; - -const doogle = () => { - if (!done) - setTimeout(doogle, 10); - - bagnoogle('The bfs command', '(almost) like ed(1)'); -}; - -const spawn = require('child_process').spawn; - -/* - * We're going to use DTrace to stop us, gcore us, and set us running again - * when we call getloadavg() -- with the implicit assumption that our - * deepest function is the only caller of os.loadavg(). - */ -const dtrace = spawn('dtrace', [ '-qwn', `syscall::getloadavg:entry/pid == ${ - process.pid}/{ustack(100, 8192); exit(0); }` ]); - -let output = ''; - -dtrace.stderr.on('data', function(data) { - console.log(`dtrace: ${data}`); -}); - -dtrace.stdout.on('data', function(data) { - output += data; -}); - -dtrace.on('exit', function(code) { - if (code !== 0) { - console.error(`dtrace exited with code ${code}`); - process.exit(code); - } - - done = true; - - const sentinel = '(anon) as '; - const lines = output.split('\n'); - - for (let i = 0; i < lines.length; i++) { - const line = lines[i]; - - if (!line.includes(sentinel) || frames.length === 0) - continue; - - const frame = line.substr(line.indexOf(sentinel) + sentinel.length); - const top = frames.shift(); - - assert(frame.startsWith(top), - `unexpected frame where ${top} was expected`); - } - - assert.strictEqual(frames.length, 0, - `did not find expected frame ${frames[0]}`); - process.exit(0); -}); - -setTimeout(doogle, 10); |