Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Next Next commit
test: make common.skip() exit
Also add common.printSkipMessage() for partial skips.

Fixes: #14016
  • Loading branch information
vsemozhetbyt committed Jul 4, 2017
commit ab91eb8aadecc7af5c2ec61b3a4e96a4f0acb3ec
4 changes: 1 addition & 3 deletions test/abort/test-abort-backtrace.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ const common = require('../common');
const assert = require('assert');
const cp = require('child_process');

if (common.isWindows) {
if (common.isWindows)
common.skip('Backtraces unimplemented on Windows.');
return;
}

if (process.argv[2] === 'child') {
process.abort();
Expand Down
4 changes: 1 addition & 3 deletions test/addons/load-long-path/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ const fs = require('fs');
const path = require('path');
const assert = require('assert');

if (common.isWOW64) {
if (common.isWOW64)
common.skip('doesn\'t work on WOW64');
return;
}

common.refreshTmpDir();

Expand Down
5 changes: 2 additions & 3 deletions test/addons/openssl-binding/test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
'use strict';

const common = require('../../common');
if (!common.hasCrypto) {
if (!common.hasCrypto)
common.skip('missing crypto');
process.exit(0);
}

const assert = require('assert');
const binding = require(`./build/${common.buildType}/binding`);
const bytes = new Uint8Array(1024);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ const assert = require('assert');
const kStringMaxLength = process.binding('buffer').kStringMaxLength;

const skipMessage = 'intensive toString tests due to memory confinements';
if (!common.enoughTestMem) {
if (!common.enoughTestMem)
common.skip(skipMessage);
return;
}

let buf;
try {
Expand All @@ -21,14 +19,11 @@ try {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Array buffer allocation failed') throw (e);
common.skip(skipMessage);
return;
}

// Ensure we have enough memory available for future allocations to succeed.
if (!binding.ensureAllocation(2 * kStringMaxLength)) {
if (!binding.ensureAllocation(2 * kStringMaxLength))
common.skip(skipMessage);
return;
}

const maxString = buf.toString('latin1');
assert.strictEqual(maxString.length, kStringMaxLength);
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ const binding = require(`./build/${common.buildType}/binding`);
const assert = require('assert');

const skipMessage = 'intensive toString tests due to memory confinements';
if (!common.enoughTestMem) {
if (!common.enoughTestMem)
common.skip(skipMessage);
return;
}

// v8 fails silently if string length > v8::String::kMaxLength
// v8::String::kMaxLength defined in v8.h
Expand All @@ -21,14 +19,11 @@ try {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Array buffer allocation failed') throw (e);
common.skip(skipMessage);
return;
}

// Ensure we have enough memory available for future allocations to succeed.
if (!binding.ensureAllocation(2 * kStringMaxLength)) {
if (!binding.ensureAllocation(2 * kStringMaxLength))
common.skip(skipMessage);
return;
}

assert.throws(function() {
buf.toString('ascii');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ const binding = require(`./build/${common.buildType}/binding`);
const assert = require('assert');

const skipMessage = 'intensive toString tests due to memory confinements';
if (!common.enoughTestMem) {
if (!common.enoughTestMem)
common.skip(skipMessage);
return;
}

// v8 fails silently if string length > v8::String::kMaxLength
// v8::String::kMaxLength defined in v8.h
Expand All @@ -21,14 +19,11 @@ try {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Array buffer allocation failed') throw (e);
common.skip(skipMessage);
return;
}

// Ensure we have enough memory available for future allocations to succeed.
if (!binding.ensureAllocation(2 * kStringMaxLength)) {
if (!binding.ensureAllocation(2 * kStringMaxLength))
common.skip(skipMessage);
return;
}

assert.throws(function() {
buf.toString('base64');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ const binding = require(`./build/${common.buildType}/binding`);
const assert = require('assert');

const skipMessage = 'intensive toString tests due to memory confinements';
if (!common.enoughTestMem) {
if (!common.enoughTestMem)
common.skip(skipMessage);
return;
}

// v8 fails silently if string length > v8::String::kMaxLength
// v8::String::kMaxLength defined in v8.h
Expand All @@ -21,14 +19,11 @@ try {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Array buffer allocation failed') throw (e);
common.skip(skipMessage);
return;
}

// Ensure we have enough memory available for future allocations to succeed.
if (!binding.ensureAllocation(2 * kStringMaxLength)) {
if (!binding.ensureAllocation(2 * kStringMaxLength))
common.skip(skipMessage);
return;
}

assert.throws(function() {
buf.toString('latin1');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ const binding = require(`./build/${common.buildType}/binding`);
const assert = require('assert');

const skipMessage = 'intensive toString tests due to memory confinements';
if (!common.enoughTestMem) {
if (!common.enoughTestMem)
common.skip(skipMessage);
return;
}

// v8 fails silently if string length > v8::String::kMaxLength
// v8::String::kMaxLength defined in v8.h
Expand All @@ -21,14 +19,11 @@ try {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Array buffer allocation failed') throw (e);
common.skip(skipMessage);
return;
}

// Ensure we have enough memory available for future allocations to succeed.
if (!binding.ensureAllocation(2 * kStringMaxLength)) {
if (!binding.ensureAllocation(2 * kStringMaxLength))
common.skip(skipMessage);
return;
}

assert.throws(function() {
buf.toString('hex');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ const binding = require(`./build/${common.buildType}/binding`);
const assert = require('assert');

const skipMessage = 'intensive toString tests due to memory confinements';
if (!common.enoughTestMem) {
if (!common.enoughTestMem)
common.skip(skipMessage);
return;
}

// v8 fails silently if string length > v8::String::kMaxLength
// v8::String::kMaxLength defined in v8.h
Expand All @@ -21,14 +19,11 @@ try {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Array buffer allocation failed') throw (e);
common.skip(skipMessage);
return;
}

// Ensure we have enough memory available for future allocations to succeed.
if (!binding.ensureAllocation(2 * kStringMaxLength)) {
if (!binding.ensureAllocation(2 * kStringMaxLength))
common.skip(skipMessage);
return;
}

assert.throws(function() {
buf.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ const binding = require(`./build/${common.buildType}/binding`);
const assert = require('assert');

const skipMessage = 'intensive toString tests due to memory confinements';
if (!common.enoughTestMem) {
if (!common.enoughTestMem)
common.skip(skipMessage);
return;
}

// v8 fails silently if string length > v8::String::kMaxLength
// v8::String::kMaxLength defined in v8.h
Expand All @@ -21,14 +19,11 @@ try {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Array buffer allocation failed') throw (e);
common.skip(skipMessage);
return;
}

// Ensure we have enough memory available for future allocations to succeed.
if (!binding.ensureAllocation(2 * kStringMaxLength)) {
if (!binding.ensureAllocation(2 * kStringMaxLength))
common.skip(skipMessage);
return;
}

const maxString = buf.toString('utf16le');
assert.strictEqual(maxString.length, (kStringMaxLength + 2) / 2);
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ const binding = require(`./build/${common.buildType}/binding`);
const assert = require('assert');

const skipMessage = 'intensive toString tests due to memory confinements';
if (!common.enoughTestMem) {
if (!common.enoughTestMem)
common.skip(skipMessage);
return;
}

// v8 fails silently if string length > v8::String::kMaxLength
// v8::String::kMaxLength defined in v8.h
Expand All @@ -21,14 +19,11 @@ try {
// If the exception is not due to memory confinement then rethrow it.
if (e.message !== 'Array buffer allocation failed') throw (e);
common.skip(skipMessage);
return;
}

// Ensure we have enough memory available for future allocations to succeed.
if (!binding.ensureAllocation(2 * kStringMaxLength)) {
if (!binding.ensureAllocation(2 * kStringMaxLength))
common.skip(skipMessage);
return;
}

assert.throws(function() {
buf.toString('utf16le');
Expand Down
1 change: 0 additions & 1 deletion test/addons/symlinked-module/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ try {
} catch (err) {
if (err.code !== 'EPERM') throw err;
common.skip('module identity test (no privs for symlinks)');
return;
}

const sub = require('./submodule');
Expand Down
4 changes: 1 addition & 3 deletions test/async-hooks/test-connection.ssl.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ const common = require('../common');
const assert = require('assert');
const { checkInvocations } = require('./hook-checks');

if (!common.hasCrypto) {
if (!common.hasCrypto)
common.skip('missing crypto');
return;
}

const tls = require('tls');
const Connection = process.binding('crypto').Connection;
Expand Down
5 changes: 2 additions & 3 deletions test/async-hooks/test-crypto-pbkdf2.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
'use strict';

const common = require('../common');
if (!common.hasCrypto) {
if (!common.hasCrypto)
common.skip('missing crypto');
return;
}

const assert = require('assert');
const tick = require('./tick');
const initHooks = require('./init-hooks');
Expand Down
5 changes: 2 additions & 3 deletions test/async-hooks/test-crypto-randomBytes.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
'use strict';

const common = require('../common');
if (!common.hasCrypto) {
if (!common.hasCrypto)
common.skip('missing crypto');
return;
}

const assert = require('assert');
const tick = require('./tick');
const initHooks = require('./init-hooks');
Expand Down
4 changes: 1 addition & 3 deletions test/async-hooks/test-graph.connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ const initHooks = require('./init-hooks');
const common = require('../common');
const verifyGraph = require('./verify-graph');

if (!common.hasCrypto) {
if (!common.hasCrypto)
common.skip('missing crypto');
return;
}

const tls = require('tls');
const Connection = process.binding('crypto').Connection;
Expand Down
4 changes: 1 addition & 3 deletions test/async-hooks/test-graph.shutdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ const common = require('../common');
const initHooks = require('./init-hooks');
const verifyGraph = require('./verify-graph');

if (!common.hasIPv6) {
if (!common.hasIPv6)
common.skip('IPv6 support required');
return;
}

const net = require('net');

Expand Down
4 changes: 1 addition & 3 deletions test/async-hooks/test-graph.tcp.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ const common = require('../common');
const initHooks = require('./init-hooks');
const verifyGraph = require('./verify-graph');

if (!common.hasIPv6) {
if (!common.hasIPv6)
common.skip('IPv6 support required');
return;
}

const net = require('net');

Expand Down
8 changes: 2 additions & 6 deletions test/async-hooks/test-graph.tls-write.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@ const initHooks = require('./init-hooks');
const verifyGraph = require('./verify-graph');
const fs = require('fs');

if (!common.hasCrypto) {
if (!common.hasCrypto)
common.skip('missing crypto');
return;
}

if (!common.hasIPv6) {
if (!common.hasIPv6)
common.skip('IPv6 support required');
return;
}

const tls = require('tls');
const hooks = initHooks();
Expand Down
4 changes: 1 addition & 3 deletions test/async-hooks/test-tcpwrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ const tick = require('./tick');
const initHooks = require('./init-hooks');
const { checkInvocations } = require('./hook-checks');

if (!common.hasIPv6) {
if (!common.hasIPv6)
common.skip('IPv6 support required');
return;
}

const net = require('net');

Expand Down
4 changes: 1 addition & 3 deletions test/async-hooks/test-tlswrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ const initHooks = require('./init-hooks');
const fs = require('fs');
const { checkInvocations } = require('./hook-checks');

if (!common.hasCrypto) {
if (!common.hasCrypto)
common.skip('missing crypto');
return;
}

const tls = require('tls');
const hooks = initHooks();
Expand Down
Loading