Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger - Filter out the ending of the Module wrapper when using the list command #9773

Conversation

@lholmquist
Copy link
Contributor

lholmquist commented Nov 23, 2016

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

Debbuger

Description of change

PR for #9768.

When inside the debugger, doing a list(10) on a file with only say 5 lines, would print the end of the module wrapper on the last line.

There is code currently to make sure that the first part of the Module wrapper is filtered out. that is located here: https://github.com/nodejs/node/blob/master/lib/_debugger.js#L1107

The code added filters out the very last line of the lines array, which is the ending of the module wrapper.

I did not add a test for this. I don't believe there was one that tests List anyways. If there needs to be one, i will try and look at the other debugger tests as an example

@cjihrig
Copy link
Contributor

cjihrig commented Nov 23, 2016

Could you provide a test case please.

@lholmquist
Copy link
Contributor Author

lholmquist commented Nov 23, 2016

sure

@lholmquist lholmquist force-pushed the lholmquist:debugger-outputs-module-wrapper-ending-#9768 branch Nov 28, 2016
@lholmquist lholmquist force-pushed the lholmquist:debugger-outputs-module-wrapper-ending-#9768 branch Nov 28, 2016
@lholmquist
Copy link
Contributor Author

lholmquist commented Nov 28, 2016

@cjihrig Sorry for the delay(Thanksgiving Holiday), I've added a test case here

@lholmquist lholmquist force-pushed the lholmquist:debugger-outputs-module-wrapper-ending-#9768 branch 3 times, most recently Nov 29, 2016
@lholmquist
Copy link
Contributor Author

lholmquist commented Dec 5, 2016

and rebased

test/parallel/test-debugger-list-no-module-wrapper.js Outdated
const proc = spawn(process.execPath, args, { stdio: 'pipe' });
proc.stdout.setEncoding('utf8');

var stdout = '';

This comment has been minimized.

@cjihrig

cjihrig Dec 5, 2016 Contributor

This can be let.

test/parallel/test-debugger-list-no-module-wrapper.js Outdated

var stdout = '';

var sentCommand = false;

This comment has been minimized.

@cjihrig

cjihrig Dec 5, 2016 Contributor

As can these.

