Skip to content

Commit

Permalink
diag(process_reports): clarify meta. test entry path base name mismat…
Browse files Browse the repository at this point in the history
…ches
  • Loading branch information
ErichDonGubler committed Jan 15, 2025
1 parent c809a8d commit fa94dcf
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions moz-webgpu-cts/src/wpt/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl<'a> TestEntryPath<'a> {
rel_meta_file_path: rel_meta_file_path.as_std_path(),
test_name,
};
let (spec_type, rel_meta_file_path) = {
let (spec_type, rel_meta_file_path_stripped) = {
let test_base_name = rel_meta_file_path
.as_str()
.strip_suffix(".ini")
Expand All @@ -301,7 +301,7 @@ impl<'a> TestEntryPath<'a> {
};

let (root_dir, path) = browser
.strip_wpt_root_dir_prefix(rel_meta_file_path)
.strip_wpt_root_dir_prefix(rel_meta_file_path_stripped)
.map_err(|_e| other_err())?;

let Ok(path) = path.strip_prefix("meta/") else {
Expand All @@ -316,7 +316,12 @@ impl<'a> TestEntryPath<'a> {

let expected_base_name = path.components().next_back().unwrap();
if expected_base_name != Utf8Component::Normal(base_name) {
return Err(other_err());
return Err(MetadataTestEntryPathError::BaseFileNameMismatch {
rel_meta_file_path: rel_meta_file_path.as_std_path(),
expected: expected_base_name.as_str(),
actual: base_name,
actual_span: 0..base_name.len(),
});
}

Ok(Self {
Expand Down Expand Up @@ -469,6 +474,18 @@ impl Display for ExecutionReportPathError<'_> {
/// An error encountered during [`TestEntryPath::from_metadata_test`].
#[derive(Debug, thiserror::Error)]
pub enum MetadataTestEntryPathError<'a> {
#[error(
"test entry name mismatch in metadata file at relative path {:?}; expected entry to start with {:?}, got {:?}",
rel_meta_file_path,
expected,
actual
)]
BaseFileNameMismatch {
rel_meta_file_path: &'a Path,
expected: &'a str,
actual: &'a str,
actual_span: std::ops::Range<usize>,
},
#[error(
"failed to derive test path from metadata file at relative path {:?} given entry with test name {:?}",
rel_meta_file_path,
Expand Down

0 comments on commit fa94dcf

Please sign in to comment.