Tests: the MCP concurrency, folder search and artboard export tests pass on a loaded machine

Squashed from #4473 onto main.
This commit is contained in:
dotCooCoo
2026-10-29 18:50:24 +07:00
committed by bflatastic
parent 31a482bade
commit 6fd042e4be
7 changed files with 81 additions and 40 deletions
+8 -3
View File
@@ -30,9 +30,14 @@ fn session_for(root: &Path) -> Session {
s
}
/// `text.findFontFiles {}` once the search ended (10 seconds at most).
/// How long a test waits for a search to end or to read a file. The wait only ends a test whose
/// search never ends. A machine busy with other builds can hold a walker for seconds. It is shorter than a
/// search's default `maxSeconds` of 60, which would end a search that does not end by itself.
const WAIT: Duration = Duration::from_secs(30);
/// `text.findFontFiles {}` once the search ended ([`WAIT`] at most).
fn finished(s: &mut Session) -> Value {
let until = Instant::now() + Duration::from_secs(10);
let until = Instant::now() + WAIT;
loop {
let r = s.execute("text.findFontFiles", &json!({})).unwrap();
if r["state"] != "searching" || Instant::now() > until {
@@ -262,7 +267,7 @@ fn stop_ends_only_the_search_it_names() {
let search = findfiles::start(root.clone(), s.search_rules.clone(), Limits::default(), 1, 1, Arc::new(Blocked(Mutex::new(rx)))).unwrap();
let fonts = vec![Sought { family: "A".into(), style: "Regular".into(), status: FontMatch::Missing }];
s.font_search = Some(FontSearch { id: 7, folder: root.to_string_lossy().into_owned(), fonts, search });
let until = Instant::now() + Duration::from_secs(10);
let until = Instant::now() + WAIT;
while s.execute("text.findFontFiles", &json!({})).unwrap()["searched"]["fontFiles"] != 1 && Instant::now() < until {
std::thread::sleep(Duration::from_millis(2));
}
+8 -3
View File
@@ -42,9 +42,14 @@ fn placed(s: &mut Session, path: &Path) -> u64 {
place(s, &path.to_string_lossy()).0
}
/// `links.findFiles {}` once the search ended (10 seconds at most).
/// How long a test waits for a search to end or to read a file. The wait only ends a test whose
/// search never ends. A machine busy with other builds can hold a walker for seconds. It is shorter than a
/// search's default `maxSeconds` of 60, which would end a search that does not end by itself.
const WAIT: Duration = Duration::from_secs(30);
/// `links.findFiles {}` once the search ended ([`WAIT`] at most).
fn finished(s: &mut Session) -> Value {
let until = Instant::now() + Duration::from_secs(10);
let until = Instant::now() + WAIT;
loop {
let r = s.execute("links.findFiles", &json!({})).unwrap();
if r["state"] != "searching" || Instant::now() > until {
@@ -206,7 +211,7 @@ fn stop_ends_only_the_search_it_names() {
let search = findfiles::start(root.clone(), s.search_rules.clone(), Limits::default(), 1, 2, Arc::new(Blocked(Mutex::new(rx)))).unwrap();
let links = vec![Sought { name: "a.png".into(), path: "/gone/a.png".into(), ids: vec![], size: None, hash: None }];
s.link_search = Some(LinkSearch { id: 7, folder: root.to_string_lossy().into_owned(), links, sizes: Arc::default(), search });
let until = Instant::now() + Duration::from_secs(10);
let until = Instant::now() + WAIT;
while s.execute("links.findFiles", &json!({})).unwrap()["searched"]["read"] != 1 && Instant::now() < until {
std::thread::sleep(Duration::from_millis(2));
}