Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ed55374

Browse filesBrowse files
qbitMylesBorins
authored andcommitted
test: update a few tests to work on OpenBSD
PR-URL: #18543 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 1557d93 commit ed55374
Copy full SHA for ed55374

File tree

Expand file treeCollapse file tree

8 files changed

+37
-12
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

8 files changed

+37
-12
lines changed
Open diff view settings
Collapse file

‎test/common/index.js‎

Copy file name to clipboardExpand all lines: test/common/index.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ exports.isLinuxPPCBE = (process.platform === 'linux') &&
5454
(os.endianness() === 'BE');
5555
exports.isSunOS = process.platform === 'sunos';
5656
exports.isFreeBSD = process.platform === 'freebsd';
57+
exports.isOpenBSD = process.platform === 'openbsd';
5758
exports.isLinux = process.platform === 'linux';
5859
exports.isOSX = process.platform === 'darwin';
5960

Collapse file

‎test/parallel/test-child-process-exec-timeout.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-exec-timeout.js
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,22 @@ const cmd = `"${process.execPath}" "${__filename}" child`;
1616

1717
// Test the case where a timeout is set, and it expires.
1818
cp.exec(cmd, { timeout: 1 }, common.mustCall((err, stdout, stderr) => {
19+
let sigterm = 'SIGTERM';
1920
assert.strictEqual(err.killed, true);
20-
assert.strictEqual(err.code, null);
21+
// TODO OpenBSD returns a null signal and 143 for code
22+
if (common.isOpenBSD) {
23+
assert.strictEqual(err.code, 143);
24+
sigterm = null;
25+
} else {
26+
assert.strictEqual(err.code, null);
27+
}
2128
// At least starting with Darwin Kernel Version 16.4.0, sending a SIGTERM to a
2229
// process that is still starting up kills it with SIGKILL instead of SIGTERM.
2330
// See: https://github.com/libuv/libuv/issues/1226
2431
if (common.isOSX)
2532
assert.ok(err.signal === 'SIGTERM' || err.signal === 'SIGKILL');
2633
else
27-
assert.strictEqual(err.signal, 'SIGTERM');
34+
assert.strictEqual(err.signal, sigterm);
2835
assert.strictEqual(err.cmd, cmd);
2936
assert.strictEqual(stdout.trim(), '');
3037
assert.strictEqual(stderr.trim(), '');
Collapse file

‎test/parallel/test-fs-utimes.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-utimes.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ process.on('exit', function() {
172172
const path = `${tmpdir.path}/test-utimes-precision`;
173173
fs.writeFileSync(path, '');
174174

175-
// test Y2K38 for all platforms [except 'arm', and 'SunOS']
176-
if (!process.arch.includes('arm') && !common.isSunOS) {
175+
// test Y2K38 for all platforms [except 'arm', 'OpenBSD' and 'SunOS']
176+
if (!process.arch.includes('arm') && !common.isOpenBSD && !common.isSunOS) {
177177
// because 2 ** 31 doesn't look right
178178
// eslint-disable-next-line space-infix-ops
179179
const Y2K38_mtime = 2**31;
Collapse file

‎test/parallel/test-http-dns-error.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-dns-error.js
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ const https = require('https');
3232
const host = '*'.repeat(256);
3333
const MAX_TRIES = 5;
3434

35+
let errCode = 'ENOTFOUND';
36+
if (common.isOpenBSD)
37+
errCode = 'EAI_FAIL';
38+
3539
function tryGet(mod, tries) {
3640
// Bad host name should not throw an uncatchable exception.
3741
// Ensure that there is time to attach an error listener.
@@ -41,7 +45,7 @@ function tryGet(mod, tries) {
4145
tryGet(mod, ++tries);
4246
return;
4347
}
44-
assert.strictEqual(err.code, 'ENOTFOUND');
48+
assert.strictEqual(err.code, errCode);
4549
}));
4650
// http.get() called req1.end() for us
4751
}
@@ -57,7 +61,7 @@ function tryRequest(mod, tries) {
5761
tryRequest(mod, ++tries);
5862
return;
5963
}
60-
assert.strictEqual(err.code, 'ENOTFOUND');
64+
assert.strictEqual(err.code, errCode);
6165
}));
6266
req.end();
6367
}
Collapse file

