Граф коммитов

48 Коммитов

Автор SHA1 Сообщение Дата
Jeremiah Senkpiel 52bae222a3 test: abstract skip functionality to common
The tap skipping output is so prevalent yet obscure in nature that we
ought to move it into it's own function in test/common.js

PR-URL: https://github.com/nodejs/node/pull/6697
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2016-05-12 16:43:35 -04:00
Rich Trott a56da51a38 benchmark,test,lib: remove extra spaces
In preparation for stricter linting, remove extra spaces.

PR-URL: https://github.com/nodejs/node/pull/6645
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-05-11 23:18:16 -07:00
Ben Noordhuis f644368e7c test: build addons with V8_DEPRECATION_WARNINGS=1
PR-URL: https://github.com/nodejs/node/pull/6652
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-05-10 17:10:08 +02:00
Rich Trott 6c49714df0 test,tools: limit lint tolerance of gc global
Lint rules permitted the `gc` global in any test file. This change
limits it to just the files that need it.

PR-URL: https://github.com/nodejs/node/pull/6324
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-04-28 19:22:16 -07:00
Ali Ijaz Sheikh b73e1b3c5a test: fix another flaky stringbytes test
Avoid depending on precise timing of when an object will be collected
by GC. This test was missed by #6039 as it happened to be in a
different directory than the rest.

Ref: https://github.com/nodejs/node/pull/6039
PR-URL: https://github.com/nodejs/node/pull/6073
Reviewed-By: Trott - Rich Trott <rtrott@gmail.com>
2016-04-06 06:22:40 -07:00
Ali Ijaz Sheikh f4ebd5989a test: fix flakiness of stringbytes-external
The tests used to rely on precise timing of when a JavaScript object
would be garbage collected to ensure that there is enough memory
available on the system. Switch the test to use a malloc/free pair
instead.

Ref: https://github.com/nodejs/node/pull/5945
PR-URL: https://github.com/nodejs/node/pull/6039
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Reviewed-By: evanlucas - Evan Lucas <evanlucas@me.com>
Reviewed-By: Trott - Rich Trott <rtrott@gmail.com>
2016-04-05 16:08:45 -07:00
Anna Henningsen be97db92af test: add buffer alignment regression tests
Buffers instances can have arbitrary alignment. `node-ffi` depends on
this. Add some regression tests to ensure we don't break this in the
future.

PR-URL: https://github.com/nodejs/node/pull/5752
Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com>
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
2016-03-19 07:08:08 -07:00
Trevor Norris ab6fe5998a test: add addons test for MakeCallback
Make sure that calling MakeCallback multiple times within the same stack
does not allow the nextTickQueue or MicrotaskQueue to be processed in
any more than the first MakeCallback call.

Check that domains enter/exit poperly with multiple MakeCallback calls
and that errors are handled as expected

PR-URL: https://github.com/nodejs/node/pull/4507
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2016-02-12 14:03:34 -07:00
Rich Trott bc39d6a3a6 test: remove unused vars
Remove unused vars in tests

PR-URL: https://github.com/nodejs/node/pull/4536
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-01-05 08:59:58 -08:00
Rich Trott 6abd8b587e test: remove unused modules
Many tests use require() to import modules that subsequently never gets
used. This removes those imports and, in a few cases, removes other
unused variables from tests.

PR-URL: https://github.com/nodejs/node/pull/4475
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2016-01-01 16:37:02 -08:00
Rich Trott a030c5cf49 test: remove unused assert module imports
Many test modules load assert but do not use it. This change removes
those instances.

It also removes a handful of other unused variables when they were
nearby.

PR-URL: https://github.com/nodejs/node/pull/4438
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-12-30 11:45:34 -08:00
Michael Cornacchia c0bac95147 test: fix path to module for repl test on Windows
Use path join to construct the path instead of concatenating strings.
Replace backslash with double backslash so that they are escaped
correctly in the string passed to REPL.

PR-URL: https://github.com/nodejs/node/pull/3608
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-11-15 16:33:11 -08:00
Rich Trott 35f2f64edd tools: Use `throw new Error()` consistently
In preparation for a lint rule that will enforce `throw new Error()`
over `throw Error()`, fix the handful of instances in the code that
use `throw Error()`.

PR-URL: https://github.com/nodejs/node/pull/3714
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-11-10 21:00:35 -08:00
Fedor Indutny 827ee498e3 buffer: neuter external `nullptr` buffers
Neuter external `nullptr` buffers, otherwise their contents will be
materialized on access, and the buffer instance will be internalized.

This leads to a crash like this:

    v8::ArrayBuffer::Neuter Only externalized ArrayBuffers can be
    neutered

