diff options
| author | Jack O'Connor <[email protected]> | 2024-03-09 16:20:03 -0800 |
|---|---|---|
| committer | Jack O'Connor <[email protected]> | 2024-03-09 16:57:14 -0800 |
| commit | d57818afdcf9715aafb1eaf30a34c6fffdb6eed0 (patch) | |
| tree | 44d6e9d2955361612845b339d672b7b9252e6124 /src | |
| parent | 2435e29dbe57724ab3ae02fc5ea2a9cb83009f89 (diff) | |
avoid using NamedTempFile under Miri
Diffstat (limited to 'src')
| -rw-r--r-- | src/test.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/test.rs b/src/test.rs index fb1e849..2744d90 100644 --- a/src/test.rs +++ b/src/test.rs @@ -695,16 +695,10 @@ fn test_zeroize() { fn test_update_reader() -> Result<(), std::io::Error> { // This is a brief test, since update_reader() is mostly a wrapper around update(), which already // has substantial testing. - use std::io::prelude::*; let mut input = vec![0; 1_000_000]; paint_test_input(&mut input); - let mut tempfile = tempfile::NamedTempFile::new()?; - tempfile.write_all(&input)?; - tempfile.flush()?; assert_eq!( - crate::Hasher::new() - .update_reader(std::fs::File::open(tempfile.path())?)? - .finalize(), + crate::Hasher::new().update_reader(&input[..])?.finalize(), crate::hash(&input), ); Ok(()) @@ -749,6 +743,8 @@ fn test_update_reader_interrupted() -> std::io::Result<()> { #[test] #[cfg(feature = "mmap")] +// NamedTempFile isn't Miri-compatible +#[cfg(not(miri))] fn test_mmap() -> Result<(), std::io::Error> { // This is a brief test, since update_mmap() is mostly a wrapper around update(), which already // has substantial testing. @@ -789,6 +785,8 @@ fn test_mmap_virtual_file() -> Result<(), std::io::Error> { #[test] #[cfg(feature = "mmap")] #[cfg(feature = "rayon")] +// NamedTempFile isn't Miri-compatible +#[cfg(not(miri))] fn test_mmap_rayon() -> Result<(), std::io::Error> { // This is a brief test, since update_mmap_rayon() is mostly a wrapper around update_rayon(), // which already has substantial testing. |
