Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions library/std/src/fs/tests.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
use rand::RngCore;

#[cfg(not(miri))]
use super::Dir;
use crate::fs::{self, File, FileTimes, OpenOptions, TryLockError};
#[cfg(not(miri))]
use crate::io;
use crate::io::prelude::*;
use crate::io::{BorrowedBuf, ErrorKind, SeekFrom};
use crate::mem::MaybeUninit;
Expand All @@ -20,7 +17,7 @@ use crate::path::Path;
use crate::sync::Arc;
use crate::test_helpers::{TempDir, tmpdir};
use crate::time::{Duration, Instant, SystemTime};
use crate::{assert_matches, env, str, thread};
use crate::{assert_matches, env, io, str, thread};

macro_rules! check {
($e:expr) => {
Expand Down Expand Up @@ -856,10 +853,12 @@ fn recursive_mkdir_failure() {

#[test]
fn concurrent_recursive_mkdir() {
for _ in 0..100 {
let count = if cfg!(miri) { 10 } else { 100 };
let nest = if cfg!(miri) { 10 } else { 40 };
for _ in 0..count {
let dir = tmpdir();
let mut dir = dir.join("a");
for _ in 0..40 {
for _ in 0..nest {
dir = dir.join("a");
}
let mut join = vec![];
Expand Down Expand Up @@ -1869,7 +1868,7 @@ fn create_dir_long_paths() {
fn read_large_dir() {
let tmpdir = tmpdir();

let count = 32 * 1024;
let count = if cfg!(miri) { 1024 } else { 32 * 1024 };
for i in 0..count {
check!(fs::File::create(tmpdir.join(&i.to_string())));
}
Expand Down Expand Up @@ -1954,6 +1953,7 @@ fn test_eq_windows_file_type() {
/// Regression test for https://github.com/rust-lang/rust/issues/50619.
#[test]
#[cfg(target_os = "linux")]
#[cfg_attr(miri, ignore)] // Cannot spawn processes on Miri
fn test_read_dir_infinite_loop() {
use crate::io::ErrorKind;
use crate::process::Command;
Expand Down Expand Up @@ -2530,17 +2530,13 @@ fn test_fs_set_times_nofollow() {
}

#[test]
// FIXME: libc calls fail on miri
#[cfg(not(miri))]
fn test_dir_smoke_test() {
let tmpdir = tmpdir();
let dir = Dir::open(tmpdir.path());
check!(dir);
}

#[test]
// FIXME: libc calls fail on miri
#[cfg(not(miri))]
fn test_dir_read_file() {
let tmpdir = tmpdir();
let mut f = check!(File::create(tmpdir.join("foo.txt")));
Expand Down
Loading