0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

289 Commits

Author SHA1 Message Date
Rich Trott
daead5a767 test: reduce run time for test-benchmark-http
Specify more configuration options to reduce run time by about a third.

PR-URL: https://github.com/nodejs/node/pull/14180
Fixes: https://github.com/nodejs/node/issues/14177
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-07-12 08:40:45 -07:00
Rich Trott
82aa34ed1f test: reduce test-benchmark-net run duration
Set configuration option to reduce combinations of benchmark settings
tried in test, reducing execution time by about 50%.

PR-URL: https://github.com/nodejs/node/pull/14183
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-07-12 06:30:44 -07:00
Rich Trott
b20a0b662b test: fix flaky test-https-set-timeout-server
Because of a race condition, connection listener may not be invoked if
test is run under load. Remove `common.mustCall()` wrapper from the
listener. Move the test to `parallel` because it now works under load.
Make similar change to http test to keep them in synch even though it is
much harder to trigger the race in http.

PR-URL: https://github.com/nodejs/node/pull/14134
Fixes: https://github.com/nodejs/node/issues/14133
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2017-07-11 10:09:06 -07:00
Vse Mozhet Byt
2d2986ae72 test: simplify test skipping
* Make common.skip() exit.

  Also add common.printSkipMessage() for partial skips.

* Don't make needless things before skip

PR-URL: https://github.com/nodejs/node/pull/14021
Fixes: https://github.com/nodejs/node/issues/14016
Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-07-04 12:41:49 +03:00
Jaime Bernardo
f1c890afb0 test,fs: delay unlink in test-regress-GH-4027.js
The sequential/test-regress-GH-4027 test is flaky with an increased
system load, failing when the watched file is unlinked before the
first state of the watched file is retrieved.

After increasing the delay before unlinking and calling setTimeout
after watchFile, the flakiness stopped reproducing.

PR-URL: https://github.com/nodejs/node/pull/14010
Fixes: https://github.com/nodejs/node/issues/13800
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-07-03 13:54:35 -07:00
Alexey Orlenko
932ee65cd2
test: refactor test-http(s)-set-timeout-server
* Make changes to `test-https-set-timeout-server` to resolve
  inconsistencies with its http counterpart:

  - Apply the changes analogous to those in GH-13802 to the https test.
  - Add a missing `common.mustCall()` wrapper.
  - Make small stylistic changes (e.g., remove unnecessary line breaks
    in comments) to make it visually consistent with the http test.

* Use arrow functions.

PR-URL: https://github.com/nodejs/node/pull/13935
Fixes: https://github.com/nodejs/node/issues/13588
Refs: https://github.com/nodejs/node/pull/13802
Refs: https://github.com/nodejs/node/pull/13625
Refs: https://github.com/nodejs/node/pull/13822
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-07-03 14:20:16 -04:00
Julien Klepatch
2e5ce2bc2c
test: make http(s)-set-timeout-server more similar
Make test-http(s)-set-timeout-server tests more similar and resolve the
following issues:

* `test-https-set-timeout-server.js` was missing some `assert`
   statements, including with `http` module

* Both files were missing some calls to `common.mustCall()`

* Both files were calling `createServer()` in different ways

PR-URL: https://github.com/nodejs/node/pull/13822
Refs: https://github.com/nodejs/node/issues/13588
Refs: https://github.com/nodejs/node/pull/13625
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-06-26 21:08:09 +03:00
Vse Mozhet Byt
3b0e800f18 util: make util.debuglog() consistent with doc
Previous realization produces some false positive and false negative
results due to:

* conflicts between unescaped user input and RegExp special characters;

* conflicts between parsing with `\b` RegExp symbol and non
  alphanumeric characters in section names.

The doc does not mention any such restrictions.

PR-URL: https://github.com/nodejs/node/pull/13841
Fixes: https://github.com/nodejs/node/issues/13728
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-06-23 19:46:08 +03:00
Vse Mozhet Byt
76340e3f10 test: fix RegExp nits
* Remove needless RegExp flag

  In fixed case, `/g` flag is needless in the boolean context.

* Remove needless RegExp capturing

  Use non-capturing grouping or remove capturing completely when:

  * capturing is useless per se, e.g. in test() check;
  * captured groups are not used afterward at all;
  * some of the later captured groups are not used afterward.

* Use test, not match/exec in boolean context

  match() and exec() return a complicated object,
  unneeded in a boolean context.

* Do not needlessly repeat RegExp creation

  This commit takes RegExp creation out of cycles and other repetitions.

  As long as the RegExp does not use /g flag and match indices,
  we are safe here.

  In tests, this fix hardly gives a significant performance gain,
  but it increases clarity and maintainability,
  reassuring some RegExps to be identical.

  RegExp in functions are not taken out of their functions:
  while these functions are called many times
  and their RegExps are recreated with each call,
  the performance gain in test cases
  does not seem to be worth decreasing function self-dependency.

