Skip to content

Commit 66f996f

Browse files
committed
Make WPT percentages relative to subtests run
1 parent c846e01 commit 66f996f

5 files changed

Lines changed: 23 additions & 16 deletions

File tree

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ foldhash = "0.2.0"
3232
grass = { version = "0.13", default-features = false }
3333

3434
[features]
35+
36+
# [patch.crates-io]
37+
# wptreport = { path = "../../../wpt-rs/crates/wptreport" }

src/main.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,15 @@ use axum::{
66
Router,
77
};
88
use dashmap::DashMap;
9-
use dioxus::{
10-
core::{ComponentFunction, SpawnIfAsync},
11-
prelude::*,
12-
};
9+
use dioxus::{core::ComponentFunction, prelude::*};
1310
use dioxus_html_macro::html;
14-
use reqwest::{Client, RequestBuilder};
1511
use routes::{
16-
AboutPage, ArcWptReport, ArcWptScores, CssSupportPage, ElementSupportPage, EventSupportPage,
17-
GettingStartedPage, HomePage, NLNetInstructionsPage, WptResultsPage, WptResultsPageProps,
12+
AboutPage, CssSupportPage, ElementSupportPage, EventSupportPage, GettingStartedPage, HomePage,
13+
NLNetInstructionsPage, WptResultsPage, WptResultsPageProps,
1814
};
1915
use std::{
20-
io::Cursor,
2116
net::{IpAddr, SocketAddr},
22-
sync::{Arc, LazyLock},
17+
sync::LazyLock,
2318
time::{Duration, Instant},
2419
};
2520
use tokio::net::TcpListener;

src/routes/nlnet_instructions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub fn NLNetInstructionsPage() -> Element {
8282
just build
8383
"#
8484
}
85-
}
85+
}
8686
}
8787
li {
8888
dangerous_inner_html: r#"

src/routes/wpt.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,8 @@ pub fn WptResultsPage(report: ArcWptReport, scores: ArcWptScores) -> Element {
7676
}
7777
p {
7878
font_size: "smaller",
79-
"Note: As it does not have a JavaScript engine, Blitz can only count about 25% of the subtests (because Blitz's test runner will see a test with many
80-
subtests generated by JS as only 1 test. And of those, it can only run approximately 2/3rd's (as many depend on JS). The numbers here use the
81-
number of (sub)tests that Blitz's test runner can see as the denominator, and counts tests skipped as failures.
79+
"Note: As it does not have a JavaScript engine, Blitz can only run about 20% of the total subtests. In the numbers below, tests that Blitz can't run are ignored
80+
and percentages are relative to the number of tests run.
8281
"
8382
}
8483
WptResults { scores }

src/wpt.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ use std::{
55
};
66

77
use reqwest::Client;
8-
use wptreport::{score_wpt_report, wpt_report::WptReport};
8+
use wptreport::{
9+
score_wpt_report,
10+
wpt_report::{TestStatus, WptReport},
11+
};
912

1013
use crate::routes::{ArcWptReport, ArcWptScores};
1114

@@ -21,7 +24,8 @@ impl WptReportCache {
2124
(*self.0.lock().unwrap()).clone()
2225
}
2326

24-
pub fn get_mut(&self) -> MutexGuard<Option<Arc<WptReportCacheEntry>>> {
27+
#[allow(dead_code)]
28+
pub fn get_mut(&self) -> MutexGuard<'_, Option<Arc<WptReportCacheEntry>>> {
2529
self.0.lock().unwrap()
2630
}
2731

@@ -85,7 +89,13 @@ pub async fn load_wpt_results(etag: Option<Arc<str>>) {
8589
let compressed_report = result.bytes().await.unwrap();
8690

8791
let uncompressed_report = zstd::decode_all(Cursor::new(&compressed_report)).unwrap();
88-
let report: WptReport = serde_json::from_slice(&uncompressed_report).unwrap();
92+
let mut report: WptReport = serde_json::from_slice(&uncompressed_report).unwrap();
93+
94+
// Strip skipped tests
95+
report
96+
.results
97+
.retain(|test| test.status != TestStatus::Skip);
98+
8999
let scores = score_wpt_report::<WptReport>(&report);
90100

91101
let report = ArcWptReport(Arc::new(report));

0 commit comments

Comments
 (0)