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

test: general improvements to vm tests #14458

Closed
wants to merge 10 commits into from

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Jul 24, 2017

General improvements to vm tests

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Jul 24, 2017
context = vm.createContext({ 'foo': 'bar', 'thing': 'lala' });
assert.strictEqual('bar', context.foo);
assert.strictEqual('lala', context.thing);

console.error('test updating context');
// Rest updating context
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest is a typo, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, should have been Test

@mscdex mscdex added the vm Issues and PRs related to the vm subsystem. label Jul 24, 2017
@Trott
Copy link
Member

Trott commented Jul 24, 2017

Not objecting enough to stop it, but I'm not a fan of removing console.* calls in tests as a supposed improvement. Those are often super helpful when tests start failing in CI in ways that are difficult to reproduce locally. Seems to favor abstract ideas about how tests are "supposed" to be written over practical considerations.

@jasnell
Copy link
Member Author

jasnell commented Jul 24, 2017

I've been considering introducing a new common.log() that would be a non-op unless a NODE_TEST_LOG=1 environment variable is set... that would accomplish the same basic thing without introducing the unnecessary noise by default.

@jasnell jasnell force-pushed the improve-vm-tests branch from 8295cbe to cc66afb Compare July 24, 2017 22:30
@Trott
Copy link
Member

Trott commented Jul 24, 2017

I've been considering introducing a new common.log() that would be a non-op unless a NODE_TEST_LOG=1 environment variable is set... that would accomplish the same basic thing without introducing the unnecessary noise by default.

What is the downside of console.log() statements that we are trying to avoid? What is the value we get in return for the added complexity?

(Feel free to take this offline if it's a distraction from the PR generally.)

@jasnell
Copy link
Member Author

jasnell commented Jul 25, 2017

most of the time the console.log output is generally quite useless in the tests that exist currently. For instance, printing console.log('ok') unconditionally when the test exits, or calling console.log() within unnecessary event handlers, with content that is not very useful, even for simple debugging.

@Trott
Copy link
Member

Trott commented Jul 25, 2017

most of the time the console.log output is generally quite useless in the tests that exist currently. For instance, printing console.log('ok') unconditionally when the test exits, or calling console.log() within unnecessary event handlers, with content that is not very useful, even for simple debugging.

If most of the logging is useless (which is an assessment I do not agree with), how does creating a whole new way to control logging improve anything? It seems that it would be better to improve or remove existing log messages.

@Trott
Copy link
Member

Trott commented Jul 25, 2017

Although looking more at these specific logging messages...yeah, not sure I get the utility of them. Sorry I said anything here. I should have saved it for something else where the log messages might have value. 😆

Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if CI is green.

@jasnell
Copy link
Member Author

jasnell commented Jul 25, 2017

@Trott ... I definitely understand where you're coming from. Introducing a new common.log() type of mechanism and converting over gives us an opportunity to do two things: 1) improve the existing output messages to make them more useful and 2) improve the tests overall. As is evidenced by the recent round of test improvements I've been making, there are a range of improvements that can be made.

p.stderr.on('data', function(data) {
assert.fail(`Unexpected stderr data: ${data}`);
});
p.stderr.on('data', common.mustNotCall);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function should be invoked: common.mustNotCall().

p.stdout.on('data', function(data) {
assert.fail(`Unexpected stdout data: ${data}`);
});
p.stdout.on('data', common.mustNotCall);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Trott
Trott previously requested changes Jul 26, 2017
Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs nits from @lpinca before landing.

@jasnell
Copy link
Member Author

jasnell commented Jul 31, 2017

Updated, rebased

@Trott Trott dismissed their stale review August 1, 2017 02:31

updated since review, dismissing request for changes

@jasnell
Copy link
Member Author

jasnell commented Aug 2, 2017

Rebased. CI before landing: https://ci.nodejs.org/job/node-test-pull-request/9445/

@jasnell
Copy link
Member Author

jasnell commented Aug 2, 2017

Canceled the CI run... there appear to be some issues in CI-land (ping @nodejs/build)

@jasnell
Copy link
Member Author

jasnell commented Aug 2, 2017

Trying new CI run again: https://ci.nodejs.org/job/node-test-pull-request/9454/

jasnell added a commit that referenced this pull request Aug 3, 2017
PR-URL: #14458
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
@jasnell
Copy link
Member Author

jasnell commented Aug 3, 2017

Landed 4b23b42

@jasnell jasnell closed this Aug 3, 2017
MylesBorins pushed a commit that referenced this pull request Sep 9, 2017
PR-URL: #14458
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Sep 10, 2017
MylesBorins pushed a commit that referenced this pull request Sep 20, 2017
PR-URL: #14458
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Sep 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests. vm Issues and PRs related to the vm subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.