PR-URL: https://github.com/nodejs/node/pull/13770
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-06-21 03:40:27 +03:00
jklepatch
bed3579dbe
test: make test-http(s)-set-timeout-server alike
Make test-http(s)-set-timeout-server tests more similar and resolve the
following issues:

* `test-http-set-timeout-server.js` had a `secReceived` check in
  `serverResponseTimeoutWithPipeline()` that was added to prevent
  flakiness, but this did not exist in the https counterpart.

* `test-https-set-timeout-server.js` utilized `common.mustCall()`,
  `common.mustNotCall()`, etc., while the http counterpart utilized the
  old method of checking flags on exit of the process.

Refs: https://github.com/nodejs/node/issues/13588
PR-URL: https://github.com/nodejs/node/pull/13625
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
2017-06-19 12:18:07 +03:00
Rich Trott
7f18532cf8 test: use mustNotCall() in test-fs-watch
Use common.mustNotCall() in test/sequential/test-fs-watch.js in
situations where the call to watch() is expected to throw.

PR-URL: https://github.com/nodejs/node/pull/13595
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-06-13 12:39:46 -07:00
Refael Ackermann
c9d45c4505 test: harden test-dgram-bind-shared-ports
* add `mustCall` and `mustNotCall` to all callbacks
* added `known_issue` for port binding

PR-URL: https://github.com/nodejs/node/pull/13100
Refs: https://github.com/nodejs/node/issues/13055
Refs: https://github.com/nodejs/node/pull/12999
Refs: https://github.com/nodejs/node/issues/13526
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-06-09 17:14:44 -04:00
Gibson Fahnestock
eef94a8bf8
test: pass env vars through to test-benchmark-http
Allows NODE_TEST_DIR to be set (necessary to avoid path length issues
with common.PIPE).

PR-URL: https://github.com/nodejs/node/pull/13390
Refs: https://github.com/nodejs/node/issues/12708#issuecomment-297847882
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-06-07 16:41:32 +01:00
Rich Trott
e824c75c3e test: refactor test-net-server-bind
* Use common.mustNotCall() and common.mustCall() as appropriate
* Use block scoping
* Move assertions out of `exit` handler and into callbacks
* Order assert.strictEqual() args per docs
* Remove console.log() calls
* Move test from `parallel` to `sequential` so `common.PORT` can be used
  without conflicting with OS-provided ports in other `parallel` tests

PR-URL: https://github.com/nodejs/node/pull/13273
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-05-31 22:09:54 -07:00
Refael Ackermann
16689e30ae inspector: --debug* deprecation and invalidation
PR-URL: https://github.com/nodejs/node/pull/12949
Fixes: https://github.com/nodejs/node/issues/12364
Fixes: https://github.com/nodejs/node/issues/12630
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
2017-05-29 11:33:59 -04:00
Rich Trott
b5b6f5d6a9
test: check number of message events
When a no-op message event handler is used in a test, make it clear what
is expected by using `common.mustCall()` and `common.mustNotCall()`.

PR-URL: https://github.com/nodejs/node/pull/13125
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <mhdawson@ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-05-23 21:08:22 +02:00
Sebastian Plesciuc
3429c90f42 test: fix sequential test-net-connect-local-error
Fixed sequential test-net-connect-local-error by swapping port
and localPort in net.connect options.

PR-URL: https://github.com/nodejs/node/pull/13064
Fixes: https://github.com/nodejs/node/issues/13055
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2017-05-22 14:11:57 -04:00
Rich Trott
171a43a986 test: shorten test-benchmark-http
Add `--set key=""` to cut down the time it takes to run
test-benchmark-http by about a third.

Alphabetize options in `--set` list.

PR-URL: https://github.com/nodejs/node/pull/13109
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-05-21 19:59:34 -07:00
Artur G Vieira
c60a7fa738 test: move net reconnect error test to sequential
The usage of common.PORT could cause undesired port collisions when run
in parallel. The following test was moved to sequential.
test-net-reconnect-error.js

PR-URL: https://github.com/nodejs/node/pull/13033
Refs: https://github.com/nodejs/node/issues/12376
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-05-20 08:08:13 -04:00
Rich Trott
525497596a test: refactor test-net-GH-5504
* Improve comments describing test.
* Remove unnecessary `common.noop`
* Remove confusing scoping of `c` identifier

PR-URL: https://github.com/nodejs/node/pull/13025
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-05-19 21:42:52 -07:00
Rich Trott
658741b9d9 test: refactor test-https-set-timeout-server
* Add common.mustCall() for error handlers.
* Alphabetize modules

PR-URL: https://github.com/nodejs/node/pull/13032
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
2017-05-19 21:26:46 -07:00
Rich Trott
7e5ed8bad9
test: track callback invocations
Use `common.mustCall()` and `common.mustNotCall()` to check that
callbacks are invoked the expected number of times in
test-net-listen-shared-ports.

PR-URL: https://github.com/nodejs/node/pull/13010
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-05-18 23:25:32 +02:00
Sebastian Plesciuc
0c2edd27e6 test: fixed flaky test-net-connect-local-error
Fixed test-net-connect-local-error by moving the test from
parallel to sequential.

