Skip to content

Commit 5d85f0d

Browse files
committed
test fix?
1 parent 0f3bf71 commit 5d85f0d

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

plugins/java/src/maven.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ impl JavaPlugin for MavenPlugin {
228228
#[cfg(test)]
229229
#[cfg(not(target_os = "macos"))] // issues with maven dependencies
230230
mod test {
231+
//! Maven doesn't like being run in parallel, at least on Windows.
232+
//! For now the tests access the MavenPlugin with a function that locks a mutex.
233+
231234
use super::super::{TestCase, TestCaseStatus};
232235
use super::*;
233236
use std::fs::{self, File};
@@ -237,33 +240,18 @@ mod test {
237240
use tmc_langs_framework::zip::ZipArchive;
238241
use walkdir::WalkDir;
239242

240-
#[cfg(windows)]
241243
lazy_static::lazy_static! {
242244
static ref MAVEN_LOCK: Mutex<()> = Mutex::new(());
243245
}
244246

245-
#[cfg(not(windows))]
246-
thread_local! {
247-
static MAVEN_LOCK: Mutex<()> = Mutex::new(());
248-
}
249-
250247
fn init() {
251248
let _ = env_logger::builder().is_test(true).try_init();
252249
}
253250

254-
#[cfg(windows)]
255251
fn get_maven() -> (MavenPlugin, MutexGuard<'static, ()>) {
256252
(MavenPlugin::new().unwrap(), MAVEN_LOCK.lock().unwrap())
257253
}
258254

259-
#[cfg(not(windows))]
260-
fn get_maven() -> (MavenPlugin, MutexGuard<'static, ()>) {
261-
(
262-
MavenPlugin::new().unwrap(),
263-
MAVEN_LOCK.with(|_| Mutex::new(())).lock().unwrap(),
264-
)
265-
}
266-
267255
fn copy_test_dir(path: &str) -> TempDir {
268256
let path = Path::new(path);
269257

0 commit comments

Comments
 (0)