mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
69298d36cf
This patch makes the skip messages consistent so that the TAP plugin in CI can parse the messages properly. The format will be 1..0 # Skipped: [Actual reason why the test is skipped] PR-URL: https://github.com/nodejs/io.js/pull/2109 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
27 lines
736 B
JavaScript
27 lines
736 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
var exec = require('child_process').exec;
|
|
|
|
if (process.platform === 'darwin') {
|
|
console.log('1..0 # Skipped: Output of `id -G` is unreliable on Darwin.');
|
|
return;
|
|
}
|
|
|
|
if (typeof process.getgroups === 'function') {
|
|
var groups = process.getgroups();
|
|
assert(Array.isArray(groups));
|
|
assert(groups.length > 0);
|
|
exec('id -G', function(err, stdout) {
|
|
if (err) throw err;
|
|
var real_groups = stdout.match(/\d+/g).map(Number);
|
|
assert.equal(groups.length, real_groups.length);
|
|
check(groups, real_groups);
|
|
check(real_groups, groups);
|
|
});
|
|
}
|
|
|
|
function check(a, b) {
|
|
for (var i = 0; i < a.length; ++i) assert(b.indexOf(a[i]) !== -1);
|
|
}
|