PR-URL: https://github.com/nodejs/node/pull/12964
Fixes: https://github.com/nodejs/node/issues/12950
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2017-05-15 23:28:21 -04:00
Vse Mozhet Byt
945f208081 test: make the rest of tests path-independent
Permit spaces in paths to a Node.js executable and test scripts.

PR-URL: https://github.com/nodejs/node/pull/12972
Fixes: https://github.com/nodejs/node/issues/12773
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-05-14 16:05:48 +03:00
Rafael Fragoso
84fc069b95 test: move test-dgram-bind-shared-ports to sequential
PR-URL: https://github.com/nodejs/node/pull/12452
Ref: https://github.com/nodejs/node/issues/12376
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-05-13 18:37:06 +02:00
Aditya Anand
94eed0fb11 test: use dynamic port instead of common.PORT
Remove common.PORT from, test-net-connect-immediate-destroy,
test-net-options-lookup, test-net-connect-local-error,
test-net-connect-handle-econnrefused, test-net-socket-destroy-twice,
test-net-better-error-messages-port-hostname, test-net-localerror,
to reduce possibility that a dynamic port used in another test will
collide with common.PORT.

Moved test-net-listen-shared-ports, test-net-better-error-messages-port
from tests/parallel to test/sequential

Refs: https://github.com/nodejs/node/issues/12376
PR-URL: https://github.com/nodejs/node/pull/12473
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2017-05-09 13:25:05 -07:00
Vse Mozhet Byt
8b76c3e60c test: reduce string concatenations
PR-URL: https://github.com/nodejs/node/pull/12735
Refs: https://github.com/nodejs/node/pull/12455
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-05-05 17:39:05 +03:00
Rich Trott
ff001c12b0 test: move WPT to its own testing module
This is first in a hoped-for series of moves away from a monolithic
common.js that is loaded for every test and towards a more modular
approach. (In the end, common.js will hopefully contain checks for
variables leaking into the global space and perhaps some of the more
ubiquitous functions like common.mustCall().)

Move the WPT testing code to its own module.

PR-URL: https://github.com/nodejs/node/pull/12736
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2017-05-03 17:00:31 -07:00
Walter Huang
133fb0c3b7 test: minor fixes to test-module-loading.js
Use block scope for local variables only used in a small code block.
Fixed inverse arguments in some usages of Assert.strictEqual.

PR-URL: https://github.com/nodejs/node/pull/12728
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-05-02 16:11:16 -07:00
Daniel Bevenius
10ccf56f89 test: skipIfInspectorDisabled cluster-inspect-brk
When configured --without-ssl the inspect-brk option will not be
available and the process will exit with a exit value of 9 "Invalid
Argument/Bad option".

This commit adds a skipIfInspectorDisabled check since --without-ssl
implies that no inspector support is build as well.

PR-URL: https://github.com/nodejs/node/pull/12757
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-05-02 07:50:16 +02:00
Rich Trott
0833d31ec6 test: move test to sequential for reliability
test-https-set-timeout-server fails under load. Move it to sequential so
it is not competing with other tests.

PR-URL: https://github.com/nodejs/node/pull/12704
Fixes: https://github.com/nodejs/node/issues/10130
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-04-30 13:40:16 -07:00
dave-k
0324ac686c
test: add inspect-brk option to cluster module
Ensure that cluster interoperates with the --inspect-brk option.
This does not test for --debug-brk.

Fixes: https://github.com/nodejs/node/issues/11420
PR-URL: https://github.com/nodejs/node/pull/12503
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-04-30 01:30:39 +02:00
Rich Trott
a1a54ca3f1 benchmark: terminate child process on Windows
test-benchmark-child-process failures reveal that
child-process-exec-stdout benchmark sometimes leaves around a stray
yes.exe process. Add code to terminate the process.

PR-URL: https://github.com/nodejs/node/pull/12658
Ref: https://github.com/nodejs/node/issues/12560
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-28 16:18:35 -07:00
Michaël Zasso
c8c5a528da test: make tests pass when built without inspector
PR-URL: https://github.com/nodejs/node/pull/12622
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-26 10:02:15 +02:00
RobotMermaid
b65d5e447b test: cleanup test-fs-watch.js
Reversed "actual" and "expected" arguments for assert.strictEqual().

Replaced constructor with regular expression for assert.throws().

PR-URL: https://github.com/nodejs/node/pull/12595
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Bryan English <bryan@bryanenglish.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-04-25 21:15:03 -07:00
Vse Mozhet Byt
71abfa9548 tools: use no-useless-concat ESLint rule
* Add `no-useless-concat: error` to .eslintrc.yaml.
* Apply no-useless-concat rule to tests.

PR-URL: https://github.com/nodejs/node/pull/12613
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2017-04-25 22:28:46 +03:00
Rich Trott
3663ac27c1 test: remove flaky designation for test on AIX
https://github.com/nodejs/node/issues/5085 has been completed so
presumably test-fs-watch is not flaky on AIX anymore. Remove flaky
designation from sequential.status.

