Tests: the filter shortcut test no longer sees plug-ins another test installs

Installed plug-ins are process-wide, and the shortcut test
each_filter_plugin_takes_a_shortcut_of_its_own and the palette test
filter_plugins_with_one_name_show_their_ids both install two filter
plug-ins named Same Name. When the two ran at the same time, the
shortcut test counted 4 Same Name lines in the exported shortcuts
instead of its own 2, and its own row took an id suffix.

The tests that install filter plug-ins under a shared name, or that
check how plug-ins sharing a name are told apart, now hold one test
lock (SHARED_PLUGIN_NAMES in the ui-egui test module) while their
plug-ins are installed: the shortcut test and both palette tests
(each_filter_plugin_is_a_result_of_its_own checks the exact labels of
two filters named Group).

Running the two tests together with --test-threads=8, 50 times on
Linux: 0 of 50 passed before, 50 of 50 after.
This commit is contained in:
dotCooCoo
2026-11-22 05:49:11 -08:00
parent db9acab4da
commit 5f2649aa63
3 changed files with 8 additions and 0 deletions
+2
View File
@@ -3230,6 +3230,7 @@ mod tests {
#[test]
fn each_filter_plugin_is_a_result_of_its_own() {
use vectorcraft_plugins::wat as tpl;
let _names = crate::tests::SHARED_PLUGIN_NAMES.lock().unwrap_or_else(|e| e.into_inner());
let (one, two) = ("test.UI.palette_filter-one", "test.UI.palette_filter-two");
let (key_one, key_two) = (format!("plugin:{one}"), format!("plugin:{two}"));
let install = |id: &str, params: &str| {
@@ -3509,6 +3510,7 @@ mod tests {
#[test]
fn filter_plugins_with_one_name_show_their_ids() {
use vectorcraft_plugins::wat as tpl;
let _names = crate::tests::SHARED_PLUGIN_NAMES.lock().unwrap_or_else(|e| e.into_inner());
let (one, two) = ("test.UI.palette_same-one", "test.UI.palette_same-two");
for id in [one, two] {
let manifest = format!(r#"{{"id":"{id}","name":"Same Name","version":"1","kind":"filter","params":{{"wiggle":{{"type":"bool"}}}}}}"#);
+1
View File
@@ -3391,6 +3391,7 @@ fn a_live_effect_plugin_installed_later_takes_a_shortcut_of_its_own() {
fn each_filter_plugin_takes_a_shortcut_of_its_own() {
use serde_json::Value;
use vectorcraft_plugins::wat as tpl;
let _names = crate::tests::SHARED_PLUGIN_NAMES.lock().unwrap_or_else(|e| e.into_inner());
let (one, two) = ("test.UI.key_filter-one", "test.UI.key_filter-two");
let (key_one, key_two) = (format!("plugin:{one}"), format!("plugin:{two}"));
let install = |id: &str, name: &str, params: &str| {
+5
View File
@@ -62,3 +62,8 @@ mod toolescape;
mod trace_runs;
mod transparencygrid;
mod widthtool;
/// Installed plug-ins are process-wide. Tests that install filter plug-ins under a name another
/// test also installs, or that check how plug-ins sharing a name are told apart, hold this lock
/// while their plug-ins are installed, so each sees only its own plug-ins under that name.
pub(super) static SHARED_PLUGIN_NAMES: std::sync::Mutex<()> = std::sync::Mutex::new(());