Skip to content

Commit 0e24bcc

Browse files
Revert "Write tests in report order after processing reports (#163)"
This reverts commit b22da1e.
1 parent 0205f22 commit 0e24bcc

4 files changed

Lines changed: 95 additions & 96 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

moz-webgpu-cts/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ enum-map = { version = "2.7.3", features = ["serde"] }
2424
enumset = { version = "1.1.3", features = ["serde"] }
2525
env_logger = { workspace = true }
2626
format = { workspace = true }
27-
indexmap = { workspace = true, features = ["serde"] }
27+
indexmap = { workspace = true }
2828
itertools = "0.11.0"
2929
joinery = "3.1.0"
3030
lets_find_up = "0.0.3"

moz-webgpu-cts/src/process_reports.rs

Lines changed: 89 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ where
4646
#[derive(Debug, Default)]
4747
pub(crate) struct TestEntry {
4848
pub entry: Entry<TestOutcome>,
49-
pub subtests: IndexMap<String, Entry<SubtestOutcome>>,
49+
pub subtests: BTreeMap<String, Entry<SubtestOutcome>>,
5050
}
5151

5252
#[derive(Debug)]
@@ -186,6 +186,93 @@ pub(crate) fn process_reports(
186186
let mut other_entries_by_test = IndexMap::<TestEntryPath<'_>, TestEntry>::default();
187187
let old_meta_file_paths = meta_files_by_path.keys().cloned().collect::<Vec<_>>();
188188

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

191278
let (exec_reports_sender, exec_reports_receiver) = channel();
@@ -322,93 +409,6 @@ pub(crate) fn process_reports(
322409
}
323410
}
324411

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

414414
let entries_by_cts_path = entries_by_cts_path.into_iter().map(|(_name, entry)| {
@@ -582,7 +582,7 @@ pub(crate) fn process_reports(
582582
},
583583
))
584584
})
585-
.collect::<IndexMap<_, _>>();
585+
.collect::<BTreeMap<_, _>>();
586586

587587
Some((test_entry_path, (properties, subtests)))
588588
},

moz-webgpu-cts/src/wpt/metadata.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::{
2+
collections::BTreeMap,
23
fmt::{self, Display, Formatter},
34
hash::Hash,
45
};
@@ -7,7 +8,6 @@ use clap::ValueEnum;
78
use enum_map::Enum;
89
use enumset::EnumSetType;
910
use format::lazy_format;
10-
use indexmap::IndexMap;
1111
use joinery::JoinableIterator;
1212
use maybe_collapsed::MaybeCollapsed;
1313
use serde::{Deserialize, Serialize};
@@ -45,7 +45,7 @@ pub(crate) mod properties;
4545
#[derive(Clone, Debug, Default, Serialize)]
4646
pub struct File {
4747
pub properties: FileProps,
48-
pub tests: IndexMap<SectionHeader, Test>,
48+
pub tests: BTreeMap<SectionHeader, Test>,
4949
}
5050

5151
impl File {
@@ -650,7 +650,7 @@ impl ImplementationStatus {
650650
}
651651

652652
#[derive(Debug, Default)]
653-
pub struct Tests(IndexMap<SectionHeader, Test>);
653+
pub struct Tests(BTreeMap<SectionHeader, Test>);
654654

655655
impl<'a> metadata::Tests<'a> for Tests {
656656
type Test = Test;
@@ -673,7 +673,7 @@ impl<'a> metadata::Tests<'a> for Tests {
673673
#[derive(Clone, Debug, Default, Serialize)]
674674
pub struct Test {
675675
pub properties: TestProps<TestOutcome>,
676-
pub subtests: IndexMap<SectionHeader, Subtest>,
676+
pub subtests: BTreeMap<SectionHeader, Subtest>,
677677
}
678678

679679
#[cfg(test)]
@@ -697,7 +697,7 @@ impl metadata::Test<'_> for Test {
697697
}
698698

699699
#[derive(Default)]
700-
pub struct Subtests(IndexMap<SectionHeader, Subtest>);
700+
pub struct Subtests(BTreeMap<SectionHeader, Subtest>);
701701

702702
impl<'a> metadata::Subtests<'a> for Subtests {
703703
type Subtest = Subtest;

0 commit comments

Comments
 (0)