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

Commit

Permalink
lib,src,test: cleanup chakracore customization
Browse files Browse the repository at this point in the history
* Undo obsolete test modifications and enable more tests.
* Remove unnecessary deltas with upstream
* Fix lint issues

PR-URL: #580
Reviewed-By: Seth Brenith <[email protected]>
Reviewed-By: Jimmy Thomson <[email protected]>
  • Loading branch information
kfarnung committed Aug 4, 2018
1 parent ca59ca8 commit 531905c
Show file tree
Hide file tree
Showing 17 changed files with 97 additions and 175 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ ipch/
*.opensdf
*.VC.db
*.VC.opendb
*.VC.db
.vs/
.vscode/
/deps/v8/src/debug/obj
Expand Down
2 changes: 1 addition & 1 deletion benchmark/misc/trace.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if (process.versions.hasOwnProperty('chakracore')) {
// however, the benchmark harness fails if it runs a file without a benchmark
// set up instead of disabling the entire misc benchmark, we can simply shim
// this benchmark
const bench = common.createBenchmark(function main({n}) {
const bench = common.createBenchmark(function main({ n }) {
bench.start();
while (--n > 0) {
--n;
Expand Down
2 changes: 1 addition & 1 deletion lib/v8.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

'use strict';

if (process.jsEngine === 'chakracore') {
if ('chakracore' in process.versions) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/node_trace_events.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ void Initialize(Local<Object> target,
FIXED_ONE_BYTE_STRING(env->isolate(), "isTraceCategoryEnabled");
Local<String> trace = FIXED_ONE_BYTE_STRING(env->isolate(), "trace");

#ifndef NODE_ENGINE_CHAKRACORE // CHAKRA-TODO: support bindings objects
#ifndef NODE_ENGINE_CHAKRACORE // CHAKRA-TODO: support bindings objects
// Grab the trace and isTraceCategoryEnabled intrinsics from the binding
// object and expose those to our binding layer.
Local<Object> binding = context->GetExtrasBindingObject();
Expand Down
14 changes: 7 additions & 7 deletions test/addons-napi/test_typedarray/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ assert.strictEqual(externalResult[2], 2);

// validate creation of all kinds of TypedArrays
const buffer = new ArrayBuffer(128);
let arrayTypes = [ Int8Array, Uint8Array, Uint8ClampedArray, Int16Array,
Uint16Array, Int32Array, Uint32Array, Float32Array,
Float64Array ];
const arrayTypes = [ Int8Array, Uint8Array, Uint8ClampedArray, Int16Array,
Uint16Array, Int32Array, Uint32Array, Float32Array,
Float64Array ];

if (!common.isChakraEngine) {
arrayTypes = arrayTypes.concat([BigInt64Array, BigUint64Array]);
arrayTypes.push(BigInt64Array, BigUint64Array);
}

arrayTypes.forEach((currentType) => {
Expand All @@ -67,11 +67,11 @@ arrayTypes.forEach((currentType) => {
}, RangeError);
});

let nonByteArrayTypes = [ Int16Array, Uint16Array, Int32Array, Uint32Array,
Float32Array, Float64Array];
const nonByteArrayTypes = [ Int16Array, Uint16Array, Int32Array, Uint32Array,
Float32Array, Float64Array];

if (!common.isChakraEngine) {
nonByteArrayTypes = nonByteArrayTypes.concat([BigInt64Array, BigUint64Array]);
nonByteArrayTypes.push(BigInt64Array, BigUint64Array);
}

nonByteArrayTypes.forEach((currentType) => {
Expand Down
97 changes: 33 additions & 64 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,15 @@ test-trace-events-fs-sync: PASS,FLAKY

[$jsEngine==chakracore]
# These tests are failing for Node-Chakracore and should eventually be fixed
test-assert-checktag : SKIP
test-assert-builtins-not-read-from-filesystem : SKIP
test-assert-checktag : SKIP
test-async-hooks-disable-during-promise : SKIP
test-async-hooks-enable-during-promise : SKIP
test-async-hooks-promise : SKIP
test-async-hooks-promise-enable-disable : SKIP
test-async-hooks-promise-triggerid : SKIP
test-async-wrap-promise-after-enabled : SKIP
test-buffer-bindingobj-no-zerofill : SKIP
test-buffer-sharedarraybuffer : SKIP
test-child-process-fork-net : PASS,FLAKY
test-crypto-dh : SKIP
test-crypto-dh-leak : SKIP
test-domain-abort-on-uncaught : SKIP
test-domain-no-error-handler-abort-on-uncaught-0 : SKIP
Expand All @@ -49,34 +46,45 @@ test-domain-no-error-handler-abort-on-uncaught-7 : SKIP
test-domain-no-error-handler-abort-on-uncaught-8 : SKIP
test-domain-no-error-handler-abort-on-uncaught-9 : SKIP
test-domain-promise : SKIP
test-fs-stat : SKIP
test-http-pipeline-flood : SKIP
test-http-same-map : SKIP
test-http2-client-upload : PASS,FLAKY
test-http2-server-rst-stream : SKIP
test-inspect-async-hook-setup-at-inspect : SKIP
test-inspector-multisession-js : SKIP
test-inspector-multisession-ws : SKIP
test-inspector-tracing-domain : SKIP
test-intl : SKIP
test-memory-usage : SKIP
test-module-main-extension-lookup : SKIP
test-performance-function : SKIP
test-postmortem-metadata: SKIP
test-process-env-symbols : SKIP
test-promises-unhandled-symbol-rejections : SKIP
test-repl : SKIP
test-repl-inspector : SKIP
test-repl-mode : SKIP
test-repl-pretty-custom-stack : SKIP
test-repl-pretty-stack : SKIP
test-repl-sigint : SKIP
test-repl-tab-complete : SKIP
test-util : SKIP
test-vm-cached-data : SKIP
test-vm-codegen : SKIP
test-vm-context : SKIP
test-vm-getters : SKIP
test-vm-global-define-property : SKIP
test-vm-global-identity : SKIP
test-vm-global-non-writable-properties : SKIP
test-vm-global-property-interceptors : SKIP
test-vm-harmony-symbols : SKIP
test-vm-low-stack-space : SKIP
test-vm-preserves-property : SKIP
test-vm-property-not-on-sandbox : SKIP
test-vm-proxies : SKIP
test-vm-strict-assign : SKIP

# These tests are flaky on ChakraCore
test-child-process-fork-net : PASS,FLAKY
test-http2-client-upload : PASS,FLAKY

# Depends on V8's custom GC behaviour
test-performance-gc : SKIP
test-common-gc : SKIP
test-net-connect-memleak : SKIP
test-performance-gc : SKIP

# ChakraCore does not support the chrome tracing framework
test-trace-events-all : SKIP
Expand All @@ -95,35 +103,6 @@ test-trace-events-v8 : SKIP
test-trace-events-vm : SKIP
test-trace-events-worker-metadata : SKIP

test-url-domain-ascii-unicode : SKIP
test-util : SKIP
test-util-format-shared-arraybuffer : SKIP
test-v8-serdes : SKIP
test-v8-deserialize-buffer : SKIP
test-vm-attributes-property-not-on-sandbox : SKIP
test-vm-cached-data : SKIP
test-vm-codegen : SKIP
test-vm-context : SKIP
test-vm-create-and-run-in-context : SKIP
test-vm-function-declaration : SKIP
test-vm-getters : SKIP
test-vm-global-define-property : SKIP
test-vm-global-identity : SKIP
test-vm-global-non-writable-properties : SKIP
test-vm-global-property-interceptors : SKIP
test-vm-harmony-symbols : SKIP
test-vm-indexed-properties : SKIP
test-vm-low-stack-space : SKIP
test-vm-preserves-property : SKIP
test-vm-property-not-on-sandbox : SKIP
test-vm-proxies : SKIP
test-vm-sigint : SKIP
test-vm-sigint-existing-handler : SKIP
test-vm-strict-assign : SKIP
test-vm-strict-mode : SKIP
test-vm-timeout : SKIP
test-zlib-convenience-methods : SKIP

# These tests are disabled for chakra engine because they depend
# on v8-option --abort-on-uncaught-exception
test-domain-throw-error-then-throw-from-uncaught-exception-handler : SKIP
Expand Down Expand Up @@ -159,6 +138,7 @@ test-stream-readable-async-iterators : SKIP
# These tests requires esmodule support, which is pending in node-chakracore https://github.com/nodejs/node-chakracore/issues/391
test-inspector-esm : SKIP
test-internal-module-wrap : SKIP
test-module-main-extension-lookup : SKIP
test-util-inspect-namespace : SKIP
test-vm-module-basic : SKIP
test-vm-module-dynamic-import : SKIP
Expand Down Expand Up @@ -198,6 +178,8 @@ test-async-hooks-destroy-on-gc : PASS,FLAKY

# This test fails because it requires V8's custom serialization and deserialization support
test-error-serdes : SKIP
test-v8-deserialize-buffer : SKIP
test-v8-serdes : SKIP

# These tests are for worker_threads support, which is currently not implemented in Node-ChakraCore
test-async-wrap-missing-method : SKIP
Expand Down Expand Up @@ -236,6 +218,10 @@ test-worker-workerdata-sharedarraybuffer : SKIP
# See bug https://github.com/nodejs/node-chakracore/issues/560
test-vm-createcacheddata : SKIP

# ChakraCore doesn't support `process.memoryUsage()`
# Issue: https://github.com/nodejs/node-chakracore/issues/563
test-zlib-unused-weak : SKIP

# Removed the wake->notify shim code
# Issue: https://github.com/nodejs/node-chakracore/issues/565
test-atomics-notify : SKIP
Expand All @@ -249,33 +235,16 @@ test-heapdump-tls : SKIP
test-heapdump-worker : SKIP
test-heapdump-zlib : SKIP

# Chakra doesn't yet support createCachedData.
# See bug https://github.com/nodejs/node-chakracore/issues/560
test-vm-createcacheddata : SKIP

# ChakraCore doesn't support `process.memoryUsage()`
# Issue: https://github.com/nodejs/node-chakracore/issues/563
test-zlib-unused-weak : SKIP

[$jsEngine==chakracore && $arch==x64]
# These tests are failing for Node-Chakracore and should eventually be fixed
test-buffer-includes : SKIP
test-buffer-indexof : SKIP
test-buffer-slow : SKIP
# broken for some reason on Node-chakracore
# see https://github.com/nodejs/node-chakracore/issues/536
test-env-newprotomethod-remove-unnecessary-prototypes : SKIP

[$jsEngine==chakracore && $system==win32]
# These tests are failing for Node-Chakracore and should eventually be fixed
test-http-client-get-url : SKIP
test-module-loading-globalpaths : SKIP

[$jsEngine==chakracore && $system==linux]
# These tests are failing for Node-Chakracore and should eventually be fixed
test-repl-sigint-nested-eval : SKIP

[$jsEngine==chakracore && $system==macos]
# These tests are failing for Node-Chakracore and should eventually be fixed
test-repl-sigint-nested-eval : SKIP
test-vm-sigint : SKIP
# Depends on ICU behavior, enable when ICU is enabled on Windows
test-intl: SKIP

[$jsEngine==chakracore && $system==win32 && $arch==arm]
# These tests depend on Git/Linux tools that don't exist on WoA
Expand Down
11 changes: 2 additions & 9 deletions test/parallel/test-buffer-alloc.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,15 +753,8 @@ assert.strictEqual('<Buffer 81 a3 66 6f 6f a3 62 61 72>', x.inspect());
// Call .fill() first, stops valgrind warning about uninitialized memory reads.
Buffer.allocUnsafe(3.3).fill().toString();
// throws bad argument error in commit 43cb4ec
Buffer.alloc(common.engineSpecificMessage({
v8: 3.3,
chakracore: Math.trunc(3.3) // new Uint8Array(3.3) throws
})).fill().toString();

if (!common.isChakraEngine) { // Skip on chakra, new Uint8Array(NaN) throws
assert.strictEqual(Buffer.allocUnsafe(NaN).length, 0);
}

Buffer.alloc(3.3).fill().toString();
assert.strictEqual(Buffer.allocUnsafe(NaN).length, 0);
assert.strictEqual(Buffer.allocUnsafe(3.3).length, 3);
assert.strictEqual(Buffer.from({ length: 3.3 }).length, 3);
assert.strictEqual(Buffer.from({ length: 'BAM' }).length, 0);
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-buffer-concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@ assert.strictEqual(flatLongLen.toString(), check);
}, {
code: 'ERR_INVALID_ARG_TYPE',
message: 'The "list" argument must be one of type Array, Buffer, ' +
`or Uint8Array. Received type ${typeof value}`
`or Uint8Array. Received type ${typeof value}`
});
});


[[42], ['hello', Buffer.from('world')]].forEach((value) => {
assert.throws(() => {
Buffer.concat(value);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
'use strict';
const common = require('../common');
require('../common');

// This test ensures that unnecessary prototypes are no longer
// being generated by Environment::NewFunctionTemplate.

//
// broken for some reason on Node-chakracore
// see https://github.com/nodejs/node-chakracore/issues/536
//
if (!common.isChakraEngine) {
const assert = require('assert');
const assert = require('assert');

[
process.binding('udp_wrap').UDP.prototype.bind6,
process.binding('tcp_wrap').TCP.prototype.bind6,
process.binding('udp_wrap').UDP.prototype.send6,
process.binding('tcp_wrap').TCP.prototype.bind,
process.binding('udp_wrap').UDP.prototype.close,
process.binding('tcp_wrap').TCP.prototype.open
].forEach((binding, i) => {
assert.strictEqual('prototype' in binding, false, `Test ${i} failed`);
});
}
[
process.binding('udp_wrap').UDP.prototype.bind6,
process.binding('tcp_wrap').TCP.prototype.bind6,
process.binding('udp_wrap').UDP.prototype.send6,
process.binding('tcp_wrap').TCP.prototype.bind,
process.binding('udp_wrap').UDP.prototype.close,
process.binding('tcp_wrap').TCP.prototype.open
].forEach((binding, i) => {
assert.strictEqual('prototype' in binding, false, `Test ${i} failed`);
});
3 changes: 0 additions & 3 deletions test/parallel/test-intl-v8BreakIterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ const common = require('../common');
const assert = require('assert');
const vm = require('vm');

if (common.isChakraEngine)
common.skip('not applicable to Chakra');

if (!common.hasIntl)
common.skip('missing Intl');

Expand Down
26 changes: 10 additions & 16 deletions test/parallel/test-intl.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ const common = require('../common');
const assert = require('assert');

// does node think that i18n was enabled?
// for chakra i18n is enabled
let enablei18n = common.engineSpecificMessage({
v8: process.config.variables.v8_enable_i18n_support,
chakracore: true
});

let enablei18n = process.config.variables.v8_enable_i18n_support;
if (enablei18n === undefined) {
enablei18n = 0;
}
Expand Down Expand Up @@ -87,28 +82,27 @@ if (!common.hasIntl) {

// Check casing
{
assert.strictEqual('I'.toLocaleLowerCase('tr'), 'ı');
// ChakraCore doesn't support taking a parameter for toLocaleLowerCase
// https://github.com/Microsoft/ChakraCore/issues/3710
assert.strictEqual('I'.toLocaleLowerCase('tr'),
common.engineSpecificMessage({
v8: 'ı',
chakracore: 'i',
}));
}

// Check with toLocaleString
{
const localeString = dtf.format(date0);
assert.strictEqual(localeString, common.engineSpecificMessage({
v8: 'Jan 70',
chakracore: '\u200EJan\u200E \u200E70'
}));
assert.strictEqual(localeString, 'Jan 70');
}
// Options to request GMT
const optsGMT = { timeZone: GMT };

// Test format
{
const localeString = date0.toLocaleString(['en'], optsGMT);
assert.strictEqual(localeString, common.engineSpecificMessage({
v8: '1/1/1970, 12:00:00 AM',
chakracore: '\u200E1\u200E/\u200E1\u200E/\u200E1970\u200E ' +
'\u200E12\u200E:\u200E00\u200E:\u200E00\u200E \u200EAM'
}));
assert.strictEqual(localeString, '1/1/1970, 12:00:00 AM');
}
// number format
const numberFormat = new Intl.NumberFormat(['en']).format(12345.67890);
Expand Down
Loading

0 comments on commit 531905c

Please sign in to comment.