diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2019-01-02 23:52:38 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2019-01-10 19:54:57 +0800 |
commit | c667325cbea83ef50c72484692ca5c9114b43c4a (patch) | |
tree | a1d3b194c3379a142a3c1af5fb5a1780ccc09354 | |
parent | 8906e5209bb477c815534dbc965739f648d7ec11 (diff) | |
download | android-node-v8-c667325cbea83ef50c72484692ca5c9114b43c4a.tar.gz android-node-v8-c667325cbea83ef50c72484692ca5c9114b43c4a.tar.bz2 android-node-v8-c667325cbea83ef50c72484692ca5c9114b43c4a.zip |
test: support more icu requirements in the WPT status file
Support `small-icu` and `full-icu` requirements, where `full-icu`
implies `small-icu`.
PR-URL: https://github.com/nodejs/node/pull/25321
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
-rw-r--r-- | test/common/wpt.js | 48 | ||||
-rw-r--r-- | test/wpt/README.md | 2 | ||||
-rw-r--r-- | test/wpt/status/url.json | 4 |
3 files changed, 46 insertions, 8 deletions
diff --git a/test/common/wpt.js b/test/common/wpt.js index de8dd0fc42..0b4424ef73 100644 --- a/test/common/wpt.js +++ b/test/common/wpt.js @@ -1,7 +1,7 @@ +/* eslint-disable node-core/required-modules */ 'use strict'; const assert = require('assert'); -const common = require('../common'); const fixtures = require('../common/fixtures'); const fs = require('fs'); const fsPromises = fs.promises; @@ -160,12 +160,49 @@ class WPTTest { getContent() { return fs.readFileSync(this.getAbsolutePath(), 'utf8'); } +} + +const kIntlRequirement = { + none: 0, + small: 1, + full: 2, + // TODO(joyeecheung): we may need to deal with --with-intl=system-icu +}; + +class IntlRequirement { + constructor() { + this.currentIntl = kIntlRequirement.none; + if (process.config.variables.v8_enable_i18n_support === 0) { + this.currentIntl = kIntlRequirement.none; + return; + } + // i18n enabled + if (process.config.variables.icu_small) { + this.currentIntl = kIntlRequirement.small; + } else { + this.currentIntl = kIntlRequirement.full; + } + } - requireIntl() { - return this.requires.has('intl'); + /** + * @param {Set} requires + * @returns {string|false} The config that the build is lacking, or false + */ + isLacking(requires) { + const current = this.currentIntl; + if (requires.has('full-icu') && current !== kIntlRequirement.full) { + return 'full-icu'; + } + if (requires.has('small-icu') && current < kIntlRequirement.small) { + return 'small-icu'; + } + return false; } } +const intlRequirements = new IntlRequirement(); + + class StatusLoader { constructor(path) { this.path = path; @@ -498,8 +535,9 @@ class WPTRunner { continue; } - if (!common.hasIntl && test.requireIntl()) { - this.skip(filename, [ 'missing Intl' ]); + const lackingIntl = intlRequirements.isLacking(test.requires); + if (lackingIntl) { + this.skip(filename, [ `requires ${lackingIntl}` ]); continue; } diff --git a/test/wpt/README.md b/test/wpt/README.md index ff9092e6a1..15318b2aef 100644 --- a/test/wpt/README.md +++ b/test/wpt/README.md @@ -151,7 +151,7 @@ expected failures. { "something.scope.js": { // the file name // Optional: If the requirement is not met, this test will be skipped - "requires": ["intl"], // currently only intl is supported + "requires": ["small-icu"], // supports: "small-icu", "full-icu" // Optional: the test will be skipped with the reason printed "skip": "explain why we cannot run a test that's supposed to pass", diff --git a/test/wpt/status/url.json b/test/wpt/status/url.json index 42b5f6fb1a..fa27b25abd 100644 --- a/test/wpt/status/url.json +++ b/test/wpt/status/url.json @@ -1,10 +1,10 @@ { "toascii.window.js": { - "requires": ["intl"], + "requires": ["small-icu"], "skip": "TODO: port from .window.js" }, "historical.any.js": { - "requires": ["intl"] + "requires": ["small-icu"] }, "urlencoded-parser.any.js": { "fail": "missing Request and Response" |