‎test/parallel/test-net-dns-error.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-net-dns-error.js
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,21 @@ const net = require('net');
2727

2828
const host = '*'.repeat(256);
2929

30+
let errCode = 'ENOTFOUND';
31+
if (common.isOpenBSD)
32+
errCode = 'EAI_FAIL';
33+
3034
function do_not_call() {
3135
throw new Error('This function should not have been called.');
3236
}
3337

3438
const socket = net.connect(42, host, do_not_call);
3539
socket.on('error', common.mustCall(function(err) {
36-
assert.strictEqual(err.code, 'ENOTFOUND');
40+
assert.strictEqual(err.code, errCode);
3741
}));
3842
socket.on('lookup', function(err, ip, type) {
3943
assert(err instanceof Error);
40-
assert.strictEqual(err.code, 'ENOTFOUND');
44+
assert.strictEqual(err.code, errCode);
4145
assert.strictEqual(ip, undefined);
4246
assert.strictEqual(type, undefined);
4347
});
Collapse file

‎test/parallel/test-postmortem-metadata.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-postmortem-metadata.js
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ const args = [process.execPath];
1212
if (common.isAIX)
1313
args.unshift('-Xany', '-B');
1414

15+
if (common.isOpenBSD)
16+
common.skip('no v8 debug symbols on OpenBSD');
17+
1518
const nm = spawnSync('nm', args);
1619

1720
if (nm.error && nm.error.errno === 'ENOENT')
Collapse file

‎test/parallel/test-setproctitle.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-setproctitle.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ exec(cmd, common.mustCall((error, stdout, stderr) => {
3434
assert.strictEqual(stderr, '');
3535

3636
// freebsd always add ' (procname)' to the process title
37-
if (common.isFreeBSD)
37+
if (common.isFreeBSD || common.isOpenBSD)
3838
title += ` (${path.basename(process.execPath)})`;
3939

4040
// omitting trailing whitespace and \n
Collapse file

‎test/sequential/test-module-loading.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-module-loading.js
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

2222
'use strict';
23-
require('../common');
23+
const common = require('../common');
2424
const assert = require('assert');
2525
const path = require('path');
2626
const fs = require('fs');
@@ -197,15 +197,21 @@ try {
197197
require(`${loadOrder}file3`);
198198
} catch (e) {
199199
// Not a real .node module, but we know we require'd the right thing.
200-
assert.ok(/file3\.node/.test(e.message.replace(backslash, '/')));
200+
if (common.isOpenBSD) // OpenBSD errors with non-ELF object error
201+
assert.ok(/File not an ELF object/.test(e.message.replace(backslash, '/')));
202+
else
203+
assert.ok(/file3\.node/.test(e.message.replace(backslash, '/')));
201204
}
202205
assert.strictEqual(require(`${loadOrder}file4`).file4, 'file4.reg', msg);
203206
assert.strictEqual(require(`${loadOrder}file5`).file5, 'file5.reg2', msg);
204207
assert.strictEqual(require(`${loadOrder}file6`).file6, 'file6/index.js', msg);
205208
try {
206209
require(`${loadOrder}file7`);
207210
} catch (e) {
208-
assert.ok(/file7\/index\.node/.test(e.message.replace(backslash, '/')));
211+
if (common.isOpenBSD)
212+
assert.ok(/File not an ELF object/.test(e.message.replace(backslash, '/')));
213+
else
214+
assert.ok(/file7\/index\.node/.test(e.message.replace(backslash, '/')));
209215
}
210216
assert.strictEqual(require(`${loadOrder}file8`).file8, 'file8/index.reg',
211217
msg);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.