summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authordecareano <marcelo.gobelli@gmail.com>2017-07-16 22:56:46 -0700
committerTobias Nießen <tniessen@tnie.de>2017-07-21 15:53:45 +0200
commit27343cc051e05023f79db980fefb365fa29af37c (patch)
treefe8c63f0dd92c0f8307f71b9f1e1067a653fb8d4 /test
parent201e756ef147a760064f43fd587c4467e1dbe52e (diff)
downloadnode-new-27343cc051e05023f79db980fefb365fa29af37c.tar.gz
test: delete obsolete test-sendfd.js
This test was disabled in 2011 and is no longer useful without modifications. PR-URL: https://github.com/nodejs/node/pull/14334 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/disabled/test-sendfd.js146
1 files changed, 0 insertions, 146 deletions
diff --git a/test/disabled/test-sendfd.js b/test/disabled/test-sendfd.js
deleted file mode 100644
index bc42569c38..0000000000
--- a/test/disabled/test-sendfd.js
+++ /dev/null
@@ -1,146 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-'use strict';
-// Test sending and receiving a file descriptor.
-//
-// This test is pretty complex. It ends up spawning test/fixtures/recvfd.js
-// as a child to test desired behavior. What happens is
-//
-// 1. Create an in-memory pipe via pipe(2). These two file descriptors
-// are not visible to any other process, and so make a good test-case
-// for sharing.
-// 2. Create a a UNIX socket at SOCK_PATH. When a client connects to this
-// path, they are sent the write end of the pipe from above.
-// 3. The client is sent n JSON representations of the DATA variable, each
-// with a different ordinal. We send these delimited by '\n' strings
-// so that the receiving end can avoid any coalescing that happens
-// due to the stream nature of the socket (e.g. '{}{}' is not a valid
-// JSON string).
-// 4. The child process receives file descriptors and JSON blobs and,
-// whenever it has at least one of each, writes a modified JSON blob
-// to the FD. The blob is modified to include the child's process ID.
-// 5. Once the child process has sent n responses, it closes the write end
-// of the pipe, which signals to the parent that there is no more data
-// coming.
-// 6. The parent listens to the read end of the pipe, accumulating JSON
-// blobs (again, delimited by '\n') and verifying that a) the 'pid'
-// attribute belongs to the child and b) the 'ord' field has not been
-// seen in a response yet. This is intended to ensure that all blobs
-// sent out have been relayed back to us.
-
-const common = require('../common');
-const assert = require('assert');
-
-const child_process = require('child_process');
-const fs = require('fs');
-const net = require('net');
-var netBinding = process.binding('net');
-const path = require('path');
-
-var DATA = {
- 'ppid' : process.pid,
- 'ord' : 0
-};
-
-var SOCK_PATH = path.join(__dirname,
- '..',
- path.basename(__filename, '.js') + '.sock');
-
-var logChild = function(d) {
- if (typeof d == 'object') {
- d = d.toString();
- }
-
- d.split('\n').forEach(function(l) {
- if (l.length > 0) {
- console.error('CHILD: ' + l);
- }
- });
-};
-
-// Create a pipe
-//
-// We establish a listener on the read end of the pipe so that we can
-// validate any data sent back by the child. We send the write end of the
-// pipe to the child and close it off in our process.
-var pipeFDs = netBinding.pipe();
-assert.strictEqual(pipeFDs.length, 2);
-
-var seenOrdinals = [];
-
-var pipeReadStream = new net.Stream();
-pipeReadStream.on('data', function(data) {
- data.toString('utf8').trim().split('\n').forEach(function(d) {
- var rd = JSON.parse(d);
-
- assert.strictEqual(rd.pid, cpp);
- assert.strictEqual(seenOrdinals.includes(rd.ord), false)
-
- seenOrdinals.unshift(rd.ord);
- });
-});
-pipeReadStream.open(pipeFDs[0]);
-pipeReadStream.resume();
-
-// Create a UNIX socket at SOCK_PATH and send DATA and the write end
-// of the pipe to whoever connects.
-//
-// We send two messages here, both with the same pipe FD: one string, and
-// one buffer. We want to make sure that both datatypes are handled
-// correctly.
-var srv = net.createServer(function(s) {
- var str = JSON.stringify(DATA) + '\n';
-
- DATA.ord = DATA.ord + 1;
- var buf = Buffer.allocUnsafe(str.length);
- buf.write(JSON.stringify(DATA) + '\n', 'utf8');
-
- s.write(str, 'utf8', pipeFDs[1]);
- if (s.write(buf, pipeFDs[1])) {
- netBinding.close(pipeFDs[1]);
- } else {
- s.on('drain', function() {
- netBinding.close(pipeFDs[1]);
- });
- }
-});
-srv.listen(SOCK_PATH);
-
-// Spawn a child running test/fixtures/recvfd.js
-var cp = child_process.spawn(process.argv[0],
- [path.join(common.fixturesDir, 'recvfd.js'),
- SOCK_PATH]);
-
-cp.stdout.on('data', logChild);
-cp.stderr.on('data', logChild);
-
-// When the child exits, clean up and validate its exit status
-var cpp = cp.pid;
-cp.on('exit', function(code, signal) {
- srv.close();
- // fs.unlinkSync(SOCK_PATH);
-
- assert.strictEqual(code, 0);
- assert.strictEqual(seenOrdinals.length, 2);
-});
-
-// vim:ts=2 sw=2 et