From 3aff32b4cc446443ecf18a9572b250bd5690d16c Mon Sep 17 00:00:00 2001 From: sagudev <16504129+sagudev@users.noreply.github.com> Date: Wed, 31 Jul 2024 07:10:06 +0200 Subject: [PATCH 1/2] multiple reports in same json file Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --- moz-webgpu-cts/src/process_reports.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/moz-webgpu-cts/src/process_reports.rs b/moz-webgpu-cts/src/process_reports.rs index fd84e68..63720f0 100644 --- a/moz-webgpu-cts/src/process_reports.rs +++ b/moz-webgpu-cts/src/process_reports.rs @@ -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::{ @@ -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::(); + report_stream + .next() + .transpose() .or_else(|e| { if e.is_eof() && matches!((e.line(), e.column()), (1, 0)) { Ok(None) From 905b6b845aca868ca32a4e01561646b032a242cc Mon Sep 17 00:00:00 2001 From: sagudev <16504129+sagudev@users.noreply.github.com> Date: Wed, 31 Jul 2024 16:51:04 +0200 Subject: [PATCH 2/2] Warn on leftover JSON objects on firefox Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --- moz-webgpu-cts/src/process_reports.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/moz-webgpu-cts/src/process_reports.rs b/moz-webgpu-cts/src/process_reports.rs index 63720f0..01f3919 100644 --- a/moz-webgpu-cts/src/process_reports.rs +++ b/moz-webgpu-cts/src/process_reports.rs @@ -287,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!(