Browse Source

test: remove obsolete debugger tests

The tests in `test/debugger` all fail since the removal of the
pre-inspector debugger (if they weren't already failing). They do not
run in CI (probably because they were never reliable). Remove them and
associated fixtures.

PR-URL: https://github.com/nodejs/node/pull/15139
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
canary-base
Rich Trott 7 years ago
committed by Ruben Bridgewater
parent
commit
d38e643409
No known key found for this signature in database GPG Key ID: F07496B3EB3C1762
  1. 3
      Makefile
  2. 6
      doc/api/debugger.md
  3. 1
      test/README.md
  4. 150
      test/debugger/helper-debugger-repl.js
  5. 82
      test/debugger/test-debugger-repl-break-in-module.js
  6. 42
      test/debugger/test-debugger-repl-restart.js
  7. 65
      test/debugger/test-debugger-repl-term.js
  8. 27
      test/debugger/test-debugger-repl-utf8.js
  9. 102
      test/debugger/test-debugger-repl.js
  10. 6
      test/debugger/testcfg.py
  11. 4
      test/fixtures/break-in-module/main.js
  12. 24
      test/fixtures/break-in-module/mod.js
  13. 23
      test/fixtures/breakpoints.js
  14. 23
      test/fixtures/breakpoints_utf8.js

3
Makefile

@ -386,9 +386,6 @@ test-pummel: all
test-internet: all
$(PYTHON) tools/test.py internet
test-debugger: all
$(PYTHON) tools/test.py debugger
test-inspector: all
$(PYTHON) tools/test.py inspector

6
doc/api/debugger.md

@ -125,18 +125,18 @@ It is also possible to set a breakpoint in a file (module) that
is not loaded yet:
```txt
$ node inspect test/fixtures/break-in-module/main.js
$ node inspect main.js
< Debugger listening on ws://127.0.0.1:9229/4e3db158-9791-4274-8909-914f7facf3bd
< For help see https://nodejs.org/en/docs/inspector
< Debugger attached.
Break on start in test/fixtures/break-in-module/main.js:1
Break on start in main.js:1
> 1 (function (exports, require, module, __filename, __dirname) { const mod = require('./mod.js');
2 mod.hello();
3 mod.hello();
debug> setBreakpoint('mod.js', 22)
Warning: script 'mod.js' was not loaded yet.
debug> c
break in test/fixtures/break-in-module/mod.js:22
break in mod.js:22
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
>22 exports.hello = function() {

1
test/README.md

@ -16,7 +16,6 @@ On how to run tests in this directory, see
|addons |Yes |Tests for [addon](https://nodejs.org/api/addons.html) functionality along with some tests that require an addon to function properly.|
|cctest |Yes |C++ test that is run as part of the build process.|
|common | |Common modules shared among many tests. [Documentation](./common/README.md)|
|debugger |No |Tests for [debugger](https://nodejs.org/api/debugger.html) functionality along with some tests that require an addon to function properly.|
|fixtures | |Test fixtures used in various tests throughout the test suite.|
|gc |No |Tests for garbage collection related functionality.|
|inspector |Yes |Tests for the V8 inspector integration.|

150
test/debugger/helper-debugger-repl.js

@ -1,150 +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');
const assert = require('assert');
const spawn = require('child_process').spawn;
process.env.NODE_DEBUGGER_TIMEOUT = 2000;
const port = common.PORT;
let child;
let buffer = '';
const expected = [];
let quit;
function startDebugger(scriptToDebug) {
scriptToDebug = process.env.NODE_DEBUGGER_TEST_SCRIPT ||
`${common.fixturesDir}/${scriptToDebug}`;
child = spawn(process.execPath, ['debug', `--port=${port}`, scriptToDebug]);
console.error('./node', 'debug', `--port=${port}`, scriptToDebug);
child.stdout.setEncoding('utf-8');
child.stdout.on('data', function(data) {
data = (buffer + data).split('\n');
buffer = data.pop();
data.forEach(function(line) {
child.emit('line', line);
});
});
child.stderr.pipe(process.stderr);
child.on('line', function(line) {
line = line.replace(/^(?:debug> *)+/, '');
console.log(line);
assert.ok(expected.length > 0, `Got unexpected line: ${line}`);
const expectedLine = expected[0].lines.shift();
assert.ok(expectedLine.test(line), `${line} != ${expectedLine}`);
if (expected[0].lines.length === 0) {
const callback = expected[0].callback;
expected.shift();
callback && callback();
}
});
let childClosed = false;
child.on('close', function(code) {
assert(!code);
childClosed = true;
});
let quitCalled = false;
quit = function() {
if (quitCalled || childClosed) return;
quitCalled = true;
child.stdin.write('quit');
child.kill('SIGTERM');
};
setTimeout(function() {
console.error('dying badly buffer=%j', buffer);
let err = 'Timeout';
if (expected.length > 0 && expected[0].lines) {
err = `${err}. Expected: ${expected[0].lines.shift()}`;
}
child.on('close', function() {
console.error('child is closed');
throw new Error(err);
});
quit();
}, 10000).unref();
process.once('uncaughtException', function(e) {
console.error('UncaughtException', e, e.stack);
quit();
console.error(e.toString());
process.exit(1);
});
process.on('exit', function(code) {
console.error('process exit', code);
quit();
if (code === 0)
assert(childClosed);
});
}
function addTest(input, output) {
function next() {
if (expected.length > 0) {
console.log(`debug> ${expected[0].input}`);
child.stdin.write(`${expected[0].input}\n`);
if (!expected[0].lines) {
const callback = expected[0].callback;
expected.shift();
callback && callback();
}
} else {
quit();
}
}
expected.push({ input: input, lines: output, callback: next });
}
const handshakeLines = [
/listening on /,
/connecting.* ok/
];
const initialBreakLines = [
/break in .*:1/,
/1/, /2/, /3/
];
const initialLines = handshakeLines.concat(initialBreakLines);
// Process initial lines
addTest(null, initialLines);
exports.startDebugger = startDebugger;
exports.addTest = addTest;
exports.initialLines = initialLines;
exports.handshakeLines = handshakeLines;
exports.initialBreakLines = initialBreakLines;

82
test/debugger/test-debugger-repl-break-in-module.js

@ -1,82 +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';
require('../common');
const repl = require('./helper-debugger-repl.js');
repl.startDebugger('break-in-module/main.js');
// -- SET BREAKPOINT --
// Set breakpoint by file name + line number where the file is not loaded yet
repl.addTest('sb("mod.js", 2)', [
/Warning: script 'mod\.js' was not loaded yet\./,
/1/, /2/, /3/, /4/, /5/, /6/
]);
// Check escaping of regex characters
repl.addTest('sb(")^$*+?}{|][(.js\\\\", 1)', [
/Warning: script '[^']+' was not loaded yet\./,
/1/, /2/, /3/, /4/, /5/, /6/
]);
// continue - the breakpoint should be triggered
repl.addTest('c', [
/break in .*[\\/]mod\.js:2/,
/1/, /2/, /3/, /4/
]);
// -- RESTORE BREAKPOINT ON RESTART --
// Restart the application - breakpoint should be restored
repl.addTest('restart', [].concat(
[
/terminated/
],
repl.handshakeLines,
[
/Restoring breakpoint mod\.js:2/,
/Warning: script 'mod\.js' was not loaded yet\./,
/Restoring breakpoint \).*:\d+/,
/Warning: script '\)[^']*' was not loaded yet\./
],
repl.initialBreakLines));
// continue - the breakpoint should be triggered
repl.addTest('c', [
/break in .*[\\/]mod\.js:2/,
/1/, /2/, /3/, /4/
]);
// -- CLEAR BREAKPOINT SET IN MODULE TO BE LOADED --
repl.addTest('cb("mod.js", 2)', [
/1/, /2/, /3/, /4/, /5/
]);
repl.addTest('c', [
/break in .*[\\/]main\.js:4/,
/2/, /3/, /4/, /5/, /6/
]);
// -- (END) --
repl.addTest('quit', []);

42
test/debugger/test-debugger-repl-restart.js

@ -1,42 +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';
require('../common');
const repl = require('./helper-debugger-repl.js');
repl.startDebugger('breakpoints.js');
const linesWithBreakpoint = [
/1/, /2/, /3/, /4/, /5/, /\* 6/
];
// We slice here, because addTest will change the given array.
repl.addTest('sb(6)', linesWithBreakpoint.slice());
const initialLines = repl.initialLines.slice();
initialLines.splice(2, 0, /Restoring/, /Warning/);
// Restart the debugged script
repl.addTest('restart', [
/terminated/,
].concat(initialLines));
repl.addTest('list(5)', linesWithBreakpoint);
repl.addTest('quit', []);

65
test/debugger/test-debugger-repl-term.js

@ -1,65 +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';
require('../common');
process.env.NODE_FORCE_READLINE = 1;
const repl = require('./helper-debugger-repl.js');
repl.startDebugger('breakpoints.js');
const addTest = repl.addTest;
// next
addTest('n', [
/debug>.*n/,
/break in .*:11/,
/9/, /10/, /11/, /12/, /13/
]);
// should repeat next
addTest('', [
/debug>/,
/break in .*:5/,
/3/, /4/, /5/, /6/, /7/,
]);
// continue
addTest('c', [
/debug>.*c/,
/break in .*:12/,
/10/, /11/, /12/, /13/, /14/
]);
// should repeat continue
addTest('', [
/debug>/,
/break in .*:5/,
/3/, /4/, /5/, /6/, /7/,
]);
// should repeat continue
addTest('', [
/debug>/,
/break in .*:23/,
/21/, /22/, /23/, /24/, /25/,
]);

27
test/debugger/test-debugger-repl-utf8.js

@ -1,27 +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');
const script = `${common.fixturesDir}/breakpoints_utf8.js`;
process.env.NODE_DEBUGGER_TEST_SCRIPT = script;
require('./test-debugger-repl.js');

102
test/debugger/test-debugger-repl.js

@ -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');
const repl = require('./helper-debugger-repl.js');
repl.startDebugger('breakpoints.js');
const addTest = repl.addTest;
// Next
addTest('n', [
/break in .*:11/,
/9/, /10/, /11/, /12/, /13/
]);
// Watch
addTest('watch("\'x\'")');
// Continue
addTest('c', [
/break in .*:5/,
/Watchers/,
/0:\s+'x' = "x"/,
/()/,
/3/, /4/, /5/, /6/, /7/
]);
// Show watchers
addTest('watchers', [
/0:\s+'x' = "x"/
]);
// Unwatch
addTest('unwatch("\'x\'")');
// Step out
addTest('o', [
/break in .*:12/,
/10/, /11/, /12/, /13/, /14/
]);
// Continue
addTest('c', [
/break in .*:5/,
/3/, /4/, /5/, /6/, /7/
]);
// Set breakpoint by function name
addTest('sb("setInterval()", "!(setInterval.flag++)")', [
/1/, /2/, /3/, /4/, /5/, /6/, /7/, /8/, /9/, /10/
]);
// Continue
addTest('c', [
/break in timers\.js:\d+/,
/\d/, /\d/, /\d/, /\d/, /\d/
]);
// Execute
addTest('exec process.title', [
common.isFreeBSD || common.isOSX || common.isLinux ? /node/ : ''
]);
// Execute
addTest('exec exec process.title', [
/SyntaxError: Unexpected identifier/
]);
// REPL and process.env regression
addTest('repl', [
/Ctrl/
]);
addTest('for (var i in process.env) delete process.env[i]', []);
addTest('process.env', [
/\{\}/
]);
addTest('arr = [{foo: "bar"}]', [
/\[ \{ foo: 'bar' \} \]/
]);

6
test/debugger/testcfg.py

@ -1,6 +0,0 @@
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import testpy
def GetConfiguration(context, root):
return testpy.SimpleTestConfiguration(context, root, 'debugger')

4
test/fixtures/break-in-module/main.js

@ -1,4 +0,0 @@
const mod = require('./mod.js');
mod.hello();
mod.hello();
debugger;

24
test/fixtures/break-in-module/mod.js

@ -1,24 +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.
exports.hello = function() {
return 'hello from module';
};

23
test/fixtures/breakpoints.js

@ -1,23 +0,0 @@
debugger;
function a(x) {
var i = 10;
while (--i != 0);
debugger;
return i;
}
function b() {
return ['hello', 'world'].join(' ');
}
a();
debugger;
a(1);
b();
b();
setInterval(function() {
}, 5000);
now = new Date();
debugger;

23
test/fixtures/breakpoints_utf8.js

@ -1,23 +0,0 @@
debugger;
function a(x) {
var i = 10;
while (--i != 0);
debugger;
return i;
}
function b() {
return ['こんにち', 'わ'].join(' ');
}
a();
a(1);
b();
b();
setInterval(function() {
}, 5000);
now = new Date();
debugger;
Loading…
Cancel
Save