|
| 1 | +/* eslint-disable node-core/required-modules */ |
1 | 2 | 'use strict';
|
2 | 3 |
|
3 | 4 | const assert = require('assert');
|
4 |
| -const common = require('../common'); |
5 | 5 | const fixtures = require('../common/fixtures');
|
6 | 6 | const fs = require('fs');
|
7 | 7 | const fsPromises = fs.promises;
|
@@ -160,12 +160,49 @@ class WPTTest {
|
160 | 160 | getContent() {
|
161 | 161 | return fs.readFileSync(this.getAbsolutePath(), 'utf8');
|
162 | 162 | }
|
| 163 | +} |
| 164 | + |
| 165 | +const kIntlRequirement = { |
| 166 | + none: 0, |
| 167 | + small: 1, |
| 168 | + full: 2, |
| 169 | + // TODO(joyeecheung): we may need to deal with --with-intl=system-icu |
| 170 | +}; |
| 171 | + |
| 172 | +class IntlRequirement { |
| 173 | + constructor() { |
| 174 | + this.currentIntl = kIntlRequirement.none; |
| 175 | + if (process.config.variables.v8_enable_i18n_support === 0) { |
| 176 | + this.currentIntl = kIntlRequirement.none; |
| 177 | + return; |
| 178 | + } |
| 179 | + // i18n enabled |
| 180 | + if (process.config.variables.icu_small) { |
| 181 | + this.currentIntl = kIntlRequirement.small; |
| 182 | + } else { |
| 183 | + this.currentIntl = kIntlRequirement.full; |
| 184 | + } |
| 185 | + } |
163 | 186 |
|
164 |
| - requireIntl() { |
165 |
| - return this.requires.has('intl'); |
| 187 | + /** |
| 188 | + * @param {Set} requires |
| 189 | + * @returns {string|false} The config that the build is lacking, or false |
| 190 | + */ |
| 191 | + isLacking(requires) { |
| 192 | + const current = this.currentIntl; |
| 193 | + if (requires.has('full-icu') && current !== kIntlRequirement.full) { |
| 194 | + return 'full-icu'; |
| 195 | + } |
| 196 | + if (requires.has('small-icu') && current < kIntlRequirement.small) { |
| 197 | + return 'small-icu'; |
| 198 | + } |
| 199 | + return false; |
166 | 200 | }
|
167 | 201 | }
|
168 | 202 |
|
| 203 | +const intlRequirements = new IntlRequirement(); |
| 204 | + |
| 205 | + |
169 | 206 | class StatusLoader {
|
170 | 207 | constructor(path) {
|
171 | 208 | this.path = path;
|
@@ -498,8 +535,9 @@ class WPTRunner {
|
498 | 535 | continue;
|
499 | 536 | }
|
500 | 537 |
|
501 |
| - if (!common.hasIntl && test.requireIntl()) { |
502 |
| - this.skip(filename, [ 'missing Intl' ]); |
| 538 | + const lackingIntl = intlRequirements.isLacking(test.requires); |
| 539 | + if (lackingIntl) { |
| 540 | + this.skip(filename, [ `requires ${lackingIntl}` ]); |
503 | 541 | continue;
|
504 | 542 | }
|
505 | 543 |
|
|
0 commit comments