Skip to content
Permalink
Browse files

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: #25321
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information...
joyeecheung authored and addaleax committed Jan 2, 2019
1 parent d9adcee commit 8d8c30599a25af55feb7e761b1bcf654c1d44d52
Showing with 46 additions and 8 deletions.
  1. +43 −5 test/common/wpt.js
  2. +1 −1 test/wpt/README.md
  3. +2 −2 test/wpt/status/url.json
@@ -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;
}

@@ -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",
@@ -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"

0 comments on commit 8d8c305

Please sign in to comment.
You can’t perform that action at this time.