Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit 0a9fa79

Browse files
committed
src,test: fix V8 engine issues
* Remove gyp include that no longer exists upstream * Conditionally include `v8-debug.h` * Fix test failures for V8 engine * Remove status entries for missing tests PR-URL: #519 Reviewed-By: Seth Brenith <sethb@microsoft.com> Reviewed-By: Jimmy Thomson <jithomso@microsoft.com>
1 parent eff6d37 commit 0a9fa79

File tree

7 files changed

+32
-26
lines changed

7 files changed

+32
-26
lines changed

node.gyp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,13 +1030,6 @@
10301030
'include_dirs': [
10311031
'deps/v8/include'
10321032
],
1033-
'conditions' : [
1034-
['node_use_v8_platform=="true"', {
1035-
'dependencies': [
1036-
'deps/v8/src/v8.gyp:v8_libplatform',
1037-
],
1038-
}],
1039-
]
10401033
}],
10411034
['node_engine=="chakracore"', {
10421035
'include_dirs': [

src/node.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@
6464
#if NODE_USE_V8_PLATFORM
6565
#include "libplatform/libplatform.h"
6666
#endif // NODE_USE_V8_PLATFORM
67+
#ifdef NODE_ENGINE_CHAKRACORE
6768
#include "v8-debug.h"
69+
#endif
6870
#include "v8-profiler.h"
6971
#include "zlib.h"
7072

test/common/index.js

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -605,16 +605,22 @@ exports.nodeProcessAborted = function nodeProcessAborted(exitCode, signal) {
605605
};
606606

607607
function areAllValuesStringEqual(obj) {
608-
let exemplar;
609-
for (const key of Object.keys(obj)) {
610-
if (exemplar === undefined) {
611-
exemplar = obj[key].toString();
612-
} else if (exemplar !== obj[key].toString()) {
613-
return false;
608+
try {
609+
let exemplar;
610+
for (const key of Object.keys(obj)) {
611+
if (exemplar === undefined) {
612+
exemplar = obj[key].toString();
613+
} else if (exemplar !== obj[key].toString()) {
614+
return false;
615+
}
614616
}
615-
}
616617

617-
return true;
618+
return true;
619+
} catch (e) {
620+
// If any exceptions are thrown just return false. They are likely due to
621+
// symbols being used in the message object.
622+
return false;
623+
}
618624
}
619625

620626
exports.engineSpecificMessage = function(messageObject) {
@@ -635,6 +641,19 @@ exports.engineSpecificMessage = function(messageObject) {
635641
return undefined;
636642
};
637643

644+
exports.requireInternalV8 = function() {
645+
if (exports.isChakraEngine) {
646+
return {
647+
previewMapIterator: function() { return []; },
648+
previewSetIterator: function() { return []; },
649+
previewWeakMap: function() { return []; },
650+
previewWeakSet: function() { return []; }
651+
};
652+
} else {
653+
return require('internal/v8');
654+
}
655+
};
656+
638657
exports.busyLoop = function busyLoop(time) {
639658
const startTime = Timer.now();
640659
const stopTime = startTime + time;

test/es-module/es-module.status

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ test-esm-loader-modulemap : SKIP
2323
test-esm-main-lookup : SKIP
2424
test-esm-named-exports : SKIP
2525
test-esm-namespace : SKIP
26-
test-esm-ok : SKIP
2726
test-esm-preserve-symlinks : SKIP
2827
test-esm-preserve-symlinks-not-found : SKIP
2928
test-esm-preserve-symlinks-not-found-plain : SKIP

test/parallel/parallel.status

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ test-util : SKIP
8888
test-util-format-shared-arraybuffer : SKIP
8989
test-util-inspect-proxy : SKIP
9090
test-v8-serdes : SKIP
91-
test-v8-serdes-sharedarraybuffer : SKIP
9291
test-vm-attributes-property-not-on-sandbox : SKIP
9392
test-vm-cached-data : SKIP
9493
test-vm-codegen : SKIP

test/parallel/test-assert.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,7 @@ common.expectsError(
636636
type: assert.AssertionError,
637637
generatedMessage: !common.isChakraEngine,
638638
message: engineSpecificAssert(
639-
`The expression evaluated to a falsy value:${EOL}${EOL} ` +
640-
`assert.ok(null)${EOL}`,
639+
`assert.ok(null)${EOL}`,
641640
'null == true')
642641
}
643642
);
@@ -648,8 +647,7 @@ common.expectsError(
648647
type: assert.AssertionError,
649648
generatedMessage: !common.isChakraEngine,
650649
message: engineSpecificAssert(
651-
`The expression evaluated to a falsy value:${EOL}${EOL} ` +
652-
`assert(typeof 123 === 'string')${EOL}`,
650+
`assert(typeof 123 === 'string')${EOL}`,
653651
'false == true')
654652
}
655653
);

test/parallel/test-util-inspect.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ const assert = require('assert');
2626
const JSStream = process.binding('js_stream').JSStream;
2727
const util = require('util');
2828
const vm = require('vm');
29-
if (!common.isChakraEngine) {
30-
// eslint-disable-next-line no-unused-vars
31-
const { previewMapIterator } = require('internal/v8');
32-
}
29+
const { previewMapIterator } = common.requireInternalV8();
3330

3431
assert.strictEqual(util.inspect(1), '1');
3532
assert.strictEqual(util.inspect(false), 'false');
@@ -460,7 +457,6 @@ assert.strictEqual(util.inspect(-5e-324), '-5e-324');
460457
if (!common.isChakraEngine) {
461458
const map = new Map();
462459
map.set(1, 2);
463-
// eslint-disable-next-line no-undef
464460
const vals = previewMapIterator(map.entries());
465461
const valsOutput = [];
466462
for (const o of vals) {

0 commit comments

Comments
 (0)