Skip to content

Commit c9e6119

Browse files
refactor!: move(process_reports): read reports, _then_ metadata
1 parent a4705fd commit c9e6119

1 file changed

Lines changed: 87 additions & 87 deletions

File tree

moz-webgpu-cts/src/process_reports.rs

Lines changed: 87 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -176,93 +176,6 @@ pub(crate) fn process_reports(
176176
let mut other_entries_by_test = IndexMap::<TestEntryPath<'_>, TestEntry>::default();
177177
let old_meta_file_paths = meta_files_by_path.keys().cloned().collect::<Vec<_>>();
178178

179-
log::debug!("loading metadata for comparison to reports…");
180-
for (path, file) in meta_files_by_path {
181-
let File { properties, tests } = file;
182-
183-
let file_rel_path = path.strip_prefix(checkout).unwrap();
184-
185-
file_props_by_file.insert(
186-
Utf8PathBuf::from(file_rel_path.to_str().unwrap()),
187-
properties,
188-
);
189-
190-
for (SectionHeader(name), test) in tests {
191-
let Test {
192-
properties,
193-
subtests,
194-
} = test;
195-
196-
let test_entry_path =
197-
match TestEntryPath::from_metadata_test(browser, file_rel_path, &name) {
198-
Ok(ok) => ok,
199-
Err(e) => {
200-
log::error!("{e}");
201-
return Err(AlreadyReportedToCommandline);
202-
}
203-
};
204-
205-
let freak_out_do_nothing =
206-
|what: &dyn Display| log::error!("hoo boy, not sure what to do yet: {what}");
207-
208-
let mut reported_dupe_already = false;
209-
let mut dupe_err = || {
210-
if !reported_dupe_already {
211-
freak_out_do_nothing(&format_args!(
212-
concat!(
213-
"duplicate entry for {:?}",
214-
"discarding previous entries with ",
215-
"this and further dupes"
216-
),
217-
test_entry_path
218-
))
219-
}
220-
reported_dupe_already = true;
221-
};
222-
223-
let TestEntry {
224-
entry: test_entry,
225-
subtests: subtest_entries,
226-
} = if let Some(cts_path) = cts_path(&test_entry_path) {
227-
let entry = entries_by_cts_path.entry(cts_path).or_default();
228-
if let Some(_old) = entry
229-
.metadata_path
230-
.replace(test_entry_path.clone().into_owned())
231-
{
232-
dupe_err();
233-
}
234-
&mut entry.entry
235-
} else {
236-
other_entries_by_test
237-
.entry(test_entry_path.clone().into_owned())
238-
.or_default()
239-
};
240-
241-
let test_entry_path = &test_entry_path;
242-
243-
if let Some(_old) = test_entry.meta_props.replace(properties) {
244-
dupe_err();
245-
}
246-
247-
for (SectionHeader(subtest_name), subtest) in subtests {
248-
let Subtest { properties } = subtest;
249-
let subtest_entry = subtest_entries.entry(subtest_name.clone()).or_default();
250-
if let Some(_old) = subtest_entry.meta_props.replace(properties) {
251-
if !reported_dupe_already {
252-
freak_out_do_nothing(&format_args!(
253-
concat!(
254-
"duplicate subtest in {:?} named {:?}, ",
255-
"discarding previous entries with ",
256-
"this and further dupes"
257-
),
258-
test_entry_path, subtest_name
259-
));
260-
}
261-
}
262-
}
263-
}
264-
}
265-
266179
log::debug!("gathering reported test outcomes for reconciliation with metadata…");
267180

268181
let (exec_reports_sender, exec_reports_receiver) = channel();
@@ -399,6 +312,93 @@ pub(crate) fn process_reports(
399312
}
400313
}
401314

315+
log::debug!("loading metadata for comparison to reports…");
316+
for (path, file) in meta_files_by_path {
317+
let File { properties, tests } = file;
318+
319+
let file_rel_path = path.strip_prefix(checkout).unwrap();
320+
321+
file_props_by_file.insert(
322+
Utf8PathBuf::from(file_rel_path.to_str().unwrap()),
323+
properties,
324+
);
325+
326+
for (SectionHeader(name), test) in tests {
327+
let Test {
328+
properties,
329+
subtests,
330+
} = test;
331+
332+
let test_entry_path =
333+
match TestEntryPath::from_metadata_test(browser, file_rel_path, &name) {
334+
Ok(ok) => ok,
335+
Err(e) => {
336+
log::error!("{e}");
337+
return Err(AlreadyReportedToCommandline);
338+
}
339+
};
340+
341+
let freak_out_do_nothing =
342+
|what: &dyn Display| log::error!("hoo boy, not sure what to do yet: {what}");
343+
344+
let mut reported_dupe_already = false;
345+
let mut dupe_err = || {
346+
if !reported_dupe_already {
347+
freak_out_do_nothing(&format_args!(
348+
concat!(
349+
"duplicate entry for {:?}",
350+
"discarding previous entries with ",
351+
"this and further dupes"
352+
),
353+
test_entry_path
354+
))
355+
}
356+
reported_dupe_already = true;
357+
};
358+
359+
let TestEntry {
360+
entry: test_entry,
361+
subtests: subtest_entries,
362+
} = if let Some(cts_path) = cts_path(&test_entry_path) {
363+
let entry = entries_by_cts_path.entry(cts_path).or_default();
364+
if let Some(_old) = entry
365+
.metadata_path
366+
.replace(test_entry_path.clone().into_owned())
367+
{
368+
dupe_err();
369+
}
370+
&mut entry.entry
371+
} else {
372+
other_entries_by_test
373+
.entry(test_entry_path.clone().into_owned())
374+
.or_default()
375+
};
376+
377+
let test_entry_path = &test_entry_path;
378+
379+
if let Some(_old) = test_entry.meta_props.replace(properties) {
380+
dupe_err();
381+
}
382+
383+
for (SectionHeader(subtest_name), subtest) in subtests {
384+
let Subtest { properties } = subtest;
385+
let subtest_entry = subtest_entries.entry(subtest_name.clone()).or_default();
386+
if let Some(_old) = subtest_entry.meta_props.replace(properties) {
387+
if !reported_dupe_already {
388+
freak_out_do_nothing(&format_args!(
389+
concat!(
390+
"duplicate subtest in {:?} named {:?}, ",
391+
"discarding previous entries with ",
392+
"this and further dupes"
393+
),
394+
test_entry_path, subtest_name
395+
));
396+
}
397+
}
398+
}
399+
}
400+
}
401+
402402
log::debug!("metadata and reports gathered, now reconciling outcomes…");
403403

404404
let entries_by_cts_path = entries_by_cts_path.into_iter().map(|(_name, entry)| {

0 commit comments

Comments
 (0)