PR-URL: https://github.com/nodejs/node/pull/12564
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-04-24 09:56:05 -07:00
kumarrishav
200961b7e1 test: move test-debugger-repeat-last to sequential
PR-URL: https://github.com/nodejs/node/pull/12470
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-04-22 08:00:50 +02:00
Rich Trott
b485813499 test: set benchmark-child-process flaky on windows
sequential/test-benchmark-child-process is still failing sometimes flaky
on Windows in CI. Mark it as flaky in sequential.status until it gets
sorted.

PR-URL: https://github.com/nodejs/node/pull/12561
Ref: https://github.com/nodejs/node/issues/12560
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2017-04-20 22:37:41 -07:00
Rich Trott
32f77ff8ce test: minimize time for child_process benchmark
test-benchmark-child-process sometimes times out on Windows in CI.
Minimize the number of configurations that run so it will (hopefully)
not time out anymore. Set dur=0.

PR-URL: https://github.com/nodejs/node/pull/12518
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2017-04-19 15:55:32 -07:00
Joyee Cheung
3d7c82bd61 test: add test for child_process benchmark
PR-URL: https://github.com/nodejs/node/pull/12326
Ref: https://github.com/nodejs/node/issues/12068
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
2017-04-19 22:58:26 +08:00
Joyee Cheung
2d3d4ccb98 test: add http benchmark test
PR-URL: https://github.com/nodejs/node/pull/12121
Refs: https://github.com/nodejs/node/issues/12068
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-09 18:16:22 +08:00
Jan Krems
47f8f7462f src: remove support for --debug
In the 2017-04-05 meeting, the CTC agreed to remove support for the
legacy debugger in 8.0.0. This is the first step in this direction.

Refs: https://github.com/nodejs/CTC/issues/94
PR-URL: https://github.com/nodejs/node/pull/12197
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2017-04-06 09:50:09 +02:00
Sakthipriyan Vairamani (thefourtheye)
d51f4f31be
test: reduce buffer size in buffer-creation test
This test is allocating much more memory than necessary to actually
reproduce the original problem. Lowering the amount of memory allocated
increases performance at least in some cases and makes this test less
likely to time out on SmartOS.

PR-URL: https://github.com/nodejs/node/pull/11177
Ref: https://github.com/nodejs/node/issues/10166

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Julien Gilli <jgilli@nodejs.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-04-04 13:10:51 +05:30
Brian White
61ebfa8d1f tools: add unescaped regexp dot rule to linter
PR-URL: https://github.com/nodejs/node/pull/11834
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2017-03-29 10:53:28 +02:00
Vse Mozhet Byt
642baf4699 benchmark: check end() argument to be > 0
PR-URL: https://github.com/nodejs/node/pull/12030
Ref: https://github.com/nodejs/node/issues/11972
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2017-03-28 03:18:44 +03:00
James M Snell
4f2e372716 test: add common.noop, default for common.mustCall()
Export a new common.noop no-operation function for general use.
Allow using common.mustCall() without a fn argument to simplify
test cases.

Replace various non-op functions throughout tests with common.noop

PR-URL: https://github.com/nodejs/node/pull/12027
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2017-03-26 12:47:15 -07:00
Rich Trott
0d000ca51f test: add minimal test for net benchmarks
Currently, benchmark code is not exercised at all in CI. This adds a
minimal test for net benchmarks. If this is deemed acceptable, similar
minimal tests for other benchmarks can be written. Additionally, as
issues and edge cases are uncovered, checks for them can be added.

PR-URL: https://github.com/nodejs/node/pull/11979
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2017-03-24 09:03:25 -07:00
Rich Trott
5e3d536ea3 test: fix flaky test-domain-abort-on-uncaught
test-domain-abort-on-uncaught is flaky under load. Move it to sequential
so it is not competing with other tests for resources.

PR-URL: https://github.com/nodejs/node/pull/11817
Fixes: https://github.com/nodejs/node/issues/11814
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-03-16 15:35:17 -07:00
James M Snell
98e54b0bd4 meta: restore original copyright header
A prior io.js era commit inappropriately removed the
original copyright statements from the source. This
restores those in any files still remaining from that
edit.

Ref: https://github.com/nodejs/TSC/issues/174
Ref: https://github.com/nodejs/node/pull/10599
PR-URL: https://github.com/nodejs/node/pull/10155

Note: This PR was required, reviewed-by and approved
by the Node.js Foundation Legal Committee and the TSC.
There is no `Approved-By:` meta data.
2017-03-10 11:23:48 -08:00
Daniel Bevenius
1402fef098 test: make tests pass when configured without-ssl
Currently when node is build --without-ssl and the test are run,
there are a number of failing test due to tests expecting crypto
support to be available. This commit fixes fixes the failure and
instead skips the tests that expect crypto to be available.

