Skip to content

Commit 546cc4e

Browse files
committed
rel_metadata_path_fx for servo
1 parent c42be4c commit 546cc4e

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

moz-webgpu-cts/src/main.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use std::{
2020
fmt::{self, Debug, Display, Formatter},
2121
fs,
2222
hash::Hash,
23-
io::{self, BufReader, BufWriter},
23+
io::{self, BufReader, BufWriter, Read},
2424
path::{Path, PathBuf},
2525
process::ExitCode,
2626
sync::{mpsc::channel, Arc},
@@ -426,11 +426,13 @@ fn run(cli: Cli) -> ExitCode {
426426
.into_par_iter()
427427
.for_each_with(exec_reports_sender, |sender, path| {
428428
let res = fs::File::open(&path)
429-
.map(BufReader::new)
430429
.map_err(Report::msg)
431430
.wrap_err("failed to open file")
432-
.and_then(|reader| {
433-
serde_json::from_reader::<_, ExecutionReport>(reader)
431+
.and_then(|mut f| {
432+
let mut s = String::new();
433+
f.read_to_string(&mut s).unwrap();
434+
let first = s.lines().next().unwrap();
435+
serde_json::from_str::<ExecutionReport>(first)
434436
.into_diagnostic()
435437
.wrap_err("failed to parse JSON")
436438
})
@@ -712,7 +714,7 @@ fn run(cli: Cli) -> ExitCode {
712714
let mut files = BTreeMap::<PathBuf, File>::new();
713715
for (test_path, (properties, subtests)) in recombined_tests_iter {
714716
let name = test_path.test_name().to_string();
715-
let rel_path = Utf8PathBuf::from(test_path.rel_metadata_path_fx().to_string());
717+
let rel_path = Utf8PathBuf::from(test_path.rel_metadata_path_fx(servo).to_string());
716718
let path = gecko_checkout.join(&rel_path);
717719
let file = files.entry(path).or_insert_with(|| File {
718720
properties: file_props_by_file

moz-webgpu-cts/src/shared.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -488,17 +488,23 @@ impl<'a> TestPath<'a> {
488488
})
489489
}
490490

491-
pub(crate) fn rel_metadata_path_fx(&self) -> impl Display + '_ {
491+
pub(crate) fn rel_metadata_path_fx(&self, servo: bool) -> impl Display + '_ {
492492
let Self {
493493
path,
494494
variant: _,
495495
scope,
496496
} = self;
497497

498-
let scope_dir = match scope {
499-
// TODO: servo
500-
TestScope::Public => SCOPE_DIR_FX_PUBLIC_COMPONENTS,
501-
TestScope::FirefoxPrivate => SCOPE_DIR_FX_PRIVATE_COMPONENTS,
498+
let scope_dir = if !servo {
499+
match scope {
500+
TestScope::Public => SCOPE_DIR_FX_PUBLIC_COMPONENTS,
501+
TestScope::FirefoxPrivate => SCOPE_DIR_FX_PRIVATE_COMPONENTS,
502+
}
503+
} else {
504+
match scope {
505+
TestScope::Public => SCOPE_DIR_SERVO_PUBLIC_COMPONENTS,
506+
TestScope::FirefoxPrivate => todo!(),
507+
}
502508
}
503509
.iter()
504510
.chain(&["meta"])

0 commit comments

Comments
 (0)