GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: improve child_process test coverage by chiiia12 · Pull Request #11278 · nodejs/node

Conversation

@chiiia12

@chiiia12 chiiia12 commented Feb 10, 2017

Copy link
Copy Markdown

This PR improves child_process coverage (maybe cover statement 100%).
This is my first contribution, please review.

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)

N/A

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to Node.js core tests and test infrastructure. label Feb 10, 2017
@mscdex mscdex added the child_process Issues and PRs related to the child_process subsystem. label Feb 10, 2017
@Trott

Trott commented Feb 10, 2017

Copy link
Copy Markdown
Member

@nodejs/testing

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented Feb 10, 2017

Copy link
Copy Markdown
Contributor

I'm not sure that the changes to test-child-process-exec-timeout.js and test-child-process-spawn-typeerror.js actually buy us anything.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@yosuke-furukawa

yosuke-furukawa commented Feb 10, 2017

Copy link
Copy Markdown
Member

@cjihrig

Currently, we are getting started to learn how to contribute node.js core in my company. I am teaching how-to-contribute and suggest contribution point. So I answered about that.

According to child_process coverage report ,
we found 3 uncovered blocks.

  1. child_process.fork option, stdio: ignore is not passed yet.
  2. child_process throws exception when kill signal is invalid.
  3. child_process.execFile can add arguments array but in current test the array is always empty.

so we just add those 3 tests.

jasnell and ericmdantas reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell approved these changes Feb 10, 2017
View reviewed changes
@cjihrig

cjihrig commented Feb 10, 2017

Copy link
Copy Markdown
Contributor

child_process throws exception when kill signal is invalid.

I don't think the tests in this PR address that. I have a PR for that in #11038. I haven't landed it yet because I think there is an issue somewhere with killing child processes on Windows.

child_process.execFile can add arguments array but in current test the array is always empty.

Again, I don't think this PR addresses that. The changes to test-child-process-spawn-typeerror.js call spawn(), not execFile().

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@yosuke-furukawa

yosuke-furukawa commented Feb 11, 2017

Copy link
Copy Markdown
Member

@cjihrig

I don't think the tests in this PR address that. I have a PR for that in #11038.

we are checking to add console.log at the lines.

  function kill() {
    if (child.stdout)
      child.stdout.destroy();

    if (child.stderr)
      child.stderr.destroy();

    killed = true;
    try {
      child.kill(options.killSignal);
    } catch (e) {
      console.log(`caught on the kill signal: ${options.killSignal} `, e);
      ex = e;
      exithandler();
    }
  }

we have got the message like that. so I think we can pass the blocks.

$ node test/parallel/test-child-process-exec-timeout.js
caught on the kill signal: SIGUNDEF  Error: Unknown signal: SIGUNDEF
    at ChildProcess.kill (internal/child_process.js:375:11)
    at kill (child_process.js:265:13)
    at Timeout.delayedKill [as _onTimeout] (child_process.js:275:7)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)

However, your PR will also reach here. we don't have an opinion which PR is better. if your PR will be merged before this PR, we will remove this test.

Again, I don't think this PR addresses that. The changes to test-child-process-spawn-typeerror.js call spawn(), not execFile().

hmm. this one is our failure, we need to fix about that. We will fix this soon. thank you.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented Feb 11, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

we are checking to add console.log at the lines.

Apologies. There is currently no input validation on the kill signal for execFile(). Ideally, it should be using the validateKillSignal() function used by spawnSync(), but that causes some test failures. Some work is needed to improve consistency there.

EDIT: #10423 is relevant to that test, as it would eliminate the code coverage.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chiiia12
chiiia12 force-pushed the test_improve_child_process branch 3 times, most recently from 6dd71eb to a27130b Compare February 13, 2017 08:44
@chiiia12

chiiia12 commented Feb 13, 2017

Copy link
Copy Markdown
Author

@cjihrig Thanks.I fixed it!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@yosuke-furukawa

yosuke-furukawa commented Feb 13, 2017

Copy link
Copy Markdown
Member

@cjihrig
Yes, validateKillSignal for execFile is better. But the function changes would be better to discuss another PR. If we should wait for the function changes and #10423 , we can drop the undefined signal test. If you suggest so, we will drop.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented Feb 16, 2017

Copy link
Copy Markdown
Contributor

@yosuke-furukawa I would drop the changes in test-child-process-exec-timeout.js. Those checks will become obsolete in #10423.

The changes in test-child-process-ignore-stdio.js add the missing code coverage, but I don't think it actually tests the code it's covering. For example, I can change the stdio option to a valid option other than 'ignore', and the test still passes.

The changes in test-child-process-spawn-typeerror.js should be moved to a different test file IMO. Because the code you're adding coverage for updates the cmd variable, some assertions should be added for the error object's message and cmd properties at a minimum.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chiaki-yokoo
test: improve child_process test coverage
2ea2378
@chiiia12
chiiia12 force-pushed the test_improve_child_process branch from a27130b to 2ea2378 Compare February 17, 2017 03:18
@chiiia12

chiiia12 commented Feb 17, 2017

Copy link
Copy Markdown
Author

