Skip to content

Commit

Permalink
Merge pull request #88 from ErichDonGubler/soft-rename-cmds-after-taint
Browse files Browse the repository at this point in the history
Soft-rename `process-reports` to `update-expected`, `fmt` to `fixup`
  • Loading branch information
ErichDonGubler authored Apr 15, 2024
2 parents 646f041 + 38e10e6 commit 8807c9f
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions moz-webgpu-cts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ enum Subcommand {
/// With both steps, you may delete the local copies of these reports after being processed
/// with `process-reports`. You should not need to re-process them unless you have made an
/// error in following these steps.
ProcessReports {
#[clap(alias = "process-reports")]
UpdateExpected {
/// Direct paths to report files to be processed.
report_paths: Vec<PathBuf>,
/// Cross-platform `wax` globs to enumerate report files to be processed.
Expand All @@ -88,9 +89,9 @@ enum Subcommand {
#[clap(long, default_value = "reset-contradictory")]
preset: ReportProcessingPreset,
},
/// Parse test metadata and re-emit it in normalized form.
#[clap(name = "fmt")]
Format,
/// Parse test metadata, apply automated fixups, and re-emit it in normalized form.
#[clap(name = "fixup", alias = "fmt")]
Fixup,
Triage {
#[clap(value_enum, long, default_value_t = Default::default())]
on_zero_item: OnZeroItem,
Expand Down Expand Up @@ -189,7 +190,7 @@ fn run(cli: Cli) -> ExitCode {
}

match subcommand {
Subcommand::ProcessReports {
Subcommand::UpdateExpected {
report_globs,
report_paths,
preset,
Expand Down Expand Up @@ -787,17 +788,17 @@ fn run(cli: Cli) -> ExitCode {

ExitCode::SUCCESS
}
Subcommand::Format => {
Subcommand::Fixup => {
let raw_test_files_by_path = match read_metadata() {
Ok(paths) => paths,
Err(AlreadyReportedToCommandline) => return ExitCode::FAILURE,
};
log::info!("formatting metadata in-place…");
let mut fmt_err_found = false;
let mut err_found = false;
for (path, file_contents) in raw_test_files_by_path {
match chumsky::Parser::parse(&File::parser(), &*file_contents).into_result() {
Err(errors) => {
fmt_err_found = true;
err_found = true;
render_metadata_parse_errors(&path, &file_contents, errors);
}
Ok(mut file) => {
Expand All @@ -814,14 +815,14 @@ fn run(cli: Cli) -> ExitCode {
match write_to_file(&path, metadata::format_file(&file)) {
Ok(()) => (),
Err(AlreadyReportedToCommandline) => {
fmt_err_found = true;
err_found = true;
}
};
}
}
}

if fmt_err_found {
if err_found {
log::error!(concat!(
"found one or more failures while formatting metadata, ",
"see above for more details"
Expand Down

0 comments on commit 8807c9f

Please sign in to comment.