0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 23:16:30 +01:00
nodejs/test/sequential
Jeremiah Senkpiel cbd8d715b2 fs: introduce opendir() and fs.Dir
This adds long-requested methods for asynchronously interacting and
iterating through directory entries by using `uv_fs_opendir`,
`uv_fs_readdir`, and `uv_fs_closedir`.

`fs.opendir()` and friends return an `fs.Dir`, which contains methods
for doing reads and cleanup. `fs.Dir` also has the async iterator
symbol exposed.

The `read()` method and friends only return `fs.Dirent`s for this API.
Having a entry type or doing a `stat` call is deemed to be necessary in
the majority of cases, so just returning dirents seems like the logical
choice for a new api.

Reading when there are no more entries returns `null` instead of a
dirent. However the async iterator hides that (and does automatic
cleanup).

The code lives in separate files from the rest of fs, this is done
partially to prevent over-pollution of those (already very large)
files, but also in the case of js allows loading into `fsPromises`.

Due to async_hooks, this introduces a new handle type of `DIRHANDLE`.

This PR does not attempt to make complete optimization of
this feature. Notable future improvements include:
- Moving promise work into C++ land like FileHandle.
- Possibly adding `readv()` to do multi-entry directory reads.
- Aliasing `fs.readdir` to `fs.scandir` and doing a deprecation.

Refs: https://github.com/nodejs/node-v0.x-archive/issues/388
Refs: https://github.com/nodejs/node/issues/583
Refs: https://github.com/libuv/libuv/pull/2057

