FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

test: add child_process.exec() timeout coverage by cjihrig · Pull Request #9208 · nodejs/node · GitHub

/ node Public

test: add child_process.exec() timeout coverage - #9208

Merged
cjihrig merged 1 commit into
nodejs:masterfrom
cjihrig:timeout
Oct 25, 2016
Merged

test: add child_process.exec() timeout coverage#9208
cjihrig merged 1 commit into
nodejs:masterfrom
cjihrig:timeout

Conversation

cjihrig commented Oct 20, 2016

Copy link
Copy Markdown
Contributor
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 coverage for the timeout option used by child_process exec() and execFile().

nodejs-github-bot added the test Issues and PRs related to the tests. label Oct 20, 2016

Copy link
Copy Markdown
Member

Maybe testing with a different killSignal than the default too?

LGTM anyway if CI is green.

santigimeno added the child_process Issues and PRs related to the child_process subsystem. label Oct 20, 2016

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Would you mind adding a comment mentioning that the console.log() calls are intentionally part of the test.

jasnell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM with a nit

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Mind adding common.mustCall?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nit: Did you mean elapsed?

Copy link
Copy Markdown
Contributor

Not sure why, but when I ran the test locally without the common require, I get this error

cp.exec(cmd, { timeout: 2 ** 30 }, (err, stdout, stderr) => {
                           ^
SyntaxError: Unexpected token *

Also, this trips the linter,

./node tools/eslint/bin/eslint.js --cache --rulesdir=tools/eslint-rules \
      benchmark lib test tools

node/test/parallel/test-child-process-exec-timeout.js
  27:28  error  Parsing error: Unexpected token *

✖ 1 problem (1 error, 0 warnings)

Copy link
Copy Markdown
Contributor

Oh okay. Exponentiation Operator is only in ES7, so you might have to use Math.pow atleast for the sake of the linter. But I wonder how V8 allows this already.

Copy link
Copy Markdown
Contributor

Hmmm, apparently V8 allowed this harmony feature to be turned on by default. Reference: https://bugs.chromium.org/p/v8/issues/detail?id=3915#c18

targos commented Oct 21, 2016

Copy link
Copy Markdown
Member

PR to allow the exponentiation operator in the linter: #9218

targos added a commit to targos/node that referenced this pull request Oct 24, 2016
This allows us to use the exponentiation operator.

PR-URL: nodejs#9218
Ref: nodejs#9208 (comment)
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
jasnell pushed a commit that referenced this pull request Oct 24, 2016
This allows us to use the exponentiation operator.

PR-URL: #9218
Ref: #9208 (comment)
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>

targos commented Oct 24, 2016

Copy link
Copy Markdown
Member

#9218 landed

This commit adds coverage for the timeout option used by
child_process exec() and execFile().

PR-URL: nodejs#9208
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>

cjihrig commented Oct 25, 2016

Copy link
Copy Markdown
Contributor Author

Green CI: https://ci.nodejs.org/job/node-test-pull-request/4666/. Landing.

cjihrig merged commit 1cf55f8 into nodejs:master Oct 25, 2016
cjihrig deleted the timeout branch October 25, 2016 16:57

Copy link
Copy Markdown
Contributor

Belated LGTM.

evanlucas pushed a commit that referenced this pull request Nov 2, 2016
This commit adds coverage for the timeout option used by
child_process exec() and execFile().

PR-URL: #9208
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
MylesBorins pushed a commit that referenced this pull request Nov 17, 2016
This allows us to use the exponentiation operator.

PR-URL: #9218
Ref: #9208 (comment)
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>

Copy link
Copy Markdown
Contributor

@cjihrig this landed cleanly on v6.x with a small modification. v4.x is failing this test though

output:

=== release test-child-process-exec-timeout ===
Path: parallel/test-child-process-exec-timeout
assert.js:85
  throw new assert.AssertionError({
  ^
AssertionError: '/bin/sh -c /Users/thealphanerd/code/node/v4.x/out/Release/node /Users/thealphanerd/code/node/v4.x/test/parallel/test-child-proc === '/Users/thealphanerd/code/node/v4.x/out/Release/node /Users/thealphanerd/code/node/v4.x/test/parallel/test-child-process-exec-ti
    at /Users/thealphanerd/code/node/v4.x/test/parallel/test-child-process-exec-timeout.js:22:10
    at /Users/thealphanerd/code/node/v4.x/test/common.js:402:15
    at ChildProcess.exithandler (child_process.js:220:5)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:854:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)
Command: out/Release/node /Users/thealphanerd/code/node/v4.x/test/parallel/test-child-process-exec-timeout.js

any idea what is up?

MylesBorins pushed a commit that referenced this pull request Nov 18, 2016
This commit adds coverage for the timeout option used by
child_process exec() and execFile().

PR-URL: #9208
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>

cjihrig commented Nov 18, 2016

Copy link
Copy Markdown
Contributor Author

I believe it's the difference between this on v6:
https://github.com/nodejs/node/blob/v6.x/lib/child_process.js#L94

And this on v4:
https://github.com/nodejs/node/blob/v4.x/lib/child_process.js#L100-L101

That assertion can probably be dropped. It's not super important.

MylesBorins pushed a commit that referenced this pull request Nov 19, 2016
This allows us to use the exponentiation operator.

PR-URL: #9218
Ref: #9208 (comment)
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
MylesBorins pushed a commit that referenced this pull request Nov 19, 2016
This commit adds coverage for the timeout option used by
child_process exec() and execFile().

PR-URL: #9208
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>

Copy link
Copy Markdown
Contributor

is it worth backporting without that assertation?

cjihrig commented Nov 19, 2016

Copy link
Copy Markdown
Contributor Author

If you deem the test worthy of backporting, then err.cmd assertions aren't important.

MylesBorins pushed a commit that referenced this pull request Nov 22, 2016
This commit adds coverage for the timeout option used by
child_process exec() and execFile().

PR-URL: #9208
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
MylesBorins mentioned this pull request Nov 22, 2016
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

7 participants


Back | FazBrowse Home | New Git URL