PR-URL: https://github.com/nodejs/node/pull/11631
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-03-04 20:16:52 +01:00
Kunal Pathak
c3bc48f632 test: fix flaky test-vm-timeout-rethrow
The intention of test case is to make sure that `timeout` property is honored
and the code in context terminates and throws correct exception. However in
test case, the code inside context would complete before `timeout` for windows
and would sometimes fail. Updated the code so it guarantee to not complete
execution until timeout is triggered.

Fixes: https://github.com/nodejs/node/issues/11261
PR-URL: https://github.com/nodejs/node/pull/11530
Reviewed-By: James M Snell <jasnell.gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Josh Gavant <josh.gavant@outlook.com>
2017-02-24 14:56:07 -08:00
Tarang Hirani
a4c3e31ac7
test: add regex check to test-module-loading
Also removes extraneous argument.

PR-URL: https://github.com/nodejs/node/pull/11413
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
2017-02-21 09:09:53 +00:00
cjihrig
7dd82dd1c3 test: add common.mustNotCall()
This commit adds a mustNotCall() helper for testing. This provides
an alternative to using common.fail() as a callback, or creating
a callback function for the sole purpose of calling common.fail().

PR-URL: https://github.com/nodejs/node/pull/11152
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
2017-02-06 14:07:55 -05:00
Rich Trott
80c72c6d55 test: fix flaky test-regress-GH-897
Even after being moved to `sequential` in
1ce05ad540, `test-regress-GH-897` still
was occasionally flaky on Raspberry Pi devices on CI.

The test is especially sensitive to resource constraints. It failed
reliably on my laptop if I moved it to `parallel` and ran 32 competing
node test processes. Even for a flaky test, that's unusually low. I
typically don't see problems, even for flaky tests, until I get up to
around four times that number.

On a Raspberry Pi, of course, that sensitivity to resource constraints
will manifest much sooner.

This change checks the order of timers firing, rather than the duration
before a timer is fired. This eliminates the sensitivity to resource
constraints. The test can now be moved back to `parallel`. I am able to
run many copies of the test simultaneously without seeing test failures.

PR-URL: https://github.com/nodejs/node/pull/10903
Fixes: https://github.com/nodejs/node/issues/10073
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-01-22 20:58:05 -08:00
Rich Trott
d3eca02576 test: move resource intensive test to sequential
test-fs-readfile-tostring-fail is resource-intensive and is flaky in
CI. Move to sequential tests so it is not competing for resources with
other tests.

PR-URL: https://github.com/nodejs/node/pull/10744
Fixes: https://github.com/nodejs/node/issues/10742
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2017-01-11 17:18:13 -08:00
Gibson Fahnestock
3d2aef3979 test: s/assert.equal/assert.strictEqual/
Use assert.strictEqual instead of assert.equal in tests, manually
convert types where necessary.

PR-URL: https://github.com/nodejs/node/pull/10698
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
2017-01-11 14:19:26 +00:00
Gibson Fahnestock
7a0e462f9f test: use eslint to fix var->const/let
Manually fix issues that eslint --fix couldn't do automatically.

PR-URL: https://github.com/nodejs/node/pull/10685
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2017-01-11 11:43:52 +00:00
Rich Trott
a68987c154 benchmark,lib,test: adjust for linting
Formatting changes for upcoming linter update.

PR-URL: https://github.com/nodejs/node/pull/10561
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
2017-01-06 14:36:01 -08:00
sivaprasanna
8839d504cc test: refactor the code in test-util-debug.js
* use const and let instead of var
* use assert.strictEqual instead of assert.equal
* use arrow functions
* removed unwanted console log

PR-URL: https://github.com/nodejs/node/pull/10531
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2017-01-06 09:49:54 -08:00
Josh Gavant
6ff3b03240 src, inspector: add --inspect-brk option
add an --inspect-brk option which breaks on
first line of user script. same behavior as old
--debug-brk flag.

PR-URL: https://github.com/nodejs/node/pull/8979
Reviewed-By: Eugene Ostroukhov <eostroukhov@chromium.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@keybase.io>
2017-01-03 15:47:40 -08:00
cjihrig
ff1efa6087 test: use const for all require() calls
PR-URL: https://github.com/nodejs/node/pull/10550
Reviewed-By: Rich Trott <rtrott@gmail.com>
2017-01-02 18:28:18 -05:00
Rich Trott
0b33ef80f1 test: fix flaky test-http-client-timeout-with-data
test-http-client-timeout-with-data has failed here and there in CI on
FreeBSD and OS X. The test has a socket timeout set to 50ms and a timer
set for 100ms. However, they are not necessarily set in the same tick of
the event loop and their ordering is therefore not guaranteed.

Instead of using a timer, this change listens for an event on the
listener to know when the socket timeout has occurred and then runs the
code originally in the timer.

Additional refactoring: Replaced `process.on('exit', ...)` checks with
`common.mustCall()` and replaced usage of `assert.equal()` with
`assert.strictEqual()`.

PR-URL: https://github.com/nodejs/node/pull/10431
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-12-30 22:33:31 -08:00
Adrian Estrada
fc103bbdc8 test: improve the code in test-pipe.js
* use const and let instead of var
* use common.mustCall to control functions executions
* use assert.strictEqual instead of assert.equal
* use assert.ifError to handle errors
* use arrow functions
* remove console.log and process.stdout.write

