@@ -62,6 +62,33 @@ struct Cli {
6262
6363#[ derive( Debug , Parser ) ]
6464enum Subcommand {
65+ /// Migrate old test structure in metadata to that found in `wptreport.json` reports.
66+ ///
67+ /// When a new version of CTS is run by your implementation of WebGPU, new execution reports
68+ /// may differ from old ones in various ways:
69+ ///
70+ /// 1. Test may have been added, deleted, or moved.
71+ ///
72+ /// It requires human judgment to determine what additions and deletions are actually
73+ /// movements of the same test coverage.
74+ /// 2. Tests' actual outcomes on your implementation may change, since implementations of
75+ /// existing tests may have changed.
76+ ///
77+ /// This command implements (only) the changes from (1) in your metadata by using the reports
78+ /// you provide to:
79+ ///
80+ /// 1. Remove _all_ metadata from test paths that are currently in metadata, but not observedn
81+ /// execution reports.
82+ /// 2. Add empty metadata entries for test paths that are observed in execution reports, but
83+ /// absent from current metadata.
84+ ///
85+ /// The diff produced by the above changes makes it easier to determine what tests may have
86+ /// moved, and, by extension, whether you should attempt to migrate metadata for subsequent
87+ /// test runs.
88+ Migrate {
89+ #[ clap( flatten) ]
90+ exec_report_spec : ExecReportSpec ,
91+ } ,
6592 /// Adjust expected test outcomes in metadata, optionally using `wptreport.json` reports from
6693 /// CI runs covering your browser's implementation of WebGPU.
6794 ///
@@ -292,6 +319,16 @@ fn run(cli: Cli) -> ExitCode {
292319 } ;
293320
294321 match subcommand {
322+ Subcommand :: Migrate { exec_report_spec } => match process_reports (
323+ browser,
324+ & checkout,
325+ exec_report_spec,
326+ process_reports:: ReportProcessingPreset :: MigrateTestStructure ,
327+ & mut should_update_expected:: NeverUpdateExpected ,
328+ ) {
329+ Ok ( ( ) ) => ExitCode :: SUCCESS ,
330+ Err ( AlreadyReportedToCommandline ) => ExitCode :: FAILURE ,
331+ } ,
295332 Subcommand :: UpdateExpected {
296333 exec_report_spec,
297334 preset,
0 commit comments