Skip to content

Commit

Permalink
WPT runner: apply unsupported feature detection to ref as well as test
Browse files Browse the repository at this point in the history
Signed-off-by: Nico Burns <[email protected]>
  • Loading branch information
nicoburns committed Dec 7, 2024
1 parent c3c21a9 commit 93169b5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
13 changes: 7 additions & 6 deletions apps/wpt/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,18 +490,18 @@ fn main() {
println!("{fail_count:>4} tests FAILED ({fail_percent_run:.2}% of run; {fail_percent_total:.2}% of found)");

println!("{}", "\nOf those which failed:".bright_black());
println!("{other_fail_count:>4} do not use unsupported features");
println!("{writing_mode_fail_count:>4} use writing-mode");
println!("{direction_fail_count:>4} use direction");
println!("{float_fail_count:>4} use floats");
println!("{intrinsic_size_fail_count:>4} use intrinsic size keywords");
println!("{calc_fail_count:>4} use calc");
if subgrid_fail_count > 0 {
println!("{subgrid_fail_count:>4} use subgrid");
}
if masonry_fail_count > 0 {
println!("{masonry_fail_count:>4} use masonry");
}
println!("{writing_mode_fail_count:>4} use writing_mode");
println!("{direction_fail_count:>4} use direction");
println!("{calc_fail_count:>4} use calc");
println!("{intrinsic_size_fail_count:>4} use intrinsic size keywords");
println!("{float_fail_count:>4} use floats");
println!("{other_fail_count:>4} do not use unsupported features");
}

#[allow(clippy::too_many_arguments)]
Expand Down Expand Up @@ -548,6 +548,7 @@ async fn process_test_file(
relative_path,
file_contents.as_str(),
reference.as_str(),
&mut flags,
)
.await;

Expand Down
25 changes: 24 additions & 1 deletion apps/wpt/src/ref_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ use std::io::Write;
use std::path::Path;
use std::sync::Arc;

use crate::{clone_font_ctx, BufferKind, TestStatus, ThreadCtx, HEIGHT, WIDTH};
use crate::{clone_font_ctx, BufferKind, TestFlags, TestStatus, ThreadCtx, HEIGHT, WIDTH};

#[allow(clippy::too_many_arguments)]
pub async fn process_ref_test(
ctx: &mut ThreadCtx,
test_relative_path: &str,
test_html: &str,
ref_file: &str,
flags: &mut TestFlags,
) -> TestStatus {
let ref_url: Url = ctx
.dummy_base_url
Expand All @@ -29,6 +30,28 @@ pub async fn process_ref_test(
let ref_path = ctx.wpt_dir.join(&ref_relative_path);
let ref_html = fs::read_to_string(ref_path).expect("Ref file not found.");

if ctx.float_re.is_match(&ref_html) {
*flags |= TestFlags::USES_FLOAT;
}
if ctx.intrinsic_re.is_match(&ref_html) {
*flags |= TestFlags::USES_INTRINSIC_SIZE;
}
if ctx.calc_re.is_match(&ref_html) {
*flags |= TestFlags::USES_CALC;
}
if ctx.direction_re.is_match(&ref_html) {
*flags |= TestFlags::USES_DIRECTION;
}
if ctx.writing_mode_re.is_match(&ref_html) {
*flags |= TestFlags::USES_WRITING_MODE;
}
if ctx.subgrid_re.is_match(&ref_html) {
*flags |= TestFlags::USES_SUBGRID;
}
if ctx.masonry_re.is_match(&ref_html) {
*flags |= TestFlags::USES_MASONRY;
}

let test_out_path = ctx
.out_dir
.join(format!("{}{}", test_relative_path, "-test.png"));
Expand Down

0 comments on commit 93169b5

Please sign in to comment.