summaryrefslogtreecommitdiff
path: root/test/testpy
AgeCommit message (Collapse)Author
2019-10-20test: fix test runner for Python 3 on WindowsMichaël Zasso
Explicitly open files with utf8 encoding, otherwise the system could use another encoding such as latin1 by default. PR-URL: https://github.com/nodejs/node/pull/30023 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Christian Clauss <cclauss@me.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-04-13tools: python: ignore instead of select flake8 rulesRefael Ackermann
PR-URL: https://github.com/nodejs/node/pull/25614 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-12-23test: remove Files: comment processing from Python test runnerRich Trott
We don't use any Files: comments in our tests so remove the Python code for it from test/testpy/__init__.py. PR-URL: https://github.com/nodejs/node/pull/25183 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-12-17build: add a space to clarify skipping crypto msgDaniel Bevenius
This commit adds a space to the message that is displayed for tests that are skipped when node was built --without-ssl. For example, this is what is currently displayed: "release test-https-agent-additional-optionsSkipping as node was compiled without crypto support" After this change this will be: "release test-https-agent-additional-options: Skipping as node was compiled without crypto support" PR-URL: https://github.com/nodejs/node/pull/25011 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-12-13test: from functools import reduce in test/testpy/__init__.pycclauss
$ __make lint-py__ # When run on Python 3 ``` PYTHONPATH=tools/pip python -m flake8 . \ --count --show-source --statistics --select=E901,E999,F821,F822,F823 \ --exclude=.git,deps,lib,src,tools/*_macros.py,tools/gyp,tools/inspector_protocol,tools/jinja2,tools/markupsafe,tools/pip ./test/testpy/__init__.py:119:37: F821 undefined name 'reduce' file_path = join(self.root, reduce(join, test[1:], "")) ^ ./test/testpy/__init__.py:161:37: F821 undefined name 'reduce' file_path = join(self.root, reduce(join, test[1:], "") + ".js") ^ 2 F821 undefined name 'reduce' 2 make: *** [lint-py] Error 1 ``` PR-URL: https://github.com/nodejs/node/pull/24954 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-11-18test: skip test that use --tls-v1.x flagsDaniel Bevenius
Currently, configuring --without-ssl will cause the following test to fail: === release test-https-agent-additional-options === Path: parallel/test-https-agent-additional-options out/Release/node: bad option: --tls-v1.1 Command: out/Release/node --tls-v1.1 /node/test/parallel/test-https-agent-additional-options.js === release test-https-agent-session-eviction === Path: parallel/test-https-agent-session-eviction out/Release/node: bad option: --tls-v1.0 Command: out/Release/node --tls-v1.0 /node/test/parallel/test-https-agent-session-eviction.js This commit adds a check for the --tls-v.x flags and skips them if node was built without crypto support. PR-URL: https://github.com/nodejs/node/pull/24376 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org>
2018-10-16tools,test: cleanup and dedup codeRefael Ackermann
* Hoist common code to base class (`GetTestStatus`, and the `section` property to `TestConfiguration`) * Replace ListSet with the built in set * Remove ClassifiedTest * Inline PrintReport * How cases_to_run are filtered PR-URL: https://github.com/nodejs/node/pull/23251 Reviewed-By: Rich Trott <rtrott@gmail.com>
2018-07-30test: remove custom AsyncHooksTestConfigurationJon Moss
Has the same behavior as `ParallelTestConfiguration` PR-URL: https://github.com/nodejs/node/pull/22008 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-12-11test: simplify common.PORT codeRich Trott
common.PORT is no longer used in parallelized tests and should not be. Remove code that accommodates parallelized tests. PR-URL: https://github.com/nodejs/node/pull/17559 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-09-07module: Allow runMain to be ESMBradley Farias
This follows the EPS an allows the node CLI to have ESM as an entry point. `node ./example.mjs`. A newer V8 is needed for `import()` so that is not included. `import.meta` is still in specification stage so that also is not included. PR-URL: https://github.com/nodejs/node/pull/14369 Author: Bradley Farias <bradley.meck@gmail.com> Author: Guy Bedford <guybedford@gmail.com> Author: Jan Krems <jan.krems@groupon.com> Author: Timothy Gu <timothygu99@gmail.com> Author: Michaël Zasso <targos@protonmail.com> Author: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2017-08-26test: run abort testsRich Trott
Currently, tests in test/abort do not run in CI. This change configures the test runner to not write core files for abort tests and to run them. PR-URL: https://github.com/nodejs/node/pull/14013 Fixes: https://github.com/nodejs/node/issues/14012 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2017-05-10test: adding tests for initHooks APIThorsten Lorenz
Async wrap providers tested: - crypto.randomBytes - crypto.pbkdf2 - fs event wrap - fsreqwrap access - fsreqwrap readFile - getaddrinforeq wrap - getnameinforeq wrap - pipe connect wrap - query wrap - pipewrap - processwrap - shutdown wrap - tcpwrap - udpwrap - send wrap - detailed signal wrap - statwatcher - timerwrap via setTimeout - timerwrap via setInterval - for Immediate - http parser request - http parser response - connection via ssl server - tls wrap - write wrap - ttywrap via readstream - ttywrap via wriream - zctx via zlib binding deflate Embedder API: - async-event tests - one test looks at the happy paths - another ensures that in cases of events emitted in an order that doesn't make sense, the order is enforced by async hooks throwing a meaningful error - embedder enforcement tests are split up since async hook stack corruption now the process - therefore we launch a child and check for error output of the offending code Additional tests: - tests that show that we can enable/disable hooks inside their lifetime events - tests that verify the graph of resources triggering the creation of other resources Test Helpers: - init-hooks: - returns one collector instance - when created an async hook is created and the lifetime events are registered to call the appropriate collector functions - the collector also exposes `enable` and `disable` functions which call through to the async hook - hook checks: - checks invocations of life time hooks against the actual invocations that were collected - in some cases like `destroy` a min/max range of invocations can be supplied since in these cases the exact number is non-deterministic - verify graph: - verifies the triggerIds of specific async resources are as expected, i.e. the creation of resources was triggered by the resource we expect - includes a printGraph function to generate easily readable test input for verify graph - both functions prune TickObjects to create less brittle and easier to understand tests PR-URL: https://github.com/nodejs/node/pull/12892 Ref: https://github.com/nodejs/node/pull/11883 Ref: https://github.com/nodejs/node/pull/8531 Reviewed-By: Andreas Madsen <amwebdk@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2017-05-08test: remove unused testpy codeRich Trott
The temporary directory for tests is managed in the JS `common` module. Remove unused variable from `testpy` that is legacy from when it was managed in the Python test harness. PR-URL: https://github.com/nodejs/node/pull/12844 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Cai <davidcai1993@yahoo.com>
2017-05-03test: move WPT to its own testing moduleRich Trott
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-04-20test: skip tests using ca flagsDaniel Bevenius
Currently when building --without-ssl there is a failure due to a change made by me in commit 3cf88a45e86f28dcc72c730adf4ead919ab882bd ("test: add --use-bundled-ca to tls-cnnic-whitelist") which added a '--use-bundled-ca' flag to that test. But when building --without-ssl that flag will be invalid and an error (bad option) will be reported. This commit filters tests that specify the --use-bundled-ca or --use-openssl-ca flags so that they are skipped when configured --without-ssl. PR-URL: https://github.com/nodejs/node/pull/12485 Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-03n-api: add support for abi stable module APIJason Ginchereau
Add support for abi stable module API (N-API) as "Experimental feature". The goal of this API is to provide a stable Node API for native module developers. N-API aims to provide ABI compatibility guarantees across different Node versions and also across different Node VMs - allowing N-API enabled native modules to just work across different versions and flavors of Node.js without recompilation. A more detailed introduction is provided in: https://github.com/nodejs/node-eps/blob/master/005-ABI-Stable-Module-API.md and https://github.com/nodejs/abi-stable-node/blob/doc/VM%20Summit.pdf. The feature, during its experimental state, will be guarded by a runtime flag "--napi-modules". Only when this flag is added to the command line will N-API modules along with regular non N-API modules be supported. The API is defined by the methods in "src/node_api.h" and "src/node_api_types.h". This is the best starting point to review the API surface. More documentation will follow. In addition to the implementation of the API using V8, which is included in this PR, the API has also been validated against chakracore and that port is available in https://github.com/nodejs/abi-stable-node/tree/api-prototype-chakracore-8.x. The current plan is to provide N-API support in versions 8.X and 6.X directly. For older versions, such as 4.X or pre N-API versions of 6.X, we plan to create an external npm module to provide a migration path that will allow modules targeting older Node.js versions to use the API, albeit without getting the advantage of not having to recompile. In addition, we also plan an external npm package with C++ sugar to simplify the use of the API. The sugar will be in-line only and will only use the exported N-API methods but is not part of the N-API itself. The current version is in: https://github.com/nodejs/node-api. This PR is a result of work in the abi-stable-node repo: https://github.com/nodejs/abi-stable-node/tree/doc, with this PR being the cumulative work on the api-prototype-8.x branch with the following contributors in alphabetical order: Author: Arunesh Chandra <arunesh.chandra@microsoft.com> Author: Gabriel Schulhof <gabriel.schulhof@intel.com> Author: Hitesh Kanwathirtha <hiteshk@microsoft.com> Author: Ian Halliday <ianhall@microsoft.com> Author: Jason Ginchereau <jasongin@microsoft.com> Author: Michael Dawson <michael_dawson@ca.ibm.com> Author: Sampson Gao <sampsong@ca.ibm.com> Author: Taylor Woll <taylor.woll@microsoft.com> PR-URL: https://github.com/nodejs/node/pull/11975 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-03-04test: make tests pass when configured without-sslDaniel Bevenius
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>
2016-09-23src: add /json/protocol endpoint to inspectorBen Noordhuis
Embed the compressed and minified protocol.json from the bundled v8_inspector and make it available through the /json/protocol endpoint. Refs: https://github.com/nodejs/diagnostics/issues/52 PR-URL: https://github.com/nodejs/node/pull/7491 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-07-08tools: remove unnecessary imports and assignmentsSakthipriyan Vairamani
PR-URL: https://github.com/nodejs/node/pull/7483 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2015-09-15test: fix default value for additional paramSakthipriyan Vairamani
In Python, the default values of parameters are evaluated only once during their declaration. So, whenever the default parameter is used the same object will be used. Since we use a list, which is a mutable object, this could lead to unexpected results. PR-URL: https://github.com/nodejs/node/pull/2553 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-06-12test: create temp dir in common.jsRich Trott
Move creation of temporary directories for tests out of the Python harness and into common.js. This allows all tests to be run reliably outside of the Python wrapper. PR-URL: https://github.com/nodejs/io.js/pull/1877 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-01-12test: fix `make test-addons` targetBen Noordhuis
I broke the python script in commit edaf7af but because test-all does not run test-addons, it slipped under the radar. Mea culpa. Fixes the following test runner error: Traceback (most recent call last): File "tools/test.py", line 1522, in <module> sys.exit(Main()) File "tools/test.py", line 1454, in Main test_list = root.ListTests([], path, context, arch, mode) File "tools/test.py", line 720, in ListTests test.AddTestsToList(result, full_path, path, context, arch, mode) File "tools/test.py", line 690, in AddTestsToList arch, mode) File "/home/bnoordhuis/src/v1.x/test/gc/../testpy/__init__.py", line 176, in ListTests result.append(SimpleTestCase(test, file_path, mode, self.context, self)) TypeError: __init__() takes at least 7 arguments (6 given) PR-URL: https://github.com/iojs/io.js/pull/313 Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2014-12-17test: run tests in parallel, common improvementsFedor Indutny
* Allow running tests in mixed parallel/sequential modes * Add -J flag for running tests on all available CPUs * Support TEST_THREAD_ID in test/common.js and use it for tmpDir and PORT * make: use -J flag Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> PR-URL: https://github.com/iojs/io.js/pull/172 Fix: iojs/io.js#139
2014-10-16test: make test runner multi-arch/mode compatibleBen Noordhuis
Make `python tools/test.py --arch=ia32,x64 --mode=debug,release` work. The test runner looks for the `node` binary in `out/${arch}.${mode}/`. Running tools/test.py without --arch makes it use `out/Release/node` or `out/Debug/node` like before. This commit removes `test/simple/test-executable-path.js` because the assumptions it makes about the locations of the debug and release binaries are now outdated. PR-URL: https://github.com/node-forward/node/pull/24 Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-01-22addons: build and test examplesFedor Indutny
fix #6910
2014-01-20test: refactor to use common testcfgTimothy J Fontaine