diff --git a/test/mount/test_mount.rs b/test/mount/test_mount.rs index a4f0903dba..65004465d5 100644 --- a/test/mount/test_mount.rs +++ b/test/mount/test_mount.rs @@ -53,6 +53,8 @@ fn test_mount_tmpfs_without_flags_allows_rwx() { .unwrap_or_else(|e| panic!("read failed: {e}")); assert_eq!(buf, SCRIPT_CONTENTS); + // while forking and unmounting prevent other child processes + let _m = FORK_MTX.lock(); // Verify execute. assert_eq!( EXPECTED_STATUS, @@ -89,6 +91,8 @@ fn test_mount_rdonly_disallows_write() { .unwrap() ); + // wait for child processes to prevent EBUSY + let _m = FORK_MTX.lock(); umount(tempdir.path()).unwrap_or_else(|e| panic!("umount failed: {e}")); } @@ -129,6 +133,8 @@ fn test_mount_noexec_disallows_exec() { &test_path ); + // while forking and unmounting prevent other child processes + let _m = FORK_MTX.lock(); // EACCES: Permission denied assert_eq!( EACCES, @@ -168,6 +174,8 @@ fn test_mount_bind() { .and_then(|mut f| f.write(SCRIPT_CONTENTS)) .unwrap_or_else(|e| panic!("write failed: {e}")); + // wait for child processes to prevent EBUSY + let _m = FORK_MTX.lock(); umount(mount_point.path()) .unwrap_or_else(|e| panic!("umount failed: {e}")); }