Skip to content

Commit ae37237

Browse files
refactor!: move(process_reports): read reports, _then_ metadata
1 parent 04a14b1 commit ae37237

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
@@ -177,93 +177,6 @@ pub(crate) fn process_reports(
177177
let mut other_entries_by_test = IndexMap::<TestEntryPath<'_>, TestEntry>::default();
178178
let old_meta_file_paths = meta_files_by_path.keys().cloned().collect::<Vec<_>>();
179179

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

269182
let (exec_reports_sender, exec_reports_receiver) = channel();
@@ -400,6 +313,93 @@ pub(crate) fn process_reports(
400313
}
401314
}
402315

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

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

0 commit comments

Comments
 (0)