@@ -325,7 +325,24 @@ fn run(cli: Cli) -> ExitCode {
325325 files
326326 } ;
327327
328+ #[ derive( Debug , Default ) ]
329+ struct EntryByCtsPath < ' a > {
330+ metadata_path : Option < TestPath < ' a > > ,
331+ reported_path : Option < TestPath < ' a > > ,
332+ entry : TestEntry ,
333+ }
334+
335+ fn cts_path ( test_path : & TestPath < ' _ > ) -> Option < String > {
336+ test_path
337+ . variant
338+ . as_ref ( )
339+ . filter ( |v| v. starts_with ( "?q=webgpu:" ) )
340+ . map ( |v| v. strip_prefix ( "?q=" ) . unwrap ( ) . to_owned ( ) )
341+ . filter ( |_q| test_path. path . ends_with ( "cts.https.html" ) )
342+ }
343+
328344 let mut file_props_by_file = IndexMap :: < Utf8PathBuf , FileProps > :: default ( ) ;
345+ let mut entries_by_cts_path = IndexMap :: < String , EntryByCtsPath < ' _ > > :: default ( ) ;
329346 let mut other_entries_by_test = IndexMap :: < TestPath < ' _ > , TestEntry > :: default ( ) ;
330347 let old_meta_file_paths = meta_files_by_path. keys ( ) . cloned ( ) . collect :: < Vec < _ > > ( ) ;
331348
@@ -370,9 +387,19 @@ fn run(cli: Cli) -> ExitCode {
370387 let TestEntry {
371388 entry : test_entry,
372389 subtests : subtest_entries,
373- } = other_entries_by_test
374- . entry ( test_path. clone ( ) . into_owned ( ) )
375- . or_default ( ) ;
390+ } = if let Some ( cts_path) = cts_path ( & test_path) {
391+ let entry = entries_by_cts_path. entry ( cts_path) . or_default ( ) ;
392+ if let Some ( _old) =
393+ entry. metadata_path . replace ( test_path. clone ( ) . into_owned ( ) )
394+ {
395+ dupe_err ( ) ;
396+ }
397+ & mut entry. entry
398+ } else {
399+ other_entries_by_test
400+ . entry ( test_path. clone ( ) . into_owned ( ) )
401+ . or_default ( )
402+ } ;
376403
377404 let test_path = & test_path;
378405
@@ -451,9 +478,32 @@ fn run(cli: Cli) -> ExitCode {
451478 let TestEntry {
452479 entry : test_entry,
453480 subtests : subtest_entries,
454- } = other_entries_by_test
455- . entry ( test_path. clone ( ) . into_owned ( ) )
456- . or_default ( ) ;
481+ } = if let Some ( cts_path) = cts_path ( & test_path) {
482+ let entry = entries_by_cts_path. entry ( cts_path) . or_default ( ) ;
483+ if let Some ( old) =
484+ entry. reported_path . replace ( test_path. clone ( ) . into_owned ( ) )
485+ {
486+ if old != test_path {
487+ log:: warn!(
488+ concat!(
489+ "found test execution entry containing the same " ,
490+ "CTS test path as another, " ,
491+ "discarding previous entries with " ,
492+ "this and further dupes; entries:\n " ,
493+ "older: {:#?}\n " ,
494+ "newer: {:#?}\n " ,
495+ ) ,
496+ old,
497+ test_path
498+ )
499+ }
500+ }
501+ & mut entry. entry
502+ } else {
503+ other_entries_by_test
504+ . entry ( test_path. clone ( ) . into_owned ( ) )
505+ . or_default ( )
506+ } ;
457507
458508 let ( reported_outcome, reported_subtests) = match result {
459509 TestExecutionResult :: Complete { outcome, subtests } => ( outcome, subtests) ,
@@ -518,9 +568,43 @@ fn run(cli: Cli) -> ExitCode {
518568 log:: info!( "metadata and reports gathered, now reconciling outcomes…" ) ;
519569
520570 let mut found_reconciliation_err = false ;
521- let recombined_tests_iter = other_entries_by_test. into_iter ( ) ;
522- let recombined_tests_iter =
523- recombined_tests_iter. filter_map ( |( test_path, test_entry) | {
571+ let entries_by_cts_path = entries_by_cts_path. into_iter ( ) . map ( |( _name, entry) | {
572+ let EntryByCtsPath {
573+ metadata_path,
574+ reported_path,
575+ entry,
576+ } = entry;
577+ let output_path = if let Some ( ( meta, rep) ) = metadata_path
578+ . as_ref ( )
579+ . zip ( reported_path. as_ref ( ) )
580+ . filter ( |( meta, rep) | meta != rep)
581+ {
582+ log:: info!(
583+ concat!(
584+ "metadata path for test is different from " ,
585+ "reported execution; relocating…\n " ,
586+ "…metadata: {:#?}\n " ,
587+ "…reported: {:#?}\n "
588+ ) ,
589+ meta,
590+ rep
591+ ) ;
592+ reported_path
593+ } else {
594+ metadata_path. or ( reported_path)
595+ } ;
596+
597+ (
598+ output_path. expect ( concat ! (
599+ "internal error: CTS path entry created without at least one " ,
600+ "report or metadata path specified"
601+ ) ) ,
602+ entry,
603+ )
604+ } ) ;
605+ let recombined_tests_iter = entries_by_cts_path
606+ . chain ( other_entries_by_test)
607+ . filter_map ( |( test_path, test_entry) | {
524608 fn reconcile < Out > (
525609 entry : Entry < Out > ,
526610 preset : ReportProcessingPreset ,
0 commit comments