Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple reports in same json file #132

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 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 All @@ -277,6 +287,12 @@ pub(crate) fn process_reports(
})
.into_diagnostic()
.wrap_err("failed to parse JSON")
.inspect(|_| {
let count = report_stream.count();
if count > 0 && browser != Browser::Servo {
log::warn!("{} contains {count} leftover objects", path.display());
}
})
})
.wrap_err_with(|| {
format!(
Expand Down
Loading