1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-12-26 03:27:30 +00:00

fix(test/dir): make lock thread-safe (#1575)

* fix(test/dir): make lock thread-safe

* stronger ordering
This commit is contained in:
David Knaack 2020-08-14 18:58:53 +02:00 committed by GitHub
parent 8c71eb5307
commit 0912ed0058
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -430,8 +430,7 @@ mod tests {
#[test]
#[ignore]
fn symlinked_subdirectory_git_repo_out_of_tree() -> io::Result<()> {
while LOCK.load(Ordering::Relaxed) {}
LOCK.store(true, Ordering::Relaxed);
while LOCK.swap(true, Ordering::Acquire) {}
let tmp_dir = TempDir::new_in(home_dir().unwrap().as_path())?;
let repo_dir = tmp_dir.path().join("above-repo").join("rocket-controls");
let src_dir = repo_dir.join("src/meters/fuel-gauge");
@ -452,7 +451,7 @@ mod tests {
assert_eq!(expected, actual);
LOCK.store(false, Ordering::Relaxed);
LOCK.store(false, Ordering::Release);
tmp_dir.close()
}
@ -460,8 +459,7 @@ mod tests {
#[test]
#[ignore]
fn git_repo_in_home_directory_truncate_to_repo_true() -> io::Result<()> {
while LOCK.load(Ordering::Relaxed) {}
LOCK.store(true, Ordering::Relaxed);
while LOCK.swap(true, Ordering::Acquire) {}
let tmp_dir = TempDir::new_in(home_dir().unwrap().as_path())?;
let dir = tmp_dir.path().join("src/fuel-gauge");
fs::create_dir_all(&dir)?;
@ -487,7 +485,7 @@ mod tests {
assert_eq!(expected, actual);
LOCK.store(false, Ordering::Relaxed);
LOCK.store(false, Ordering::Release);
tmp_dir.close()
}