Skip to content
New issue

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

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

Already on GitHub? # to your account

test: add coverage for spawnSync() killSignal #8960

Merged
merged 1 commit into from
Oct 10, 2016

Conversation

cjihrig
Copy link
Contributor

@cjihrig cjihrig commented Oct 6, 2016

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

test

Description of change

This commit adds a test for the killSignal option to spawnSync(), and the other sync child process functions by extension.

This was previously untested according to https://node-core-coverage.addaleax.net/

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Oct 6, 2016
Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

LGTM

@mscdex mscdex added the child_process Issues and PRs related to the child_process subsystem. label Oct 6, 2016
if (process.argv[2] === 'child') {
setInterval(() => {}, 1000);
} else {
const SIGUSR2 = process.binding('constants').os.signals.SIGUSR2;
Copy link
Member

Choose a reason for hiding this comment

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

You could DRY this as const { SIGUSR2 } = process.binding('constants').os.signals. Minor thing though.

@cjihrig
Copy link
Contributor Author

cjihrig commented Oct 10, 2016

CI with the suggestion incorporated: https://ci.nodejs.org/job/node-test-pull-request/4445/

@cjihrig
Copy link
Contributor Author

cjihrig commented Oct 10, 2016

Related failures on Windows.

@cjihrig cjihrig force-pushed the killsignal branch 2 times, most recently from dc1c87f to 532e7f7 Compare October 10, 2016 17:06
@cjihrig
Copy link
Contributor Author

cjihrig commented Oct 10, 2016

It looks like child.status is 1 on Windows, and 0 elsewhere. Additionally, certain signals are not supported on Windows. Added detection of the exit code, and switched from SIGUSR2 to SIGKILL.

CI: https://ci.nodejs.org/job/node-test-pull-request/4447/. The only failures are now unrelated.

This commit adds a test for the killSignal option to spawnSync(),
and the other sync child process functions by extension.

PR-URL: nodejs#8960
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@cjihrig cjihrig merged commit 01db04b into nodejs:master Oct 10, 2016
@cjihrig cjihrig deleted the killsignal branch October 10, 2016 18:34
jasnell pushed a commit that referenced this pull request Oct 10, 2016
This commit adds a test for the killSignal option to spawnSync(),
and the other sync child process functions by extension.

PR-URL: #8960
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Fishrock123 pushed a commit that referenced this pull request Oct 11, 2016
This commit adds a test for the killSignal option to spawnSync(),
and the other sync child process functions by extension.

PR-URL: #8960
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request Nov 22, 2016
This commit adds a test for the killSignal option to spawnSync(),
and the other sync child process functions by extension.

PR-URL: #8960
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@MylesBorins MylesBorins mentioned this pull request Nov 22, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
child_process Issues and PRs related to the child_process subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants