Skip to content

Commit

Permalink
WIP: feat(update_expected): accept multiple implementation_statuses…
Browse files Browse the repository at this point in the history
… as a set
  • Loading branch information
ErichDonGubler committed Jul 30, 2024
1 parent 2cebb47 commit f34d765
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
38 changes: 23 additions & 15 deletions moz-webgpu-cts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use std::{
use crate::wpt::path::Browser;
use camino::Utf8PathBuf;
use clap::{Parser, ValueEnum};
use enumset::EnumSetType;
use enumset::{EnumSet, EnumSetType};
use format::lazy_format;
use indexmap::{IndexMap, IndexSet};
use itertools::Itertools;
Expand Down Expand Up @@ -84,9 +84,10 @@ enum Subcommand {
/// The heuristic for resolving differences between current metadata and processed reports.
#[clap(long, default_value = "reset-contradictory")]
preset: UpdateExpectedPreset,
/// The `implementation-status` that changes should be applied to.
#[clap(value_enum, long, default_value_t = ImplementationStatus::Backlog)]
implementation_status: ImplementationStatus,
/// `implementation-status`es that changes should be applied to. If not specified, defaults
/// to `implementing`.
#[clap(value_enum, long)]
implementation_status: Vec<ImplementationStatus>,
},
/// Parse test metadata, apply automated fixups, and re-emit it in normalized form.
#[clap(name = "fixup", alias = "fmt")]
Expand Down Expand Up @@ -291,16 +292,23 @@ fn run(cli: Cli) -> ExitCode {
exec_report_spec,
preset,
implementation_status,
} => match process_reports(
browser,
&checkout,
exec_report_spec,
preset.into(),
implementation_status,
) {
Ok(()) => ExitCode::SUCCESS,
Err(AlreadyReportedToCommandline) => ExitCode::FAILURE,
},
} => {
let implementation_status = if implementation_status.is_empty() {
ImplementationStatus::default().into()
} else {
EnumSet::from_iter(implementation_status)
};
match process_reports(
browser,
&checkout,
exec_report_spec,
preset.into(),
implementation_status,
) {
Ok(()) => ExitCode::SUCCESS,
Err(AlreadyReportedToCommandline) => ExitCode::FAILURE,
}
}
Subcommand::Fixup => {
log::info!("fixing up metadata in-place…");
let err_found = read_and_parse_all_metadata(browser, &checkout)
Expand Down Expand Up @@ -1280,7 +1288,7 @@ fn process_reports(
checkout: &Path,
exec_report_spec: ExecReportSpec,
preset: process_reports::ReportProcessingPreset,
implementation_status: ImplementationStatus,
implementation_status: EnumSet<ImplementationStatus>,
) -> Result<(), AlreadyReportedToCommandline> {
let exec_report_paths = exec_report_spec.paths()?;

Expand Down
6 changes: 3 additions & 3 deletions moz-webgpu-cts/src/process_reports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{
};

use camino::Utf8PathBuf;
use enumset::EnumSetType;
use enumset::{EnumSet, EnumSetType};
use format::lazy_format;
use indexmap::IndexMap;
use miette::{IntoDiagnostic, Report, WrapErr};
Expand Down Expand Up @@ -53,7 +53,7 @@ pub(crate) struct ProcessReportsArgs<'a> {
pub checkout: &'a Path,
pub exec_report_paths: Vec<PathBuf>,
pub preset: ReportProcessingPreset,
pub implementation_status: ImplementationStatus,
pub implementation_status: EnumSet<ImplementationStatus>,
pub meta_files_by_path: IndexMap<Arc<PathBuf>, File>,
}

Expand Down Expand Up @@ -110,7 +110,7 @@ fn reconcile<Out>(
meta_props: &mut TestProps<Out>,
reported: BTreeMap<Platform, BTreeMap<BuildProfile, Expected<Out>>>,
preset: ReportProcessingPreset,
implementation_status_filter: ImplementationStatus,
implementation_status_filter: EnumSet<ImplementationStatus>,
) where
Out: Debug + Default + EnumSetType,
{
Expand Down
2 changes: 1 addition & 1 deletion moz-webgpu-cts/src/wpt/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ fn format_file_properties(props: &FileProps) -> impl Display + '_ {
})
}

#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Serialize, ValueEnum)]
#[derive(Debug, Default, EnumSetType, Serialize, ValueEnum)]
pub enum ImplementationStatus {
/// Indicates that functionality governing test(s) is implemented or currently being
/// implemented, and generally expected to conform to tests.
Expand Down

0 comments on commit f34d765

Please sign in to comment.