| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c17f268 commit 9d3768e
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -593,7 +593,6 @@ test-wpt-report: | |||
| 593 | 593 | $(RM) -r out/wpt | |
| 594 | 594 | mkdir -p out/wpt | |
| 595 | 595 | WPT_REPORT=1 $(PYTHON) tools/test.py --shell $(NODE) $(PARALLEL_ARGS) wpt | |
| 596 | - $(NODE) "$$PWD/tools/merge-wpt-reports.mjs" | ||
| 597 | 596 | ||
| 598 | 597 | .PHONY: test-internet | |
| 599 | 598 | test-internet: all | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,8 +10,6 @@ const os = require('os'); | |||
| 10 | 10 | const { inspect } = require('util'); | |
| 11 | 11 | const { Worker } = require('worker_threads'); | |
| 12 | 12 | ||
| 13 | - const workerPath = path.join(__dirname, 'wpt/worker.js'); | ||
| 14 | - | ||
| 15 | 13 | function getBrowserProperties() { | |
| 16 | 14 | const { node: version } = process.versions; // e.g. 18.13.0, 20.0.0-nightly202302078e6e215481 | |
| 17 | 15 | const release = /^\d+\.\d+\.\d+$/.test(version); | |
@@ -59,8 +57,7 @@ function codeUnitStr(char) { | |||
| 59 | 57 | } | |
| 60 | 58 | ||
| 61 | 59 | class WPTReport { | |
| 62 | - constructor(path) { | ||
| 63 | - this.filename = `report-${path.replaceAll('/', '-')}.json`; | ||
| 60 | + constructor() { | ||
| 64 | 61 | this.results = []; | |
| 65 | 62 | this.time_start = Date.now(); | |
| 66 | 63 | } | |
@@ -99,18 +96,26 @@ class WPTReport { | |||
| 99 | 96 | return result; | |
| 100 | 97 | }); | |
| 101 | 98 | ||
| 102 | - /** | ||
| 103 | - * Return required and some optional properties | ||
| 104 | - * https://github.com/web-platform-tests/wpt.fyi/blob/60da175/api/README.md?plain=1#L331-L335 | ||
| 105 | - */ | ||
| 106 | - this.run_info = { | ||
| 107 | - product: 'node.js', | ||
| 108 | - ...getBrowserProperties(), | ||
| 109 | - revision: process.env.WPT_REVISION || 'unknown', | ||
| 110 | - os: getOs(), | ||
| 111 | - }; | ||
| 99 | + if (fs.existsSync('out/wpt/wptreport.json')) { | ||
| 100 | + const prev = JSON.parse(fs.readFileSync('out/wpt/wptreport.json')); | ||
| 101 | + this.results = [...prev.results, ...this.results]; | ||
| 102 | + this.time_start = prev.time_start; | ||
| 103 | + this.time_end = Math.max(this.time_end, prev.time_end); | ||
| 104 | + this.run_info = prev.run_info; | ||
| 105 | + } else { | ||
| 106 | + /** | ||
| 107 | + * Return required and some optional properties | ||
| 108 | + * https://github.com/web-platform-tests/wpt.fyi/blob/60da175/api/README.md?plain=1#L331-L335 | ||
| 109 | + */ | ||
| 110 | + this.run_info = { | ||
| 111 | + product: 'node.js', | ||
| 112 | + ...getBrowserProperties(), | ||
| 113 | + revision: process.env.WPT_REVISION || 'unknown', | ||
| 114 | + os: getOs(), | ||
| 115 | + }; | ||
| 116 | + } | ||
| 112 | 117 | ||
| 113 | - fs.writeFileSync(`out/wpt/${this.filename}`, JSON.stringify(this)); | ||
| 118 | + fs.writeFileSync('out/wpt/wptreport.json', JSON.stringify(this)); | ||
| 114 | 119 | } | |
| 115 | 120 | } | |
| 116 | 121 | ||
@@ -397,29 +402,6 @@ const kIncomplete = 'incomplete'; | |||
| 397 | 402 | const kUncaught = 'uncaught'; | |
| 398 | 403 | const NODE_UNCAUGHT = 100; | |
| 399 | 404 | ||
| 400 | - const limit = (concurrency) => { | ||
| 401 | - let running = 0; | ||
| 402 | - const queue = []; | ||
| 403 | - | ||
| 404 | - const execute = async (fn) => { | ||
| 405 | - if (running < concurrency) { | ||
| 406 | - running++; | ||
| 407 | - try { | ||
| 408 | - await fn(); | ||
| 409 | - } finally { | ||
| 410 | - running--; | ||
| 411 | - if (queue.length > 0) { | ||
| 412 | - execute(queue.shift()); | ||
| 413 | - } | ||
| 414 | - } | ||
| 415 | - } else { | ||
| 416 | - queue.push(fn); | ||
| 417 | - } | ||
| 418 | - }; | ||
| 419 | - | ||
| 420 | - return execute; | ||
| 421 | - }; | ||
| 422 | - | ||
| 423 | 405 | class WPTRunner { | |
| 424 | 406 | constructor(path) { | |
| 425 | 407 | this.path = path; | |
@@ -443,7 +425,7 @@ class WPTRunner { | |||
| 443 | 425 | this.scriptsModifier = null; | |
| 444 | 426 | ||
| 445 | 427 | if (process.env.WPT_REPORT != null) { | |
| 446 | - this.report = new WPTReport(path); | ||
| 428 | + this.report = new WPTReport(); | ||
| 447 | 429 | } | |
| 448 | 430 | } | |
| 449 | 431 | ||
@@ -561,8 +543,6 @@ class WPTRunner { | |||
| 561 | 543 | ||
| 562 | 544 | this.inProgress = new Set(queue.map((spec) => spec.filename)); | |
| 563 | 545 | ||
| 564 | - const run = limit(os.availableParallelism()); | ||
| 565 | - | ||
| 566 | 546 | for (const spec of queue) { | |
| 567 | 547 | const testFileName = spec.filename; | |
| 568 | 548 | const content = spec.getContent(); | |
@@ -596,7 +576,15 @@ class WPTRunner { | |||
| 596 | 576 | this.scriptsModifier?.(obj); | |
| 597 | 577 | scriptsToRun.push(obj); | |
| 598 | 578 | ||
| 599 | - const runWorker = async (variant) => { | ||
| 579 | + /** | ||
| 580 | + * Example test with no META variant | ||
| 581 | + * https://github.com/nodejs/node/blob/03854f6/test/fixtures/wpt/WebCryptoAPI/sign_verify/hmac.https.any.js#L1-L4 | ||
| 582 | + * | ||
| 583 | + * Example test with multiple META variants | ||
| 584 | + * https://github.com/nodejs/node/blob/03854f6/test/fixtures/wpt/WebCryptoAPI/generateKey/successes_RSASSA-PKCS1-v1_5.https.any.js#L1-L9 | ||
| 585 | + */ | ||
| 586 | + for (const variant of meta.variant || ['']) { | ||
| 587 | + const workerPath = path.join(__dirname, 'wpt/worker.js'); | ||
| 600 | 588 | const worker = new Worker(workerPath, { | |
| 601 | 589 | execArgv: this.flags, | |
| 602 | 590 | workerData: { | |
@@ -647,17 +635,6 @@ class WPTRunner { | |||
| 647 | 635 | }); | |
| 648 | 636 | ||
| 649 | 637 | await events.once(worker, 'exit').catch(() => {}); | |
| 650 | - }; | ||
| 651 | - | ||
| 652 | - /** | ||
| 653 | - * Example test with no META variant | ||
| 654 | - * https://github.com/nodejs/node/blob/03854f6/test/fixtures/wpt/WebCryptoAPI/sign_verify/hmac.https.any.js#L1-L4 | ||
| 655 | - * | ||
| 656 | - * Example test with multiple META variants | ||
| 657 | - * https://github.com/nodejs/node/blob/03854f6/test/fixtures/wpt/WebCryptoAPI/generateKey/successes_RSASSA-PKCS1-v1_5.https.any.js#L1-L9 | ||
| 658 | - */ | ||
| 659 | - for (const variant of meta.variant || ['']) { | ||
| 660 | - run(() => runWorker(variant)); | ||
| 661 | 638 | } | |
| 662 | 639 | } | |
| 663 | 640 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,4 +3,4 @@ | |||
| 3 | 3 | import testpy | |
| 4 | 4 | ||
| 5 | 5 | def GetConfiguration(context, root): | |
| 6 | - return testpy.ParallelTestConfiguration(context, root, 'wpt') | ||
| 6 | + return testpy.SimpleTestConfiguration(context, root, 'wpt') | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments