Skip to content

Commit c20202b

Browse files
committed
rel_metadata_path_fx for servo
1 parent 38c2413 commit c20202b

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},
@@ -427,11 +427,13 @@ fn run(cli: Cli) -> ExitCode {
427427
.into_par_iter()
428428
.for_each_with(exec_reports_sender, |sender, path| {
429429
let res = fs::File::open(&path)
430-
.map(BufReader::new)
431430
.map_err(Report::msg)
432431
.wrap_err("failed to open file")
433-
.and_then(|reader| {
434-
serde_json::from_reader::<_, ExecutionReport>(reader)
432+
.and_then(|mut f| {
433+
let mut s = String::new();
434+
f.read_to_string(&mut s).unwrap();
435+
let first = s.lines().next().unwrap();
436+
serde_json::from_str::<ExecutionReport>(first)
435437
.into_diagnostic()
436438
.wrap_err("failed to parse JSON")
437439
})
@@ -713,7 +715,7 @@ fn run(cli: Cli) -> ExitCode {
713715
let mut files = BTreeMap::<PathBuf, File>::new();
714716
for (test_path, (properties, subtests)) in recombined_tests_iter {
715717
let name = test_path.test_name().to_string();
716-
let rel_path = Utf8PathBuf::from(test_path.rel_metadata_path_fx().to_string());
718+
let rel_path = Utf8PathBuf::from(test_path.rel_metadata_path_fx(servo).to_string());
717719
let path = gecko_checkout.join(&rel_path);
718720
let file = files.entry(path).or_insert_with(|| File {
719721
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)