test/parallel/test-debugger-list-no-module-wrapper.js Outdated
proc.stdout.on('data', (data) => {
stdout += data;
if (!sentCommand && stdout.includes('> 1')) {
return sentCommand = true;

This comment has been minimized.

@cjihrig

cjihrig Dec 5, 2016 Contributor

Can you split this into two separate lines. Same for the other similar lines below.

test/parallel/test-debugger-list-no-module-wrapper.js Outdated
return sentEmpty = true;
}
if (!sentExit && sentCommand && sentEmpty) {
setTimeout(() => {proc.stdin.write('\n\n\n.exit\n\n\n');}, 1);

This comment has been minimized.

@cjihrig

cjihrig Dec 5, 2016 Contributor

Why use setImmediate() above and setTimeout() here?

This comment has been minimized.

@lholmquist

lholmquist Dec 5, 2016 Author Contributor

i copied and pasted from another test, so to be honest, thats what happened. is there a preferences for me to switch too

This comment has been minimized.

@cjihrig

cjihrig Dec 5, 2016 Contributor

If it works with setImmediate(), or plain synchronous code, that should be preferred over setTimeout().

test/parallel/test-debugger-list-no-module-wrapper.js Outdated
false,
'the last line of the debugger should not have the module wrapping ending'
);
console.log(stdout);

This comment has been minimized.

@cjihrig

cjihrig Dec 5, 2016 Contributor

Can you remove this.

@lholmquist lholmquist force-pushed the lholmquist:debugger-outputs-module-wrapper-ending-#9768 branch Dec 5, 2016
@lholmquist
Copy link
Contributor Author

lholmquist commented Dec 5, 2016

@cjihrig ok, i think i got all the changes, and i also rebased against master too

@lholmquist lholmquist force-pushed the lholmquist:debugger-outputs-module-wrapper-ending-#9768 branch 2 times, most recently Dec 6, 2016
@lholmquist
Copy link
Contributor Author

lholmquist commented Dec 8, 2016

rebased again

Copy link
Contributor

cjihrig left a comment

In general, it would be nice if we could reuse the test/debugger/helper-debugger-repl.js file. I'm not sure how feasible it is or not though. Thoughts @nodejs/testing?

test/parallel/test-debugger-list-no-module-wrapper.js Outdated
process.on('exit', (exitCode) => {
assert.strictEqual(exitCode, 0);
// No module wrapping at the first line
assert.equal(

This comment has been minimized.

@cjihrig

cjihrig Dec 8, 2016 Contributor

Can you make this strictEqual()

test/parallel/test-debugger-list-no-module-wrapper.js Outdated
'debugger should not have the module wrapper'
);
// No module wrapping at the end
assert.equal(

This comment has been minimized.

@cjihrig

cjihrig Dec 8, 2016 Contributor

strictEqual() again please.

test/parallel/test-debugger-list-no-module-wrapper.js Outdated
}
});

process.on('exit', (exitCode) => {

This comment has been minimized.

@cjihrig

cjihrig Dec 8, 2016 Contributor

Couldn't this be on the child process close event?

This comment has been minimized.

@lholmquist

lholmquist Dec 8, 2016 Author Contributor

that makes sense

@lholmquist lholmquist force-pushed the lholmquist:debugger-outputs-module-wrapper-ending-#9768 branch Dec 8, 2016
@lholmquist
Copy link
Contributor Author

lholmquist commented Dec 8, 2016

@cjihrig updated

test/parallel/test-debugger-list-no-module-wrapper.js Outdated
}
});

proc.on('close', (exitCode) => {

This comment has been minimized.

@cjihrig

cjihrig Dec 8, 2016 Contributor

Can you assert the signal too (the second argument to the close handler.

This comment has been minimized.

@lholmquist

lholmquist Dec 8, 2016 Author Contributor

added that too. it happens to be null, i was sort of expecting it to not be though

@lholmquist lholmquist force-pushed the lholmquist:debugger-outputs-module-wrapper-ending-#9768 branch Dec 8, 2016
@cjihrig
Copy link
Contributor

cjihrig commented Dec 8, 2016

@lholmquist
Copy link
Contributor Author

lholmquist commented Dec 8, 2016

looks like some failures, not sure whats going on in those platforms though

@lholmquist lholmquist force-pushed the lholmquist:debugger-outputs-module-wrapper-ending-#9768 branch Dec 8, 2016
@lholmquist
Copy link
Contributor Author

lholmquist commented Dec 8, 2016

i rebased, maybe there was something missing

@cjihrig
Copy link
Contributor

cjihrig commented Dec 9, 2016

test/parallel/test-debugger-list-no-module-wrapper.js Outdated
}
});

proc.on('exit', (exitCode, signal) => {

This comment has been minimized.

@lance

lance Dec 9, 2016 Member

This should probably be wrapped in common.mustCall()

This comment has been minimized.

@lholmquist

lholmquist Dec 9, 2016 Author Contributor

@lance made the update and rebased

@lholmquist lholmquist force-pushed the lholmquist:debugger-outputs-module-wrapper-ending-#9768 branch Jan 18, 2017
@cjihrig
Copy link
Contributor

cjihrig commented Jan 20, 2017

Let's get a fresh CI and see what happens: https://ci.nodejs.org/job/node-test-pull-request/5959/

@lholmquist
Copy link
Contributor Author

lholmquist commented Jan 20, 2017

i see that the ARM is reporting as failed, but the link to CI looks like it passed.

Also, looks like the smartOS 14-32 isn't failing anymore, but 14-64 still is

@cjihrig
Copy link
Contributor

cjihrig commented Jan 20, 2017

The ARM failure on GitHub can be ignored. If you look at the actual Jenkins link, only SmartOS failed.

@lholmquist lholmquist force-pushed the lholmquist:debugger-outputs-module-wrapper-ending-#9768 branch Mar 14, 2017
@TimothyGu
Copy link
Member

TimothyGu commented Mar 20, 2017

@cjihrig can this PR be merged or does it need some more work?

@cjihrig
Copy link
Contributor

cjihrig commented Mar 20, 2017

The last time we ran the CI, the test in this PR was failing on SmartOS.

@TimothyGu
Copy link
Member

TimothyGu commented Mar 20, 2017

The old CI URL seems to have expired. Let's try again then: https://ci.nodejs.org/job/node-test-pull-request/6926/

Copy link
Member

TimothyGu left a comment

CI seems to be passing on SmartOS this time around.

@lholmquist, can you fix this nit and @cjihrig's review comment here (in other words, reverting 8f10635360ffbdd158d3c088a0e19e066ac8cd8c), so we can merge this PR?

test/parallel/test-debugger-list-no-module-wrapper.js Outdated

if (!sentEmpty) {
setImmediate(() => { proc.stdin.write('list(10)\n'); });
sentEmpty = true;

This comment has been minimized.

@TimothyGu

TimothyGu Mar 20, 2017 Member

Can you change the variable name to something that is more applicable to this test, like sentList?

This comment has been minimized.

@lholmquist

lholmquist Mar 20, 2017 Author Contributor

@TimothyGu sure

@lholmquist lholmquist force-pushed the lholmquist:debugger-outputs-module-wrapper-ending-#9768 branch Mar 20, 2017
@lholmquist
Copy link
Contributor Author

lholmquist commented Mar 20, 2017

@TimothyGu @cjihrig I've reverted back that commit, and fixed that small nit. I've also rebased against master too.

@lholmquist lholmquist force-pushed the lholmquist:debugger-outputs-module-wrapper-ending-#9768 branch Mar 21, 2017
… list command

When doing the list command using a number that is more than the amount lines in that files, ex: list(10),
the ending of the Module wrapper was still showing.  This removes that line.

Fixes: #9768
@lholmquist lholmquist force-pushed the lholmquist:debugger-outputs-module-wrapper-ending-#9768 branch to acbc8bb Mar 22, 2017
@danbev
danbev approved these changes Mar 27, 2017
Copy link
Member

danbev left a comment

Minor nit: the subsystem should perhaps be lib:, and the commit message adhere to the guidelines. (I can make those changes when merging after all reviews have been approved)

@danbev
Copy link
Member

danbev commented Mar 28, 2017

@cjihrig @TimothyGu Would it be alright if I land this?

@gibfahn
Copy link
Member

gibfahn commented Mar 28, 2017

@cjihrig
Copy link
Contributor

cjihrig commented Mar 28, 2017

Looks like there are still related test failures.

@danbev
Copy link
Member

danbev commented Mar 28, 2017

Looks like there are still related test failures.

I'm running the test on windows to see if I can track down the issue.

This commit attempts to fix a failure that has been reported by CI and
that I was able to reproduce locally as well. Will run another CI and
see if this takes care of the issue.
@refack refack force-pushed the nodejs:master branch to fbe946b Apr 14, 2017
@BridgeAR
Copy link
Member

BridgeAR commented Aug 26, 2017

This needs a rebase. @danbev did your commit solve the failure?

@lholmquist
Copy link
Contributor Author

lholmquist commented Aug 28, 2017

@BridgeAR @cjihrig Since the file that i made changes to is now deleted, does it make sense to still continue this PR?

@cjihrig
Copy link
Contributor

cjihrig commented Aug 28, 2017

I don't think so. I'll close this.

@cjihrig cjihrig closed this Aug 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

8 participants
You can’t perform that action at this time.