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 /test/common | |
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>
Diffstat (limited to 'test/common')
-rw-r--r-- | test/common/wpt.js | 48 |
1 files changed, 43 insertions, 5 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; } |