PR-URL: https://github.com/nodejs/node/pull/10452
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-12-27 13:27:17 -05:00
Sakthipriyan Vairamani (thefourtheye)
bf2c49cf71
test: refactor test-init.js
1. Lot of repeating code has been refactored to a function
2. Errors in async calls are properly asserted
3. Fail the test if the callbacks are not fired

PR-URL: https://github.com/nodejs/node/pull/10384
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Julian Duque <julianduquej@gmail.com>
2016-12-23 07:49:42 -05:00
sivaprasanna
5b82800241 test: refactor the code in test-fs-watch.js
* used let and const instead of var
* used assert.strictEqual instead assert.equal

PR-URL: https://github.com/nodejs/node/pull/10357
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Julian Duque <julianduquej@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-12-22 22:56:44 -08:00
Rich Trott
4bdf494d63 test: fix timers-same-timeout-wrong-list-deleted
test-timers-same-timeout-wrong-list-deleted was flaky under load because
there is no guarantee that a timer will fire within a given period of
time. It had an exit handler that checked that the process was finishing
in less than twice as much as a timer was set for. Under load, the
timer could take over 200ms to fire even if it was set for 100ms, so
this was causing the test to be flaky on CI from time to time.

However, that timing check is unnecessary to identify the regression
that the test was written for. When run with a version of Node.js that
does not contain the fix that accompanied the test in its initial
commit, an assertion indicating that there were still timers in the
active timer list fired. So, this commit removes the exit handler timing
check and relies on the existing robust active timers list length check.

This allows us to move the test back to parallel because it does not
seem to fail under load anymore.

The test was refactored slightly, removing duplicated code to a
function, using `assert.strictEqual()` instead of `assert.equal()`,
changing a 10ms timer to 1ms, and improving the messages provided by
assertions.

Fixes: https://github.com/nodejs/node/issues/8459
PR-URL: https://github.com/nodejs/node/pull/10362
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-12-22 16:40:09 -08:00
Rich Trott
cdeb85efc2 test: move long-running test to sequential
test-buffer-creation-regression is flaky on some SmartOS hosts in CI,
timing out. Move to sequential so it does not compete with other tests
for resources. Reduce three test cases to just the one needed to
identify the regression.

PR-URL: https://github.com/nodejs/node/pull/10161
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
2016-12-07 07:35:29 -08:00
Sam Shull
4f486aa661 test: invalid package.json causes error when require()ing in directory
Requiring a file from a directory that contains an invalid package.json
file should throw an error.

PR-URL: https://github.com/nodejs/node/pull/10044
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-12-07 10:00:11 -05:00
Michaël Zasso
cf719152b0 test: refactor test-crypto-timing-safe-equal
Add RegExp arguments to throws assertions.

PR-URL: https://github.com/nodejs/node/pull/9843
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2016-12-01 18:40:33 +01:00
Rich Trott
c7976b537a test: refactor test-next-tick-error-spin
* use common.mustCall()
* setTimeout() -> setImmediate()
* assert() -> assert.strictEqual()
* var -> const
* remove unneeded console.log()
* remove commented-out code

PR-URL: https://github.com/nodejs/node/pull/9537
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-11-12 10:37:54 -08:00
Rich Trott
1ce05ad540 test: move timer-dependent test to sequential
`test-regress-GH-897` is dependent on a timer firing within a period of
time. Especially on some of the FreeBSD hosts on CI, we have seen tests
like that fail when run in parallel. (This may have nothing to do with
FreeBSD and may just mean that the hosts are resource-constrained.) Move
this test to sequential as we have done with several other
timer-dependent tests recently.

The test has also been refactored and documented via comments.

PR-URL: https://github.com/nodejs/node/pull/9487
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
2016-11-09 16:46:16 -08:00
Santiago Gimeno
f8f67d253e
test: fix flaky test-net-GH-5504
The test is failing on `SmartOS` quite often. Removing the timeout seems
to fix it.

Fixes: https://github.com/nodejs/node/issues/8930
PR-URL: https://github.com/nodejs/node/pull/9461
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2016-11-06 09:22:10 +01:00
Rich Trott
9fa94237c8 test: move timer-dependent test to sequential
Timer-dependent tests fail frequently on certain platforms in CI when
run in parallel with other tests, likely due to competition for
resources. Move test-repl-timeout-throw to sequential to avoid this
problem. Also did some minor refactoring (var->const and more use of
assert.strictEqual of looser assertions).

PR-URL: https://github.com/nodejs/node/pull/9431
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Johan Bergstrom <bugs@bergstroem.nu>
2016-11-04 21:32:10 -07:00
cjihrig
49d1c366d8 child_process: remove extra newline in errors
checkExecSyncError() creates error objects for execSync() and
execFileSync(). If the child process created stderr output, then
it is attached to the end of the error message. However, stderr
can be an empty Buffer object, which always passes the truthy
check, leading to an extra newline in the error message. This
commit adds a length check, which will work with both strings and
Buffers.