PR-URL: https://github.com/nodejs/node/pull/29349
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
2019-10-08 10:34:48 -07:00
..
sequential.status test: unskip tests that now pass on AIX 2019-08-10 19:02:57 -07:00
test-async-wrap-getasyncid.js fs: introduce opendir() and fs.Dir 2019-10-08 10:34:48 -07:00
test-buffer-creation-regression.js
test-child-process-emfile.js child_process: setup stdio on error when possible 2019-05-20 09:33:10 -04:00
test-child-process-execsync.js lib: correct error.errno to always be numeric 2019-06-17 10:18:09 +08:00
test-child-process-exit.js
test-child-process-fork-getconnections.js
test-child-process-pass-fd.js
test-cli-syntax-bad.js benchmark,doc,lib: capitalize more comments 2019-03-27 17:20:06 +01:00
test-cli-syntax-file-not-found.js benchmark,doc,lib: capitalize more comments 2019-03-27 17:20:06 +01:00
test-cli-syntax-good.js benchmark,doc,lib,test: capitalize comments 2019-02-28 18:31:10 +01:00
test-cli-syntax-require.js benchmark,doc,lib: capitalize more comments 2019-03-27 17:20:06 +01:00
test-cluster-inspect-brk.js
test-cluster-net-listen-ipv6only-none.js test: fix flaky test-cluster-net-listen-ipv6only-none 2019-09-30 18:56:17 -07:00
test-cluster-net-listen-ipv6only-rr.js
test-cluster-send-handle-large-payload.js
test-cpu-prof-default.js test: move --cpu-prof tests to sequential 2019-06-16 23:42:58 +08:00
test-cpu-prof-dir-absolute.js test: move --cpu-prof tests to sequential 2019-06-16 23:42:58 +08:00
test-cpu-prof-dir-and-name.js test: move --cpu-prof tests to sequential 2019-06-16 23:42:58 +08:00
test-cpu-prof-dir-relative.js test: move --cpu-prof tests to sequential 2019-06-16 23:42:58 +08:00
test-cpu-prof-dir-worker.js test: move --cpu-prof tests to sequential 2019-06-16 23:42:58 +08:00
test-cpu-prof-drained.js test: move --cpu-prof tests to sequential 2019-06-16 23:42:58 +08:00
test-cpu-prof-exit.js test: move --cpu-prof tests to sequential 2019-06-16 23:42:58 +08:00
test-cpu-prof-invalid-options.js test: move --cpu-prof tests to sequential 2019-06-16 23:42:58 +08:00
test-cpu-prof-kill.js test: move --cpu-prof tests to sequential 2019-06-16 23:42:58 +08:00
test-cpu-prof-name.js test: move --cpu-prof tests to sequential 2019-06-16 23:42:58 +08:00
test-cpu-prof-worker-argv.js test: move --cpu-prof tests to sequential 2019-06-16 23:42:58 +08:00
test-crypto-timing-safe-equal.js crypto: use byteLength in timingSafeEqual 2019-09-25 15:58:15 -03:00
test-debug-prompt.js
test-debugger-debug-brk.js
test-debugger-repeat-last.js
test-deprecation-flags.js benchmark,doc,lib,test: capitalize comments 2019-03-10 00:44:40 +01:00
test-dgram-bind-shared-ports.js benchmark,doc,lib,test: capitalize comments 2019-02-28 18:31:10 +01:00
test-dgram-implicit-bind-failure.js
test-dgram-pingpong.js
test-fs-stat-sync-overflow.js
test-fs-watch.js lib: throw a special error in internal/assert 2019-04-25 01:29:48 +02:00
test-gc-http-client.js
test-heap-prof.js inspector: implement --heap-prof 2019-05-26 22:18:00 +02:00
test-heapdump-flag.js lib,src,doc: add --heapsnapshot-signal CLI flag 2019-04-12 17:16:46 -04:00
test-heapdump.js v8: integrate node-heapdump into core 2019-03-13 15:50:32 +00:00
test-http2-large-file.js test: optimize test-http2-large-file 2019-03-20 09:50:52 -07:00
test-http2-max-session-memory.js
test-http2-ping-flood.js
test-http2-settings-flood.js
test-http2-timeout-large-write-file.js test: clean tmpdir on process exit 2019-08-10 19:22:11 -07:00
test-http2-timeout-large-write.js
test-http-econnrefused.js benchmark,doc,lib,test: capitalize comments 2019-02-28 18:31:10 +01:00
test-http-keep-alive-large-write.js
test-http-keepalive-maxsockets.js benchmark,doc,lib: capitalize more comments 2019-03-27 17:20:06 +01:00
test-http-max-http-headers.js http: remove legacy parser 2019-09-20 20:18:35 +02:00
test-http-max-sockets.js
test-http-regr-gh-2928.js async_hooks: fixup do not reuse HTTPParser 2019-05-03 16:02:55 +02:00
test-http-server-consumed-timeout.js
test-http-server-keep-alive-timeout-slow-client-headers.js
test-http-server-keep-alive-timeout-slow-server.js
test-https-connect-localport.js test: refactor test-https-connect-localport 2019-03-24 07:56:25 -07:00
test-https-keep-alive-large-write.js
test-https-server-keep-alive-timeout.js
test-init.js
test-inspector-async-call-stack-abort.js test: remove usage of process.binding() 2019-03-07 17:43:21 +01:00
test-inspector-async-call-stack.js
test-inspector-async-hook-setup-at-inspect-brk.js
test-inspector-async-hook-setup-at-signal.js test: remove usage of process.binding() 2019-03-07 17:43:21 +01:00
test-inspector-async-stack-traces-promise-then.js
test-inspector-async-stack-traces-set-interval.js
test-inspector-break-e.js
test-inspector-break-when-eval.js
test-inspector-console.js
test-inspector-contexts.js
test-inspector-debug-brk-flag.js
test-inspector-debug-end.js test: switch assertEqual arguments 2019-05-30 08:45:42 +02:00
test-inspector-enabled.js
test-inspector-exception.js
test-inspector-has-inspector-false.js
test-inspector-invalid-args.js src: simplify DEP0062 logic 2019-07-09 16:50:59 -04:00
test-inspector-ip-detection.js
test-inspector-module.js errors: add more information in case of invalid callbacks 2019-04-04 12:51:03 +02:00
test-inspector-not-blocked-on-idle.js
test-inspector-open.js
test-inspector-overwrite-config.js
test-inspector-port-cluster.js
test-inspector-port-zero.js
test-inspector-resource-name-to-url.js
test-inspector-runtime-evaluate-with-timeout.js
test-inspector-scriptparsed-context.js
test-inspector-stop-profile-after-done.js
test-inspector-stops-no-file.js
test-inspector-stress-http.js
test-inspector.js benchmark,doc,lib,test: capitalize comments 2019-03-10 00:44:40 +01:00
test-module-loading.js lib: no need to strip BOM or shebang for scripts 2019-06-01 10:01:15 -04:00
test-net-better-error-messages-port.js
test-net-bytes-per-incoming-chunk-overhead.js test: increase limit for network space overhead test 2019-07-15 00:29:19 +02:00
test-net-connect-handle-econnrefused.js test: refactor net-connect-handle-econnrefused 2019-04-27 08:21:51 +02:00
test-net-connect-local-error.js
test-net-GH-5504.js
test-net-listen-shared-ports.js benchmark,doc,lib,test: capitalize comments 2019-03-10 00:44:40 +01:00
test-net-localport.js
test-net-reconnect-error.js
test-net-response-size.js
test-net-server-address.js
test-net-server-bind.js
test-next-tick-error-spin.js
test-perf-hooks.js test: rename test-performance to test-perf-hooks 2019-06-01 16:48:24 +05:30
test-performance-eventloopdelay.js src: fix closing weak HandleWraps on GC 2019-09-21 13:53:25 -07:00
test-pipe.js
test-process-warnings.js
test-repl-timeout-throw.js benchmark,doc,lib,test: capitalize comments 2019-03-10 00:44:40 +01:00
test-require-cache-without-stat.js
test-set-http-max-http-headers.js http: remove legacy parser 2019-09-20 20:18:35 +02:00
test-stream2-fs.js
test-stream2-stderr-sync.js benchmark,doc,lib: capitalize more comments 2019-03-27 17:20:06 +01:00
test-stream-writable-clear-buffer.js
test-timers-block-eventloop.js
test-timers-blocking-callback.js benchmark,doc,lib,test: capitalize comments 2019-02-28 18:31:10 +01:00
test-timers-set-interval-excludes-callback-duration.js
test-tls-connect.js test: move test_[key|ca|cert] to fixtures/keys/ 2019-06-10 09:56:55 -07:00
test-tls-lookup.js
test-tls-securepair-client.js test: remove uneeded agent keypair in fixtures/ 2019-06-10 09:57:28 -07:00
test-tls-session-timeout.js test: remove uneeded agent keypair in fixtures/ 2019-06-10 09:57:28 -07:00
test-util-debug.js
test-vm-timeout-rethrow.js
testcfg.py