@@ -8,7 +8,7 @@ use self::{
88 BuildProfile , File , FileProps , Platform , Subtest , SubtestOutcome , Test , TestOutcome ,
99 TestProps ,
1010 } ,
11- process_reports:: { MaybeDisabled , OutcomesForComparison , TestOutcomes } ,
11+ process_reports:: { Entry , TestEntry } ,
1212 report:: {
1313 ExecutionReport , RunInfo , SubtestExecutionResult , TestExecutionEntry , TestExecutionResult ,
1414 } ,
@@ -26,6 +26,7 @@ use std::{
2626 sync:: { mpsc:: channel, Arc } ,
2727} ;
2828
29+ use camino:: Utf8PathBuf ;
2930use clap:: { Parser , ValueEnum } ;
3031use enumset:: EnumSetType ;
3132use format:: lazy_format;
@@ -139,17 +140,8 @@ fn run(cli: Cli) -> ExitCode {
139140 } ;
140141
141142 let read_metadata = || -> Result < _ , AlreadyReportedToCommandline > {
142- let webgpu_cts_meta_parent_dir = {
143- path ! (
144- & gecko_checkout
145- | "testing"
146- | "web-platform"
147- | "mozilla"
148- | "meta"
149- | "webgpu"
150- | "chunked"
151- )
152- } ;
143+ let webgpu_cts_meta_parent_dir =
144+ { path ! ( & gecko_checkout | "testing" | "web-platform" | "mozilla" | "meta" | "webgpu" ) } ;
153145
154146 let mut found_err = false ;
155147 let collected =
@@ -323,51 +315,43 @@ fn run(cli: Cli) -> ExitCode {
323315 files
324316 } ;
325317
326- let mut outcomes_by_test = IndexMap :: < TestPath , TestOutcomes > :: default ( ) ;
318+ let mut file_props_by_file = IndexMap :: < Utf8PathBuf , FileProps > :: default ( ) ;
319+ let mut entries_by_test = IndexMap :: < TestPath < ' _ > , TestEntry > :: default ( ) ;
327320
328321 log:: info!( "loading metadata for comparison to reports…" ) ;
329322 for ( path, file) in meta_files_by_path {
330- let File {
331- properties : FileProps { } ,
332- tests,
333- } = file;
323+ let File { properties, tests } = file;
324+
325+ let file_rel_path = path. strip_prefix ( & gecko_checkout) . unwrap ( ) ;
326+
327+ file_props_by_file. insert (
328+ Utf8PathBuf :: from ( file_rel_path. to_str ( ) . unwrap ( ) ) ,
329+ properties,
330+ ) ;
334331
335332 for ( SectionHeader ( name) , test) in tests {
336333 let Test {
337- properties :
338- TestProps {
339- is_disabled,
340- expectations,
341- } ,
334+ properties,
342335 subtests,
343336 } = test;
344337
345- let test_path = TestPath :: from_fx_metadata_test (
346- path. strip_prefix ( & gecko_checkout) . unwrap ( ) ,
347- & name,
348- )
349- . unwrap ( ) ;
338+ let test_path = TestPath :: from_fx_metadata_test ( file_rel_path, & name) . unwrap ( ) ;
350339
351340 let freak_out_do_nothing = |what : & dyn Display | {
352341 log:: error!( "hoo boy, not sure what to do yet: {what}" )
353342 } ;
354343
355- let TestOutcomes {
356- test_outcomes : recorded_test_outcomes ,
357- subtests : recorded_subtests ,
358- } = outcomes_by_test
344+ let TestEntry {
345+ entry : test_entry ,
346+ subtests : subtest_entries ,
347+ } = entries_by_test
359348 . entry ( test_path. clone ( ) . into_owned ( ) )
360349 . or_default ( ) ;
361350
362351 let test_path = & test_path;
363352 let mut reported_dupe_already = false ;
364353
365- let maybe_disabled = if is_disabled {
366- MaybeDisabled :: Disabled
367- } else {
368- MaybeDisabled :: Enabled ( expectations)
369- } ;
370- if let Some ( _old) = recorded_test_outcomes. metadata . replace ( maybe_disabled) {
354+ if let Some ( _old) = test_entry. meta_props . replace ( properties) {
371355 freak_out_do_nothing (
372356 & lazy_format ! (
373357 "duplicate entry for {test_path:?}, discarding previous entries with this and further dupes"
@@ -377,23 +361,10 @@ fn run(cli: Cli) -> ExitCode {
377361 }
378362
379363 for ( SectionHeader ( subtest_name) , subtest) in subtests {
380- let Subtest {
381- properties :
382- TestProps {
383- is_disabled,
384- expectations,
385- } ,
386- } = subtest;
387- let recorded_subtest_outcomes =
388- recorded_subtests. entry ( subtest_name. clone ( ) ) . or_default ( ) ;
389- let maybe_disabled = if is_disabled {
390- MaybeDisabled :: Disabled
391- } else {
392- MaybeDisabled :: Enabled ( expectations)
393- } ;
394- if let Some ( _old) =
395- recorded_subtest_outcomes. metadata . replace ( maybe_disabled)
396- {
364+ let Subtest { properties } = subtest;
365+ let subtest_entry =
366+ subtest_entries. entry ( subtest_name. clone ( ) ) . or_default ( ) ;
367+ if let Some ( _old) = subtest_entry. meta_props . replace ( properties) {
397368 if !reported_dupe_already {
398369 freak_out_do_nothing ( & lazy_format ! (
399370 "duplicate subtest in {test_path:?} named {subtest_name:?}, discarding previous entries with this and further dupes"
@@ -452,10 +423,10 @@ fn run(cli: Cli) -> ExitCode {
452423 let TestExecutionEntry { test_name, result } = entry;
453424
454425 let test_path = TestPath :: from_execution_report ( & test_name) . unwrap ( ) ;
455- let TestOutcomes {
456- test_outcomes : recorded_test_outcomes ,
457- subtests : recorded_subtests ,
458- } = outcomes_by_test
426+ let TestEntry {
427+ entry : test_entry ,
428+ subtests : subtest_entries ,
429+ } = entries_by_test
459430 . entry ( test_path. clone ( ) . into_owned ( ) )
460431 . or_default ( ) ;
461432
@@ -494,26 +465,26 @@ fn run(cli: Cli) -> ExitCode {
494465 }
495466 }
496467 accumulate (
497- & mut recorded_test_outcomes . reported ,
468+ & mut test_entry . reported ,
498469 platform,
499470 build_profile,
500471 reported_outcome,
501472 ) ;
502473
503474 for reported_subtest in reported_subtests {
504475 let SubtestExecutionResult {
505- subtest_name : reported_subtest_name ,
506- outcome : reported_outcome ,
476+ subtest_name,
477+ outcome,
507478 } = reported_subtest;
508479
509480 accumulate (
510- & mut recorded_subtests
511- . entry ( reported_subtest_name . clone ( ) )
481+ & mut subtest_entries
482+ . entry ( subtest_name . clone ( ) )
512483 . or_default ( )
513484 . reported ,
514485 platform,
515486 build_profile,
516- reported_outcome ,
487+ outcome ,
517488 ) ;
518489 }
519490 }
@@ -523,29 +494,28 @@ fn run(cli: Cli) -> ExitCode {
523494
524495 let mut found_reconciliation_err = false ;
525496 let recombined_tests_iter =
526- outcomes_by_test
497+ entries_by_test
527498 . into_iter ( )
528- . filter_map ( |( test_path, outcomes ) | {
499+ . filter_map ( |( test_path, test_entry ) | {
529500 fn reconcile < Out > (
530- outcomes : OutcomesForComparison < Out > ,
501+ entry : Entry < Out > ,
531502 preset : ReportProcessingPreset ,
532503 ) -> TestProps < Out >
533504 where
534505 Out : Debug + Default + EnumSetType ,
535506 {
536- let OutcomesForComparison { metadata, reported } = outcomes;
537-
538- let metadata = metadata
539- . map ( |maybe_disabled| {
540- maybe_disabled. map_enabled ( |opt| opt. unwrap_or_default ( ) )
541- } )
542- . unwrap_or_default ( ) ;
543-
507+ let Entry {
508+ meta_props,
509+ reported,
510+ } = entry;
544511 let normalize = NormalizedExpectationPropertyValue :: from_fully_expanded;
545512
546- let reconciled_expectations = metadata. map_enabled ( |metadata| {
513+ let mut meta_props = meta_props. unwrap_or_default ( ) ;
514+ meta_props. expectations = Some ( ' resolve: {
547515 let resolve = match preset {
548- ReportProcessingPreset :: ResetAll => return normalize ( reported) ,
516+ ReportProcessingPreset :: ResetAll => {
517+ break ' resolve normalize ( reported) ;
518+ }
549519 ReportProcessingPreset :: ResetContradictory => {
550520 |meta : Expectation < _ > , rep : Option < Expectation < _ > > | {
551521 rep. filter ( |rep| !meta. is_superset ( rep) ) . unwrap_or ( meta)
@@ -565,7 +535,11 @@ fn run(cli: Cli) -> ExitCode {
565535 (
566536 build_profile,
567537 resolve (
568- metadata. get ( platform, build_profile) ,
538+ meta_props
539+ . expectations
540+ . as_ref ( )
541+ . unwrap_or ( & Default :: default ( ) )
542+ . get ( platform, build_profile) ,
569543 reported
570544 . get ( & platform)
571545 . and_then ( |rep| {
@@ -581,28 +555,18 @@ fn run(cli: Cli) -> ExitCode {
581555 . collect ( ) ,
582556 )
583557 } ) ;
584-
585- match reconciled_expectations {
586- MaybeDisabled :: Disabled => TestProps {
587- is_disabled : true ,
588- expectations : Default :: default ( ) ,
589- } ,
590- MaybeDisabled :: Enabled ( expectations) => TestProps {
591- is_disabled : false ,
592- expectations : Some ( expectations) ,
593- } ,
594- }
558+ meta_props
595559 }
596560
597- let TestOutcomes {
598- test_outcomes ,
599- subtests : recorded_subtests ,
600- } = outcomes ;
561+ let TestEntry {
562+ entry : test_entry ,
563+ subtests : subtest_entries ,
564+ } = test_entry ;
601565
602- let properties = reconcile ( test_outcomes , preset) ;
566+ let properties = reconcile ( test_entry , preset) ;
603567
604568 let mut subtests = BTreeMap :: new ( ) ;
605- for ( subtest_name, subtest) in recorded_subtests {
569+ for ( subtest_name, subtest) in subtest_entries {
606570 let subtest_name = SectionHeader ( subtest_name) ;
607571 if subtests. get ( & subtest_name) . is_some ( ) {
608572 found_reconciliation_err = true ;
@@ -630,8 +594,18 @@ fn run(cli: Cli) -> ExitCode {
630594 let mut files = BTreeMap :: < PathBuf , File > :: new ( ) ;
631595 for ( test_path, ( properties, subtests) ) in recombined_tests_iter {
632596 let name = test_path. test_name ( ) . to_string ( ) ;
633- let path = gecko_checkout. join ( test_path. rel_metadata_path_fx ( ) . to_string ( ) ) ;
634- let file = files. entry ( path) . or_default ( ) ;
597+ let rel_path = Utf8PathBuf :: from ( test_path. rel_metadata_path_fx ( ) . to_string ( ) ) ;
598+ let path = gecko_checkout. join ( & rel_path) ;
599+ let file = files. entry ( path) . or_insert_with ( || File {
600+ properties : file_props_by_file
601+ . get ( & rel_path)
602+ . cloned ( )
603+ . unwrap_or_else ( || {
604+ log:: warn!( "creating new metadata file for `{rel_path}`" ) ;
605+ Default :: default ( )
606+ } ) ,
607+ tests : Default :: default ( ) ,
608+ } ) ;
635609 file. tests . insert (
636610 SectionHeader ( name) ,
637611 Test {
@@ -715,7 +689,7 @@ fn run(cli: Cli) -> ExitCode {
715689 . into_result ( )
716690 {
717691 Ok ( File {
718- properties : FileProps { } ,
692+ properties : _ ,
719693 tests,
720694 } ) => Some ( tests. into_iter ( ) . map ( |( name, inner) | {
721695 let SectionHeader ( name) = & name;
@@ -1223,15 +1197,7 @@ fn run(cli: Cli) -> ExitCode {
12231197 }
12241198 Subcommand :: ReadTestVariants => {
12251199 let webgpu_cts_test_parent_dir = {
1226- path ! (
1227- & gecko_checkout
1228- | "testing"
1229- | "web-platform"
1230- | "mozilla"
1231- | "tests"
1232- | "webgpu"
1233- | "chunked"
1234- )
1200+ path ! ( & gecko_checkout | "testing" | "web-platform" | "mozilla" | "tests" | "webgpu" )
12351201 } ;
12361202
12371203 let tests_by_path = match read_gecko_files_at (
0 commit comments