PR-URL: https://github.com/nodejs/node/pull/9343
Reviewed-By: Wyatt Preul <wpreul@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-11-02 19:25:32 -04:00
Rich Trott
6ef636c0c9 test: fix freebsd10-64 CI failures
Remove unneeded timers from some tests and move others from parallel
testing to sequential testing.

This is to resolve test failures on freebsd10-64 on CI. The failures
are all due to timers firing later than expected. Timers firing later
than they are set for can happen on resource-constrained hosts and is
not a bug.

In general, it may be wise to put tests that depend on timing into
sequential testing rather than parallel testing, as the timing can
be affected by other simultaneously-running test processes.

Fixes: https://github.com/nodejs/node/issues/8041
Fixes: https://github.com/nodejs/node/issues/9227
PR-URL: https://github.com/nodejs/node/pull/9317
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Julien Gilli <jgilli@nodejs.org>
Reviewed-By: Johan Bergstrom <bugs@bergstroem.nu>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2016-10-29 13:11:01 -07:00
Sam Roberts
4d896c44f3 test: prevent workers outliving parent
test-child-process-pass-fd.js parent can exit with an error on failure
to fork, in which case it will leak child processes. Limit child
lifetime to that of parent.

Fixes: https://github.com/nodejs/node/issues/9255
PR-URL: https://github.com/nodejs/node/pull/9257
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-10-27 09:49:06 -07:00
Ben Noordhuis
443e218544 test: use strict assertions in module loader test
Replace calls to assert.equal() and assert.notEqual() with
assert.strictEqual() and assert.strictNotEqual() respectively.

PR-URL: https://github.com/nodejs/node/pull/9263
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2016-10-26 12:13:00 -07:00
cjihrig
a508000093 test: add coverage for execFileSync() errors
This commit adds coverage for errors returned by execFileSync()
when the child process exits with a non-zero code.

PR-URL: https://github.com/nodejs/node/pull/9211
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-10-24 18:35:36 -04:00
Ben Noordhuis
8fca311857 test: add more module loader test coverage
Verify that a package.json without a .main property loads index.js.

PR-URL: https://github.com/nodejs/node/pull/9196
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-10-24 22:48:43 +02:00
Ben Noordhuis
1b8fca16bc test: move flaky test to test/pummel
Move sequential/test-crypto-timing-safe-equal-benchmarks to test/pummel
because it fails for me locally quite frequently and because it takes
about five or six seconds to complete, which is too long for a test in
test/sequential.

Fixes: https://github.com/nodejs/node/issues/8744
PR-URL: https://github.com/nodejs/node/pull/9241
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: not-an-aardvark <not-an-aardvark@users.noreply.github.com>
2016-10-24 22:43:39 +02:00
Rich Trott
150dc5c2e6 test: remove unneeded escaping in template strings
The no-useless-escape rule in ESLint did not previously flag certain
unnecessary escaping in template strings. These will be flagged in
ESLint 3.8.0.

PR-URL: https://github.com/nodejs/node/pull/9112
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-10-18 15:28:21 -07:00
Akito Ito
506cda6ea6 test: cleanup test-net-server-address.js
Refactored test:
- 'var' to 'const'
- functon to arrow function
- using common.mustCall() and common.fail()

PR-URL: https://github.com/nodejs/node/pull/8586
Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-09-29 10:37:54 +03:00
Teddy Katz
b1b1978ec5
tools: add additional ESLint rules
PR-URL: https://github.com/nodejs/node/pull/8643
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@keybase.io>
2016-09-20 23:21:10 -04:00
Dany Shaanan
d469321946 tools: add eslint rule prefer-assert-methods
PR-URL: https://github.com/nodejs/node/pull/8622
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
Reviewed-By: Jackson Tian <shvyo1987@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
2016-09-20 16:35:39 -07:00
not-an-aardvark
c678ecbca0 test: make crypto.timingSafeEqual test less flaky
The `crypto.timingSafeEqual` test still seems to be a bit flaky. This
makes a few changes to the test:

* Separates the basic usage and the benchmarking into different tests

* Moves the timing-sensitive benchmark function into a separate module,
and reparses the module on every iteration of the loop to avoid shared
state between timing measurements.

PR-URL: https://github.com/nodejs/node/pull/8456
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-09-11 21:06:10 -07:00
not-an-aardvark
079acccb56 crypto: add crypto.timingSafeEqual()
Reinstate crypto.timingSafeEqual() which was reverted due to test
issues. The flaky test issues are resolved in this new changeset.

PR-URL: https://github.com/nodejs/node/pull/8304
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-09-07 16:29:41 -07:00
Ben Noordhuis
8e7cbe2546 src: make debugger listen on 127.0.0.1 by default
Commit 2272052 ("net: bind to `::` TCP address by default") from
April 2014 seems to have accidentally changed the default listen
address from 127.0.0.1 to 0.0.0.0, a.k.a. the "any" address.

