Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: remove deprecated error logging #3079

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions test/parallel/test-fs-append-file-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,16 @@ common.refreshTmpDir();
// test that empty file will be created and have content added
var filename = join(common.tmpDir, 'append-sync.txt');

common.error('appending to ' + filename);
fs.appendFileSync(filename, data);

var fileData = fs.readFileSync(filename);
console.error('filedata is a ' + typeof fileData);

assert.equal(Buffer.byteLength(data), fileData.length);

// test that appends data to a non empty file
var filename2 = join(common.tmpDir, 'append-sync2.txt');
fs.writeFileSync(filename2, currentFileData);

common.error('appending to ' + filename2);
fs.appendFileSync(filename2, data);

var fileData2 = fs.readFileSync(filename2);
Expand All @@ -44,8 +41,6 @@ assert.equal(Buffer.byteLength(data) + currentFileData.length,
var filename3 = join(common.tmpDir, 'append-sync3.txt');
fs.writeFileSync(filename3, currentFileData);

common.error('appending to ' + filename3);

var buf = new Buffer(data, 'utf8');
fs.appendFileSync(filename3, buf);

Expand All @@ -57,7 +52,6 @@ assert.equal(buf.length + currentFileData.length, fileData3.length);
var filename4 = join(common.tmpDir, 'append-sync4.txt');
fs.writeFileSync(filename4, currentFileData, { mode: m });

common.error('appending to ' + filename4);
var m = 0o600;
fs.appendFileSync(filename4, num, { mode: m });

Expand All @@ -75,8 +69,6 @@ assert.equal(Buffer.byteLength('' + num) + currentFileData.length,
//exit logic for cleanup

process.on('exit', function() {
common.error('done');

fs.unlinkSync(filename);
fs.unlinkSync(filename2);
fs.unlinkSync(filename3);
Expand Down
14 changes: 0 additions & 14 deletions test/parallel/test-fs-append-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ var join = require('path').join;

var filename = join(common.tmpDir, 'append.txt');

common.error('appending to ' + filename);

var currentFileData = 'ABCD';

var n = 220;
Expand All @@ -28,11 +26,9 @@ fs.appendFile(filename, s, function(e) {
if (e) throw e;

ncallbacks++;
common.error('appended to file');

fs.readFile(filename, function(e, buffer) {
if (e) throw e;
common.error('file read');
ncallbacks++;
assert.equal(Buffer.byteLength(s), buffer.length);
});
Expand All @@ -46,11 +42,9 @@ fs.appendFile(filename2, s, function(e) {
if (e) throw e;

ncallbacks++;
common.error('appended to file2');

fs.readFile(filename2, function(e, buffer) {
if (e) throw e;
common.error('file2 read');
ncallbacks++;
assert.equal(Buffer.byteLength(s) + currentFileData.length, buffer.length);
});
Expand All @@ -61,17 +55,14 @@ var filename3 = join(common.tmpDir, 'append3.txt');
fs.writeFileSync(filename3, currentFileData);

var buf = new Buffer(s, 'utf8');
common.error('appending to ' + filename3);

fs.appendFile(filename3, buf, function(e) {
if (e) throw e;

ncallbacks++;
common.error('appended to file3');

fs.readFile(filename3, function(e, buffer) {
if (e) throw e;
common.error('file3 read');
ncallbacks++;
assert.equal(buf.length + currentFileData.length, buffer.length);
});
Expand All @@ -81,14 +72,11 @@ fs.appendFile(filename3, buf, function(e) {
var filename4 = join(common.tmpDir, 'append4.txt');
fs.writeFileSync(filename4, currentFileData);

common.error('appending to ' + filename4);

var m = 0o600;
fs.appendFile(filename4, n, { mode: m }, function(e) {
if (e) throw e;

ncallbacks++;
common.error('appended to file4');

// windows permissions aren't unix
if (!common.isWindows) {
Expand All @@ -98,15 +86,13 @@ fs.appendFile(filename4, n, { mode: m }, function(e) {

fs.readFile(filename4, function(e, buffer) {
if (e) throw e;
common.error('file4 read');
ncallbacks++;
assert.equal(Buffer.byteLength('' + n) + currentFileData.length,
buffer.length);
});
});

process.on('exit', function() {
common.error('done');
assert.equal(8, ncallbacks);

fs.unlinkSync(filename);
Expand Down
7 changes: 0 additions & 7 deletions test/parallel/test-fs-fsync.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,20 @@ var successes = 0;

var file = path.join(common.fixturesDir, 'a.js');

common.error('open ' + file);

fs.open(file, 'a', 0o777, function(err, fd) {
common.error('fd ' + fd);
if (err) throw err;

fs.fdatasyncSync(fd);
common.error('fdatasync SYNC: ok');
successes++;

fs.fsyncSync(fd);
common.error('fsync SYNC: ok');
successes++;

fs.fdatasync(fd, function(err) {
if (err) throw err;
common.error('fdatasync ASYNC: ok');
successes++;
fs.fsync(fd, function(err) {
if (err) throw err;
common.error('fsync ASYNC: ok');
successes++;
});
});
Expand Down
11 changes: 0 additions & 11 deletions test/parallel/test-fs-write-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ common.refreshTmpDir();

var filename = join(common.tmpDir, 'test.txt');

common.error('writing to ' + filename);

var n = 220;
var s = '南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,疆域包括今天中国的广东、' +
'广西两省区的大部份地区,福建省、湖南、贵州、云南的一小部份地区和越南的北部。' +
Expand All @@ -25,11 +23,9 @@ fs.writeFile(filename, s, function(e) {
if (e) throw e;

ncallbacks++;
common.error('file written');

fs.readFile(filename, function(e, buffer) {
if (e) throw e;
common.error('file read');
ncallbacks++;
assert.equal(Buffer.byteLength(s), buffer.length);
});
Expand All @@ -38,25 +34,21 @@ fs.writeFile(filename, s, function(e) {
// test that writeFile accepts buffers
var filename2 = join(common.tmpDir, 'test2.txt');
var buf = new Buffer(s, 'utf8');
common.error('writing to ' + filename2);

fs.writeFile(filename2, buf, function(e) {
if (e) throw e;

ncallbacks++;
common.error('file2 written');

fs.readFile(filename2, function(e, buffer) {
if (e) throw e;
common.error('file2 read');
ncallbacks++;
assert.equal(buf.length, buffer.length);
});
});

// test that writeFile accepts numbers.
var filename3 = join(common.tmpDir, 'test3.txt');
common.error('writing to ' + filename3);

var m = 0o600;
fs.writeFile(filename3, n, { mode: m }, function(e) {
Expand All @@ -69,19 +61,16 @@ fs.writeFile(filename3, n, { mode: m }, function(e) {
}

ncallbacks++;
common.error('file3 written');

fs.readFile(filename3, function(e, buffer) {
if (e) throw e;
common.error('file3 read');
ncallbacks++;
assert.equal(Buffer.byteLength('' + n), buffer.length);
});
});


process.on('exit', function() {
common.error('done');
assert.equal(6, ncallbacks);

fs.unlinkSync(filename);
Expand Down
4 changes: 0 additions & 4 deletions test/parallel/test-http-304.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,5 @@ s.listen(common.PORT, function() {
function(err, stdout, stderr) {
if (err) throw err;
s.close();
common.error('curled response correctly');
common.error(common.inspect(stdout));
});
});

console.log('Server running at http://127.0.0.1:' + common.PORT + '/');
3 changes: 0 additions & 3 deletions test/parallel/test-http-blank-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ var net = require('net');
var gotReq = false;

var server = http.createServer(function(req, res) {
common.error('got req');
gotReq = true;
assert.equal('GET', req.method);
assert.equal('/blah', req.url);
Expand All @@ -23,7 +22,6 @@ server.listen(common.PORT, function() {
var c = net.createConnection(common.PORT);

c.on('connect', function() {
common.error('client wrote message');
c.write('GET /blah HTTP/1.1\r\n' +
'Host: mapdevel.trolologames.ru:443\r\n' +
'Cookie:\r\n' +
Expand All @@ -37,7 +35,6 @@ server.listen(common.PORT, function() {
});

c.on('close', function() {
common.error('client close');
server.close();
});
});
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-http-client-upload-buf.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ server.on('listening', function() {

req.write(new Buffer(N));
req.end();

common.error('client finished sending request');
});

process.on('exit', function() {
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-http-client-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ server.on('listening', function() {
req.write('2\n');
req.write('3\n');
req.end();

common.error('client finished sending request');
});

process.on('exit', function() {
Expand Down
3 changes: 0 additions & 3 deletions test/parallel/test-http-head-response-has-no-body-end.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@ server.on('listening', function() {
method: 'HEAD',
path: '/'
}, function(res) {
common.error('response');
res.on('end', function() {
common.error('response end');
server.close();
responseComplete = true;
});
res.resume();
});
common.error('req');
req.end();
});

Expand Down
3 changes: 0 additions & 3 deletions test/parallel/test-http-head-response-has-no-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@ server.on('listening', function() {
method: 'HEAD',
path: '/'
}, function(res) {
common.error('response');
res.on('end', function() {
common.error('response end');
server.close();
responseComplete = true;
});
res.resume();
});
common.error('req');
req.end();
});

Expand Down
6 changes: 0 additions & 6 deletions test/parallel/test-http-legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ var assert = require('assert');
var http = require('http');
var url = require('url');

function p(x) {
common.error(common.inspect(x));
}

var responses_sent = 0;
var responses_recvd = 0;
var body0 = '';
Expand Down Expand Up @@ -39,8 +35,6 @@ var server = http.createServer(function(req, res) {
responses_sent += 1;
});
req.resume();

//assert.equal('127.0.0.1', res.connection.remoteAddress);
});

server.listen(common.PORT, function() {
Expand Down
4 changes: 0 additions & 4 deletions test/parallel/test-http-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,17 @@ var server = http.createServer(function(req, res) {
}

if (req.id == 1) {
common.error('req 1');
assert.equal('POST', req.method);
assert.equal('/quit', url.parse(req.url).pathname);
}

if (req.id == 2) {
common.error('req 2');
assert.equal('foo', req.headers['x-x']);
}

if (req.id == 3) {
common.error('req 3');
assert.equal('bar', req.headers['x-x']);
this.close();
common.error('server closed');
}

setTimeout(function() {
Expand Down
5 changes: 0 additions & 5 deletions test/parallel/test-http-upgrade-server2.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ var http = require('http');
var net = require('net');

var server = http.createServer(function(req, res) {
common.error('got req');
throw new Error('This shouldn\'t happen.');
});

server.on('upgrade', function(req, socket, upgradeHead) {
common.error('got upgrade event');
// test that throwing an error from upgrade gets
// is uncaught
throw new Error('upgrade error');
Expand All @@ -19,7 +17,6 @@ server.on('upgrade', function(req, socket, upgradeHead) {
var gotError = false;

process.on('uncaughtException', function(e) {
common.error('got \'clientError\' event');
assert.equal('upgrade error', e.message);
gotError = true;
process.exit(0);
Expand All @@ -30,7 +27,6 @@ server.listen(common.PORT, function() {
var c = net.createConnection(common.PORT);

c.on('connect', function() {
common.error('client wrote message');
c.write('GET /blah HTTP/1.1\r\n' +
'Upgrade: WebSocket\r\n' +
'Connection: Upgrade\r\n' +
Expand All @@ -42,7 +38,6 @@ server.listen(common.PORT, function() {
});

c.on('close', function() {
common.error('client close');
server.close();
});
});
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-http-write-empty-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ server.listen(common.PORT, function() {
res.on('data', function(chunk) {
response += chunk;
});
common.error('Got /hello response');
});
});

Loading