Skip to content

Commit 9d3768e

Browse files
panvatargos
authored andcommitted
Revert "test: run WPT files in parallel again"
This reverts commit c05689e. PR-URL: #47627 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
1 parent c17f268 commit 9d3768e

4 files changed

Lines changed: 31 additions & 87 deletions

File tree

‎Makefile‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,6 @@ test-wpt-report:
593593
$(RM) -r out/wpt
594594
mkdir -p out/wpt
595595
WPT_REPORT=1 $(PYTHON) tools/test.py --shell $(NODE)$(PARALLEL_ARGS) wpt
596-
$(NODE)"$$PWD/tools/merge-wpt-reports.mjs"
597596

598597
.PHONY: test-internet
599598
test-internet: all

‎test/common/wpt.js‎

Lines changed: 30 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ const os = require('os');
1010
const{ inspect }=require('util');
1111
const{ Worker }=require('worker_threads');
1212

13-
constworkerPath=path.join(__dirname,'wpt/worker.js');
14-
1513
functiongetBrowserProperties(){
1614
const{node: version}=process.versions;// e.g. 18.13.0, 20.0.0-nightly202302078e6e215481
1715
constrelease=/^\d+\.\d+\.\d+$/.test(version);
@@ -59,8 +57,7 @@ function codeUnitStr(char) {
5957
}
6058

6159
classWPTReport{
62-
constructor(path){
63-
this.filename=`report-${path.replaceAll('/','-')}.json`;
60+
constructor(){
6461
this.results=[];
6562
this.time_start=Date.now();
6663
}
@@ -99,18 +96,26 @@ class WPTReport {
9996
returnresult;
10097
});
10198

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+
constprev=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+
}
112117

113-
fs.writeFileSync(`out/wpt/${this.filename}`,JSON.stringify(this));
118+
fs.writeFileSync('out/wpt/wptreport.json',JSON.stringify(this));
114119
}
115120
}
116121

@@ -397,29 +402,6 @@ const kIncomplete = 'incomplete';
397402
constkUncaught='uncaught';
398403
constNODE_UNCAUGHT=100;
399404

400-
constlimit=(concurrency)=>{
401-
letrunning=0;
402-
constqueue=[];
403-
404-
constexecute=async(fn)=>{
405-
if(running<concurrency){
406-
running++;
407-
try{
408-
awaitfn();
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-
returnexecute;
421-
};
422-
423405
classWPTRunner{
424406
constructor(path){
425407
this.path=path;
@@ -443,7 +425,7 @@ class WPTRunner {
443425
this.scriptsModifier=null;
444426

445427
if(process.env.WPT_REPORT!=null){
446-
this.report=newWPTReport(path);
428+
this.report=newWPTReport();
447429
}
448430
}
449431

@@ -561,8 +543,6 @@ class WPTRunner {
561543

562544
this.inProgress=newSet(queue.map((spec)=>spec.filename));
563545

564-
construn=limit(os.availableParallelism());
565-
566546
for(constspecofqueue){
567547
consttestFileName=spec.filename;
568548
constcontent=spec.getContent();
@@ -596,7 +576,15 @@ class WPTRunner {
596576
this.scriptsModifier?.(obj);
597577
scriptsToRun.push(obj);
598578

599-
construnWorker=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(constvariantofmeta.variant||['']){
587+
constworkerPath=path.join(__dirname,'wpt/worker.js');
600588
constworker=newWorker(workerPath,{
601589
execArgv: this.flags,
602590
workerData: {
@@ -647,17 +635,6 @@ class WPTRunner {
647635
});
648636

649637
awaitevents.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(constvariantofmeta.variant||['']){
660-
run(()=>runWorker(variant));
661638
}
662639
}
663640

‎test/wpt/testcfg.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
importtestpy
44

55
defGetConfiguration(context, root):
6-
returntestpy.ParallelTestConfiguration(context, root, 'wpt')
6+
returntestpy.SimpleTestConfiguration(context, root, 'wpt')

‎tools/merge-wpt-reports.mjs‎

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)