@cjihrig Sounds reasonable.I remove it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@fhinkel

fhinkel commented Mar 26, 2017

Copy link
Copy Markdown
Contributor

@chiiia12 Are you still working on this?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell jasnell added the stalled Issues and PRs manually marked as stalled and scheduled for automatic closure. label Mar 26, 2017
@refack
refack force-pushed the master branch from 16073c0 to fbe946b Compare April 14, 2017 04:11
@fhinkel

fhinkel commented May 26, 2017

Copy link
Copy Markdown
Contributor

There hasn't been any activity here. I'm closing this. Feel free to reopen (or ping a collaborator).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@fhinkel fhinkel closed this May 26, 2017
This was referenced Jul 6, 2023
[Snyk] Fix for 2 vulnerabilities leonardoadame/node#23
Open
[Snyk] Fix for 2 vulnerabilities leonardoadame/node#57
Open
[Snyk] Fix for 2 vulnerabilities leonardoadame/node#77
Open
[Snyk] Security upgrade jest from 25.5.4 to 27.0.0 leonardoadame/node#147
Open
@aliscco aliscco mentioned this pull request Jul 10, 2023
[Snyk] Security upgrade jest from 24.9.0 to 27.0.0 aliscco/alisco-node#628
Open
@leonardoadame leonardoadame mentioned this pull request Nov 28, 2023
[Snyk] Security upgrade jest from 26.6.3 to 27.0.0 leonardoadame/node#199
Open
@aliscco aliscco mentioned this pull request Nov 29, 2023
[Snyk] Security upgrade jest from 26.4.2 to 27.0.0 aliscco/alisco-node#785
Open
@aliscco aliscco mentioned this pull request Nov 30, 2023
[Snyk] Security upgrade jest from 24.9.0 to 27.0.0 aliscco/alisco-node#799
Open
@leonardoadame leonardoadame mentioned this pull request Nov 30, 2023
[Snyk] Security upgrade jest from 25.5.4 to 27.0.0 leonardoadame/node#281
Open
@aliscco aliscco mentioned this pull request Dec 2, 2023
[Snyk] Fix for 6 vulnerabilities aliscco/alisco-node#1050
Open
@leonardoadame leonardoadame mentioned this pull request Dec 5, 2023
[Snyk] Security upgrade jest from 25.5.4 to 27.0.0 leonardoadame/node#539
Open
@aliscco aliscco mentioned this pull request Dec 8, 2023
[Snyk] Security upgrade jest from 24.9.0 to 27.0.0 aliscco/alisco-node#1158
Open
This was referenced Dec 10, 2023
[Snyk] Security upgrade jest from 25.5.4 to 27.0.0 leonardoadame/node#577
Open
[Snyk] Security upgrade jest from 24.9.0 to 27.0.0 leonardoadame/node#578
Open
This was referenced Dec 10, 2023
[Snyk] Security upgrade jest from 26.4.2 to 27.0.0 aliscco/alisco-node#1165
Open
[Snyk] Security upgrade jest from 24.9.0 to 27.0.0 aliscco/alisco-node#1167
Open
@leonardoadame leonardoadame mentioned this pull request Dec 19, 2023
[Snyk] Security upgrade jest from 26.6.3 to 27.0.0 leonardoadame/node#581
Open
@aliscco aliscco mentioned this pull request Jan 1, 2024
[Snyk] Security upgrade jest from 26.4.2 to 27.0.0 aliscco/alisco-node#1182
Open
@aliscco aliscco mentioned this pull request Jan 31, 2024
[Snyk] Security upgrade jest from 24.9.0 to 27.0.0 aliscco/alisco-node#1205
Open
@leonardoadame leonardoadame mentioned this pull request Feb 12, 2024
[Snyk] Fix for 3 vulnerabilities leonardoadame/node#684
Open
@leonardoadame leonardoadame mentioned this pull request May 13, 2024
[Snyk] Fix for 2 vulnerabilities leonardoadame/node#831
Open
@aliscco aliscco mentioned this pull request May 15, 2024
[Snyk] Fix for 2 vulnerabilities aliscco/alisco-node#1499
Open
@leonardoadame leonardoadame mentioned this pull request May 16, 2024
[Snyk] Security upgrade jest from 24.9.0 to 27.0.0 leonardoadame/node#963
Open
This was referenced May 16, 2024
[Snyk] Security upgrade jest from 24.9.0 to 27.0.0 aliscco/alisco-node#1578
Open
[Snyk] Security upgrade jest from 26.4.2 to 27.0.0 aliscco/alisco-node#1581
Open
[Snyk] Security upgrade jest from 24.9.0 to 27.0.0 aliscco/alisco-node#1601
Open
@leonardoadame leonardoadame mentioned this pull request May 19, 2024
[Snyk] Security upgrade jest from 26.6.3 to 27.0.0 leonardoadame/node#998
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

child_process Issues and PRs related to the child_process subsystem. stalled Issues and PRs manually marked as stalled and scheduled for automatic closure. test Issues and PRs related to Node.js core tests and test infrastructure.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@chiiia12 @Trott @cjihrig @yosuke-furukawa @fhinkel @jasnell @mscdex @nodejs-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.