diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-01 17:03:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-01 17:03:19 +0000 |
commit | 50374c6ddc8660405cb1dd931810ad627f8a756b (patch) | |
tree | eea05ddc7885a8e34d322503c5fdffa6a003ea2f /test/test_unistd.rs | |
parent | fd5906790a45cf8f38922d26f772da9545035a41 (diff) | |
parent | 722fc77816fb21a70746f8f93941241ba18c6d42 (diff) | |
download | nix-50374c6ddc8660405cb1dd931810ad627f8a756b.zip |
Merge #1157
1157: Fix some race conditions in the integration tests r=asomers a=asomers
Co-authored-by: Alan Somers <asomers@gmail.com>
Diffstat (limited to 'test/test_unistd.rs')
-rw-r--r-- | test/test_unistd.rs | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/test/test_unistd.rs b/test/test_unistd.rs index e0b3ae7e..24e0c86b 100644 --- a/test/test_unistd.rs +++ b/test/test_unistd.rs @@ -101,6 +101,8 @@ fn test_mkfifo_directory() { #[test] #[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "android")))] fn test_mkfifoat_none() { + let _m = ::CWD_LOCK.read().expect("Mutex got poisoned by another test"); + let tempdir = tempfile::tempdir().unwrap(); let mkfifoat_fifo = tempdir.path().join("mkfifoat_fifo"); @@ -128,11 +130,10 @@ fn test_mkfifoat() { #[test] #[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "android")))] fn test_mkfifoat_directory_none() { + let _m = ::CWD_LOCK.read().expect("Mutex got poisoned by another test"); + // mkfifoat should fail if a directory is given - assert_eq!( - mkfifoat(None, &env::temp_dir(), Mode::S_IRUSR).is_ok(), - false - ); + assert!(!mkfifoat(None, &env::temp_dir(), Mode::S_IRUSR).is_ok()); } #[test] @@ -144,10 +145,7 @@ fn test_mkfifoat_directory() { let mkfifoat_dir = "mkfifoat_dir"; stat::mkdirat(dirfd, mkfifoat_dir, Mode::S_IRUSR).unwrap(); - assert_eq!( - mkfifoat(Some(dirfd), mkfifoat_dir, Mode::S_IRUSR).is_ok(), - false - ); + assert!(!mkfifoat(Some(dirfd), mkfifoat_dir, Mode::S_IRUSR).is_ok()); } #[test] @@ -637,6 +635,8 @@ fn test_canceling_alarm() { #[test] fn test_symlinkat() { + let _m = ::CWD_LOCK.read().expect("Mutex got poisoned by another test"); + let tempdir = tempfile::tempdir().unwrap(); let target = tempdir.path().join("a"); @@ -682,6 +682,8 @@ fn test_linkat_file() { #[test] fn test_linkat_olddirfd_none() { + let _dr = ::DirRestore::new(); + let tempdir_oldfile = tempfile::tempdir().unwrap(); let oldfilename = "foo.txt"; let oldfilepath = tempdir_oldfile.path().join(oldfilename); @@ -704,6 +706,8 @@ fn test_linkat_olddirfd_none() { #[test] fn test_linkat_newdirfd_none() { + let _dr = ::DirRestore::new(); + let tempdir_oldfile = tempfile::tempdir().unwrap(); let oldfilename = "foo.txt"; let oldfilepath = tempdir_oldfile.path().join(oldfilename); @@ -727,6 +731,8 @@ fn test_linkat_newdirfd_none() { #[test] #[cfg(not(any(target_os = "ios", target_os = "macos")))] fn test_linkat_no_follow_symlink() { + let _m = ::CWD_LOCK.read().expect("Mutex got poisoned by another test"); + let tempdir = tempfile::tempdir().unwrap(); let oldfilename = "foo.txt"; let oldfilepath = tempdir.path().join(oldfilename); @@ -761,6 +767,8 @@ fn test_linkat_no_follow_symlink() { #[test] fn test_linkat_follow_symlink() { + let _m = ::CWD_LOCK.read().expect("Mutex got poisoned by another test"); + let tempdir = tempfile::tempdir().unwrap(); let oldfilename = "foo.txt"; let oldfilepath = tempdir.path().join(oldfilename); |