Fix: #3619
PR-URL: https://github.com/nodejs/node/pull/3624
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-11-02 08:37:38 -05:00
Junliang Yan 9f967058e8 test: fix heap-profiler link error LNK1194 on win
Fix the following error message in windows using VS 2013:

    LINK : fatal error LNK1194: cannot delay-load 'node.exe'
    due to import of data symbol '"__declspec(dllimport)
    const v8::OutputStream::`vftable'"
    (__imp_??_7OutputStream@v8@@6B@)'; link without
    /DELAYLOAD:node.exe

PR-URL: https://github.com/nodejs/node/pull/3572
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-10-28 21:13:34 +01:00
Junliang Yan 4139f2a820 test: fix missing unistd.h on windows
PR-URL: https://github.com/nodejs/node/pull/3532
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-10-28 20:58:38 +01:00
Ben Noordhuis 3a091d29bf test: add node::MakeCallback() test coverage
PR-URL: https://github.com/nodejs/node/pull/3478
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-10-23 18:43:06 +02:00
Fedor Indutny 931118c9d7 buffer: fix assertion error in WeakCallback
`CallbackInfo` is now bound to `ArrayBuffer` instance, not `Uint8Array`,
therefore `SPREAD_ARG` will abort with:

    Assertion failed: ((object)->IsUint8Array())

Make changes necessary to migrate it to `ArrayBuffer`.

See: https://github.com/nodejs/node/pull/3080#issuecomment-147502167

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/3329
2015-10-12 20:47:10 -07:00
Rich Trott 6f63a4af0e test: linting for buffer-free-callback test
Test added in d1f24044 does not pass linting rule added in 3de353b5.
Fixed in this commit. `common` module required in all tests except
those that intentionally leak variables.

PR-URL: https://github.com/nodejs/node/pull/3230
Fixes: https://github.com/nodejs/node/issues/3229
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-10-06 21:35:00 -07:00
Fedor Indutny d1f24044b9 buffer: FreeCallback should be tied to ArrayBuffer
FreeCallback should be invoked on the storage disposal (`ArrayBuffer`),
not when the view (`Uint8Array` or `Buffer`) is disposed. This causes
bug and crashes in addons which create buffers and store only slices of
them.

PR-URL: https://github.com/nodejs/node/pull/3198
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-10-06 18:57:46 -04:00
Rich Trott c78091d689 test: load common.js in all tests
common.js contains code that detects leaked variables.

In preparation for an eslint rule that will enforce loading common.js in
test files, load it everywhere it can be loaded and use an
`eslint-disable` comment for files that intentionally leak.

PR-URL: https://github.com/nodejs/node/pull/3157
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-10-06 15:11:47 -07:00
Justin Chase 8593b3e8eb module: use UNC paths when loading native addons
When using require to load a native addon the path must be converted
into a long path, otherwise the addon will fail to be loaded on
windows if the path is longer than 260 characters.

PR-URL: https://github.com/nodejs/node/pull/2965
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Benjamin Gruenbaum <inglor@gmail.com>
2015-10-05 22:09:51 +02:00
Michaël Zasso 4abc896a82 src: replace usage of v8::Handle with v8::Local
v8::Handle is deprecated: https://codereview.chromium.org/1224623004

PR-URL: https://github.com/nodejs/io.js/pull/2202
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-09-06 21:38:05 +10:00
Ben Noordhuis 1aa9d3a2ab build: make ci test addons in test/addons
Make `make test-addons` part of the `make test-ci` target.

Use order-only prerequisites to make generating and building the add-ons
concurrency-safe when $JOBS > 1 and fudge the dependency on $(NODE_EXE)
so that add-ons are only rebuilt when needed instead of all the time.

PR-URL: https://github.com/nodejs/node/pull/2428
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-08-25 12:03:57 +02:00
Ben Noordhuis 71119284f9 test: drop Isolate::GetCurrent() from addon tests
v8::Isolate::GetCurrent() is not exactly deprecated at this point but
its use is strongly discouraged.  Update the addon tests so they no
longer use it.

PR-URL: https://github.com/nodejs/node/pull/2427
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-08-18 21:27:43 +02:00
Ben Noordhuis 8f4022e44b test: lint addon tests
Add files in test/addon to the `make cpplint` rule and fix up existing
style issues.  Tests scraped from doc/api/addon.md are filtered out
because those are predominantly for illustrative purposes.

PR-URL: https://github.com/nodejs/node/pull/2427
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-08-18 21:27:43 +02:00
Ben Noordhuis 70d1f32f56 deps: update v8 to 4.4.63.9
Upgrade the bundled V8 and update code in src/ and lib/ to the new API.

Notable backwards incompatible changes are the removal of the smalloc
module and dropped support for CESU-8 decoding.  CESU-8 support can be
brought back if necessary by doing UTF-8 decoding ourselves.

This commit includes https://codereview.chromium.org/1192973004 to fix
a build error on python 2.6 systems.  The original commit log follows:

    Use optparse in js2c.py for python compatibility

    Without this change, V8 won't build on RHEL/CentOS 6 because the
    distro python is too old to know about the argparse module.

PR-URL: https://github.com/nodejs/io.js/pull/2022
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-08-04 11:56:14 -07:00
Ben Noordhuis e0e96acc6f test: remove smalloc add-on test
The smalloc module is about to be deprecated and removed.  Remove the
add-on test now so it's not forgotten about in the upcoming purge.

PR-URL: https://github.com/nodejs/io.js/pull/1835
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-06-01 23:17:52 +02:00
Ben Noordhuis 4e90c82cdb test: add heap profiler add-on regression test
Add a regression test for https://github.com/nodejs/io.js/pull/1827.

PR-URL: https://github.com/nodejs/io.js/pull/1828
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-05-28 22:01:10 +02:00
Ben Noordhuis 280fb01daf test: fix deprecation warning in addons test
The non-isolate version of node::FatalException() is deprecated, switch
to the version that takes an isolate as its first argument.

PR-URL: https://github.com/nodejs/io.js/pull/1793
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-05-26 17:17:38 +02:00
Roman Reiss f29762f4dd test: enable linting for tests
Enable linting for the test directory. A number of changes was made so
all tests conform the current rules used by lib and src directories. The
only exception for tests is that unreachable (dead) code is allowed.

test-fs-non-number-arguments-throw had to be excluded from the changes
because of a weird issue on Windows CI.

PR-URL: https://github.com/nodejs/io.js/pull/1721
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-19 21:21:27 +02:00
Trevor Norris 26ebe9805e smalloc: extend user API
node::Environment isn't accessible to user APIs, so extend smalloc to
also accept v8::Isolate.

Fixes: 75adde07 "src: remove `node_isolate` from source"
PR-URL: https://github.com/iojs/io.js/pull/905
Reviewed-by: Fedor Indutny <fedor@indutny.com>
2015-02-20 11:02:33 -07:00
isaacs 3e1b1dd4a9 Remove excessive copyright/license boilerplate
The copyright and license notice is already in the LICENSE file.  There
is no justifiable reason to also require that it be included in every
file, since the individual files are not individually distributed except
as part of the entire package.
2015-01-12 15:30:28 -08:00
Trevor Norris 81a9739108 node,async-wrap: verify domain enter/exit are set
The REPL global object lazy loads modules by placing getters for each.
This causes MakeDomainCallback() to be run if a native module is loaded
from the REPL, but if the domain module hasn't been loaded then there
are no enter/exit callbacks to be called. Causing an assert() to fail.

Fix the issue by conditionally running the callback instead of asserting
it is available. Also add "addon" test to verify the fix.

Fixes: #8231
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-09-02 11:30:45 -07:00
Ben Noordhuis 1f17f88071 src, test: fix up ObjectWrap, `make test-addons`
V8 was upgraded from 3.22 to 3.24 in commit 1c7bf24.  Upgrade source
files in test/addons/ and automatically generated tests from
doc/api/addons.markdown to the new V8 API.

This coincidentally fixes a bug in src/node_object_wrap.h where it was
still using the old V8 weak persistent handle interface, which is gone
in 3.24.
2014-03-14 00:41:04 +04:00
Fedor Indutny 1442c1c6de addons: build and test examples
fix #6910
2014-01-22 00:39:13 +04:00
Nathan Rajlich 50c88e0ff2 test: modify async native test.js to test for #4820 2013-02-21 13:14:07 -08:00
Nathan Rajlich 4b61522f16 test: add an "async-hello-world" native addon test 2013-02-21 13:14:07 -08:00
isaacs 15508589a1 addon: Pass module object to NODE_MODULE init function
mainly to allow native addons to export single functions on
rather than being restricted to operating on an existing
object.

Init functions now receive exports as the first argument, like
before, but also the module object as the second argument, if they
support it.

Related to #4634

cc: @rvagg
2013-01-25 14:25:35 -08:00
Ben Noordhuis 078763a94c test: update addons .gitignore 2012-05-24 14:07:09 +02:00
Ben Noordhuis e4a8d2617b addon: add AtExit() function
Lets native addons register exit hooks that run after the event loop has quit
but before the VM is killed.

Fixes #3147.
2012-05-03 16:11:42 +02:00
Shigeki Ohtsu d2fba2bf35 test: Fix path to require hello-world module 2012-03-14 11:00:52 -07:00
Nathan Rajlich aa35564ca1 Use NODE_MODULE in the hello-world addon example.
Fixes Windows throwing "unknown error" when trying to require the .node file.
2012-02-27 02:44:33 +01:00
Ben Noordhuis 74a8215a86 Revert support for isolates.
It was decided that the performance benefits that isolates offer (faster spin-up
times for worker processes, faster inter-worker communication, possibly a lower
memory footprint) are not actual bottlenecks for most people and do not outweigh
the potential stability issues and intrusive changes to the code base that
first-class support for isolates requires.

Hence, this commit backs out all isolates-related changes.

Good bye, isolates. We hardly knew ye.
2012-02-06 15:44:42 +01:00
Ryan Dahl 5fc0c27d5c move isolate V8 functions out of node.cc 2011-12-29 01:56:11 +01:00
Ryan Dahl 40c98a977b Add shared-buffer isolate addon test 2011-12-29 01:56:11 +01:00
Ryan Dahl 6ac22bfb04 Add gitignore file for addon tests 2011-12-21 14:18:56 -08:00
Ryan Dahl 18b92201be Support addons with gyp
Initial pass.
2011-12-20 22:03:35 -08:00