diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 01846c61a..5e39f0a1c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -208,7 +208,7 @@ jobs: EOF chmod a+x main.sh - name: Test and gather coverage - uses: danobi/vmtest-action@master + uses: danobi/vmtest-action@v0.8 with: kernel: bzImage command: sh -c 'cd ${{ github.workspace }} && ./main.sh' diff --git a/src/mmap.rs b/src/mmap.rs index 4cf1ffe48..dce6a9faf 100644 --- a/src/mmap.rs +++ b/src/mmap.rs @@ -128,7 +128,7 @@ mod tests { use std::ffi::CStr; use std::io::Write; - use tempfile::tempfile; + use tempfile::NamedTempFile; use test_log::test; use crate::util::ReadRaw; @@ -144,20 +144,22 @@ mod tests { /// Check that we can `mmap` an empty file. #[test] fn mmap_empty_file() { - let file = tempfile().unwrap(); - let mmap = Mmap::map(&file).unwrap(); + let file = NamedTempFile::new().unwrap(); + let file = file.as_file(); + let mmap = Mmap::map(file).unwrap(); assert_eq!(mmap.deref(), &[]); } /// Check that we can `mmap` a file. #[test] fn mmap() { - let mut file = tempfile().unwrap(); + let file = NamedTempFile::new().unwrap(); + let mut file = file.as_file(); let cstr = b"Daniel was here. Briefly.\0"; let () = file.write_all(cstr).unwrap(); let () = file.sync_all().unwrap(); - let mmap = Mmap::map(&file).unwrap(); + let mmap = Mmap::map(file).unwrap(); let mut data = mmap.deref(); let s = data.read_cstr().unwrap(); assert_eq!( @@ -169,12 +171,13 @@ mod tests { /// Check that we can properly restrict the view of a `Mmap`. #[test] fn view_constraining() { - let mut file = tempfile().unwrap(); + let file = NamedTempFile::new().unwrap(); + let mut file = file.as_file(); let s = b"abcdefghijklmnopqrstuvwxyz"; let () = file.write_all(s).unwrap(); let () = file.sync_all().unwrap(); - let mmap = Mmap::map(&file).unwrap(); + let mmap = Mmap::map(file).unwrap(); assert_eq!(mmap.deref(), b"abcdefghijklmnopqrstuvwxyz"); let mmap = mmap.constrain(1..15).unwrap(); diff --git a/src/symbolize/perf_map.rs b/src/symbolize/perf_map.rs index 99a2cfbc3..54f7ca928 100644 --- a/src/symbolize/perf_map.rs +++ b/src/symbolize/perf_map.rs @@ -206,7 +206,7 @@ mod tests { use scopeguard::defer; - use tempfile::tempfile; + use tempfile::NamedTempFile; use crate::symbolize::Input; use crate::symbolize::Process; @@ -257,9 +257,9 @@ mod tests { }; assert_ne!(format!("{func:?}"), ""); - let mut file = tempfile().unwrap(); + let mut file = NamedTempFile::new().unwrap(); let () = file.write_all(SAMPLE_PERF_MAP).unwrap(); - let perf_map = PerfMap::from_file(Path::new("SAMPLE_PERF_MAP"), &file).unwrap(); + let perf_map = PerfMap::from_file(file.path(), file.as_file()).unwrap(); assert_ne!(format!("{perf_map:?}"), ""); } @@ -295,9 +295,9 @@ mod tests { /// Check that we can load a perf map and use it to symbolize an address. #[test] fn perf_map_symbolization() { - let mut file = tempfile().unwrap(); + let mut file = NamedTempFile::new().unwrap(); let () = file.write_all(SAMPLE_PERF_MAP).unwrap(); - let perf_map = PerfMap::from_file(Path::new("SAMPLE_PERF_MAP"), &file).unwrap(); + let perf_map = PerfMap::from_file(file.path(), file.as_file()).unwrap(); for offset in 0..0xb { let sym = perf_map