From a security viewpoint it's undesirable to accept debug agent
connections from anywhere so let's change that back.  Users can
override the default with the `--debug=<host>:<port>` switch.

Fixes: https://github.com/nodejs/node/issues/8081
PR-URL: https://github.com/nodejs/node/pull/8106
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-23 21:10:34 +02:00
James M Snell
0764bc4711 Revert "crypto: add crypto.timingSafeEqual"
This reverts commit 0fc5e0dcd9.

Additional testing indicates that there may still be timing issues
with this implementation. Revert in order to give more time for
testing before this goes out into a release...

Refs: https://github.com/nodejs/node/pull/8040
Refs: https://github.com/nodejs/node/pull/8203
PR-URL: https://github.com/nodejs/node/pull/8225
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-08-23 10:52:32 -07:00
Santiago Gimeno
64cbe7aa9e test: fix flaky test-child-process-pass-fd
Listen on random ports instead of using `common.PORT`.

Fixes: https://github.com/nodejs/node/issues/8209
PR-URL: https://github.com/nodejs/node/pull/8212
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
2016-08-22 15:21:28 -07:00
Santiago Gimeno
db6253f94a child_process: workaround fd passing issue on OS X
There's an issue on some `OS X` versions when passing fd's between processes.
When the handle associated to a specific file descriptor is closed by the sender
process before it's received in the destination, the handle is indeed closed
while it should remain opened. In order to fix this behaviour, don't close the
handle until the `NODE_HANDLE_ACK` is received by the sender.
Added `test-child-process-pass-fd` that is basically `test-cluster-net-send` but
creating lots of workers, so the issue reproduces on `OS X` consistently.

Fixes: https://github.com/nodejs/node/issues/7512
PR-URL: https://github.com/nodejs/node/pull/7572
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-08-20 10:58:28 +02:00
not-an-aardvark
0fc5e0dcd9 crypto: add crypto.timingSafeEqual
PR-URL: https://github.com/nodejs/node/pull/8040
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2016-08-19 19:36:05 -07:00
Evan Lucas
76007079ec Revert "repl,util: insert carriage returns in output"
This reverts commit fce4b981ea.

This was a breaking change and should have been marked semver-major.
The change that was made altered the output of util.format() and
util.inspect(). With how much those are used in the wild, this type of
change deserves more justification.

Fixes: https://github.com/nodejs/node/issues/8138
PR-URL: https://github.com/nodejs/node/pull/8143
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-19 11:48:52 -05:00
Santiago Gimeno
5f617c5f9e test: fix flaky fs-watch tests
`test-fs-watch-recursive` and `test-fs-watch` were both watching the
same folder: `tmp/testsubdir` so running them sequentially on `OS X`
could make `test-fs-watch` to fail due to events generated in the other
test. Make them watch a random directory to fix the issue.

Fixes: https://github.com/nodejs/node/issues/8045
PR-URL: https://github.com/nodejs/node/pull/8115
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-18 09:54:43 -07:00
Rich Trott
8badb67761 test: use strict equality in regression test
Replace `==` with `===` and `assert.strictEqual()` in
test-regress-GH-877.js.

PR-URL: https://github.com/nodejs/node/pull/8098
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2016-08-16 20:51:39 -07:00
JungMinu
fce4b981ea repl,util: insert carriage returns in output
`\n` is not enough for Linux with some custom stream
add carriage returns to ensure that the output is displayed correctly
using `\r\n` should not be a problem, even on non-Windows platforms.

Fixes: https://github.com/nodejs/node/issues/7954
PR-URL: https://github.com/nodejs/node/pull/8028
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-08-13 23:03:30 +09:00
vladimir
320f433dcd util: support classes in util.deprecate()
Classes cannot be instantiated without new, but util.deprecate()
uses Function.prototype.apply(). This commit uses new.target to
detect constructor calls, allowing classes to be deprecated.

PR-URL: https://github.com/nodejs/node/pull/7690
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-08-04 11:44:40 -04:00
Santiago Gimeno
dee0e3a333 test: use common platform helpers everywhere
Use the common.isWindows, common.isFreeBSD and common.isSunOS where
possible.
Add common.isOSX and common.isLinux.
Fix `test-fs-read-file-sync-hostname` as in its current form was not
being run anywhere.

PR-URL: https://github.com/nodejs/node/pull/7845
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-07-27 08:25:26 +02:00
Sakthipriyan Vairamani
612307564b test: make import common as the first line
The `test/common` module has the capability to identify if any variable
is leaked to the global scope and fail the test. So that has to be
imported at the beginning.

PR-URL: https://github.com/nodejs/node/pull/7786
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2016-07-21 16:39:21 -07:00
Robert Chiras
765de1ae11 child_process: Check stderr before accessing it
If something bad happens in spawnSync, stderr might be null. Therefore,
we have to check it before using it, so we won't mask the actual
exception.

PR-URL: https://github.com/nodejs/node/pull/6877
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Robert Jefe Lindstädt <robert.lindstaedt@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-07-19 13:27:30 +02:00