From 2a9c9d36f3b53b68f6b18b34cdead524db2bf8b1 Mon Sep 17 00:00:00 2001 From: Nico Burns Date: Wed, 6 Nov 2024 00:12:29 +1300 Subject: [PATCH] WPT: print pass percentage --- apps/wpt/src/main.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/wpt/src/main.rs b/apps/wpt/src/main.rs index 6e23ae76..9b092e86 100644 --- a/apps/wpt/src/main.rs +++ b/apps/wpt/src/main.rs @@ -200,12 +200,24 @@ fn main() { }, ); + let pass_count = pass_count.load(Ordering::SeqCst); + let fail_count = fail_count.load(Ordering::SeqCst); + let crash_count = crash_count.load(Ordering::SeqCst); + let skip_count = skip_count.load(Ordering::SeqCst); + + let run_count = pass_count + fail_count + crash_count; + println!("---"); println!("Done in {}s", (Instant::now() - start).as_secs()); - println!("{} tests PASSED.", pass_count.load(Ordering::SeqCst)); - println!("{} tests FAILED.", fail_count.load(Ordering::SeqCst)); - println!("{} tests CRASHED.", crash_count.load(Ordering::SeqCst)); - println!("{} tests SKIPPED.", skip_count.load(Ordering::SeqCst)); + println!("{pass_count} tests PASSED."); + println!("{fail_count} tests FAILED."); + println!("{crash_count} tests CRASHED."); + println!("{skip_count} tests SKIPPED."); + println!("---"); + let pessimistic_percent = (pass_count as f32 / count as f32) * 100.0; + let optimistic_percent = (pass_count as f32 / run_count as f32) * 100.0; + println!("Percent of total: {pessimistic_percent:.2}%"); + println!("Percent of run: {optimistic_percent:.2}%"); } async fn serve(app: Router, port: u16) {