Skip to content

Commit

Permalink
multiple reports in same json file
Browse files Browse the repository at this point in the history
Signed-off-by: sagudev <[email protected]>
  • Loading branch information
sagudev committed Jul 31, 2024
1 parent ffb043c commit 3aff32b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions moz-webgpu-cts/src/process_reports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use format::lazy_format;
use indexmap::IndexMap;
use miette::{IntoDiagnostic, Report, WrapErr};
use rayon::prelude::{IntoParallelIterator, ParallelIterator};
use serde_json::Deserializer;
use whippit::metadata::SectionHeader;

use crate::{
Expand Down Expand Up @@ -266,8 +267,17 @@ pub(crate) fn process_reports(
.map_err(Report::msg)
.wrap_err("failed to open file")
.and_then(|reader| {
serde_json::from_reader::<_, ExecutionReport>(reader)
.map(Some)
// Servo can have two reports in same json file (two-record JSONL file)
// First one is from the first run (all test are run/reported)
// second one only runs unexpected results (from first run) for filtering
//
// TODO(sagudev): merge reports instead of using only first one

let mut report_stream =
Deserializer::from_reader(reader).into_iter::<ExecutionReport>();
report_stream
.next()
.transpose()
.or_else(|e| {
if e.is_eof() && matches!((e.line(), e.column()), (1, 0)) {
Ok(None)
Expand Down

0 comments on commit 3aff32b

Please sign in to comment.