Tests: the CSS, glow and .ai Zstandard guards count work instead of timing it

Three tests failed on a loaded machine because they asserted elapsed
time. Each now counts the work that the slow behavior it guards
against would repeat, with a counter compiled only into tests:

- The CSS cascade test counts selector tests, at most two per element
  (testing every rule against every element tests N x N). It styles
  5,000 elements, so the slow behavior fails on the count rather than
  on the hang guard, which now waits 300 s.
- The stacked-glow test counts the silhouettes drawn, 30 for 30 glows
  with and without the shadow cache.
- The Zstandard frames test counts the bytes looked at to find the
  zero padding.

The hang guards for invalid dash patterns, text layout and script
checks of a pipe wait 300 s instead of 20 s.
This commit is contained in:
dotCooCoo
2026-11-08 12:21:06 +07:00
committed by bflatastic
parent 0ce3147aab
commit 1d32aff63f
9 changed files with 83 additions and 18 deletions
+1 -1
View File
@@ -140,7 +140,7 @@ fn pipes_and_folders_are_not_read() {
let direct = s.execute("script.check", &json!({ "path": pipe })).map_err(|e| e.to_string());
let _ = tx.send((included.map_err(|e| e.to_string()), direct));
});
let (included, direct) = rx.recv_timeout(std::time::Duration::from_secs(20)).expect("the checks return");
let (included, direct) = rx.recv_timeout(std::time::Duration::from_secs(300)).expect("the checks return");
let statuses: Vec<String> = included.unwrap().as_array().unwrap().iter().map(|i| i["status"].as_str().unwrap().to_string()).collect();
assert_eq!(statuses, ["missing", "missing"]);
assert!(direct.is_err_and(|e| e.contains("not a file")));