Skip to content

Visual Studio Code, rebuilt in Rust

Rust

test(update): give each unattended restart test its own settings folder

rokartur347a6e001973
diff --git a/native/crates/app/src/workbench/unattended_restart.rs b/native/crates/app/src/workbench/unattended_restart.rs
index bcddf4745f8..e9af9765373 100644
--- a/native/crates/app/src/workbench/unattended_restart.rs
+++ b/native/crates/app/src/workbench/unattended_restart.rs
@@ -494,7 +494,9 @@ mod tests {
let app_root = std::path::Path::new(env!("VSCODE_SRC")).to_path_buf();
let themes = exthost::scan::scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();
let theme = crate::theme::load_theme(&[themes], "Dark Modern").unwrap();
- let dir = std::env::temp_dir().join(format!("vsrustium-unattended-restart-{}", std::process::id()));
+ // One folder per test: parallel tests writing one settings.json race on its atomic temp file.
+ static WORKBENCHES: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0);
+ let dir = std::env::temp_dir().join(format!("vsrustium-unattended-restart-{}-{}", std::process::id(), WORKBENCHES.fetch_add(1, std::sync::atomic::Ordering::Relaxed)));
std::fs::create_dir_all(dir.join("User")).unwrap();
let settings = std::sync::Arc::new(std::sync::Mutex::new(config::service::Settings::load(config::registry::Registry::with_extensions(&[]), dir.join("User"), None)));
let host = crate::host_sync::HostSync::new(std::sync::mpsc::channel().0);