| 558 | |
| 559 | class WPTRunner { |
| 560 | constructor(path, { concurrency = os.availableParallelism() - 1 || 1 } = {}) { |
| 561 | // RISC-V has very limited virtual address space in the currently common |
| 562 | // sv39 mode, in which we can only create a very limited number of wasm |
| 563 | // memories(27 from a fresh node repl). Limit the concurrency to avoid |
| 564 | // creating too many wasm memories that would fail. |
| 565 | if (process.arch === 'riscv64' || process.arch === 'riscv32') { |
| 566 | concurrency = Math.min(10, concurrency); |
| 567 | } |
| 568 | |
| 569 | this.path = path; |
| 570 | this.resource = new ResourceLoader(path); |
| 571 | this.concurrency = concurrency; |
| 572 | |
| 573 | this.flags = []; |
| 574 | this.globalThisInitScripts = []; |
| 575 | this.initScript = null; |
| 576 | |
| 577 | this.status = new StatusLoader(path); |
| 578 | this.status.load(); |
| 579 | this.statusFile = this.status.statusFile; |
| 580 | this.specs = new Set(this.status.specs); |
| 581 | |
| 582 | this.results = {}; |
| 583 | this.inProgress = new Set(); |
| 584 | this.workers = new Map(); |
| 585 | this.unexpectedFailures = []; |
| 586 | |
| 587 | this.subtestCounts = { passed: 0, failed: 0, expectedFailures: 0, skipped: 0, unexpectedPasses: 0 }; |
| 588 | |
| 589 | if (process.env.WPT_REPORT != null) { |
| 590 | this.report = new WPTReport(path); |
| 591 | } |
| 592 | } |
| 593 | |
| 594 | /** |
| 595 | * Sets the Node.js flags passed to the worker. |