Showing with 20 additions and 3 deletions.
  1. +6 −1 test/common.js
  2. +1 −1 test/simple/test-cluster-eaccess.js
  3. +3 −1 test/simple/test-net-pipe-connect-errors.js
  4. +10 −0 test/testpy/__init__.py
@@ -28,14 +28,19 @@ exports.testDir = path.dirname(__filename);
exports.fixturesDir = path.join(exports.testDir, 'fixtures');
exports.libDir = path.join(exports.testDir, '../lib');
exports.tmpDir = path.join(exports.testDir, 'tmp');
if (process.env.NODE_PIPE_DIR === undefined) {
exports.pipeTmpDir = exports.tmpDir;
} else {
exports.pipeTmpDir = path.join(process.env.NODE_PIPE_DIR, 'NodePipeTmp');
}
exports.PORT = +process.env.NODE_COMMON_PORT || 12346;

exports.opensslCli = path.join(path.dirname(process.execPath), 'openssl-cli');
if (process.platform === 'win32') {
exports.PIPE = '\\\\.\\pipe\\libuv-test';
exports.opensslCli += '.exe';
} else {
exports.PIPE = exports.tmpDir + '/test.sock';
exports.PIPE = exports.pipeTmpDir + '/test.sock';
}
if (!fs.existsSync(exports.opensslCli))
exports.opensslCli = false;
@@ -27,7 +27,7 @@ var path = require('path');
var fs = require('fs');
var net = require('net');

var socketPath = path.join(common.fixturesDir, 'socket-path');
var socketPath = common.PIPE;

if (cluster.isMaster) {
var worker = cluster.fork();
@@ -31,7 +31,9 @@ var accessErrorFired = false;

// Test if ENOTSOCK is fired when trying to connect to a file which is not
// a socket.
var emptyTxt = path.join(common.fixturesDir, 'empty.txt');
var emptyTxt = path.join(common.pipeTmpDir, 'empty.txt');
fs.closeSync(fs.openSync(emptyTxt, 'w'));

var notSocketClient = net.createConnection(emptyTxt, function() {
assert.ok(false);
});
@@ -48,30 +48,40 @@ def __init__(self, path, file, mode, context, config, additional=[]):
self.mode = mode
self.tmpdir = join(dirname(self.config.root), 'tmp')
self.additional_flags = additional
if "NODE_PIPE_DIR" in os.environ:
self.pipeTmpDir = join(os.environ["NODE_PIPE_DIR"], 'NodePipeTmp')

def AfterRun(self, result):
# delete the whole tmp dir
try:
rmtree(self.tmpdir)
if "NODE_PIPE_DIR" in os.environ:
rmtree(self.pipeTmpDir);
except:
pass
# make it again.
try:
mkdir(self.tmpdir)
if "NODE_PIPE_DIR" in os.environ:
mkdir(self.pipeTmpDir);
except:
pass

def BeforeRun(self):
# delete the whole tmp dir
try:
rmtree(self.tmpdir)
if "NODE_PIPE_DIR" in os.environ:
rmtree(self.pipeTmpDir);
except:
pass
# make it again.
# intermittently fails on win32, so keep trying
while not os.path.exists(self.tmpdir):
try:
mkdir(self.tmpdir)
if "NODE_PIPE_DIR" in os.environ:
mkdir(self.pipeTmpDir);
except:
pass