Skip to content

Commit

Permalink
Handle more CI failures
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Nov 6, 2024
1 parent ecf99ca commit a6dbf02
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
1 change: 0 additions & 1 deletion crates/c-api/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#![cfg_attr(not(feature = "cache"), allow(unused_imports))]

use crate::{handle_result, wasm_memorytype_t, wasmtime_error_t};
use std::ops::Range;
use std::os::raw::c_char;
use std::ptr;
use std::{ffi::CStr, sync::Arc};
Expand Down
15 changes: 3 additions & 12 deletions crates/fuzzing/src/generators/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use anyhow::Result;
use arbitrary::{Arbitrary, Unstructured};
use std::ops::Range;
use wasmtime::{LinearMemory, MemoryCreator, MemoryType};

/// A description of a memory config, image, etc... that can be used to test
Expand Down Expand Up @@ -232,7 +231,6 @@ pub struct UnalignedMemory {
/// This memory is always one byte larger than the actual size of linear
/// memory.
src: Vec<u8>,
maximum: Option<usize>,
}

unsafe impl LinearMemory for UnalignedMemory {
Expand All @@ -242,8 +240,8 @@ unsafe impl LinearMemory for UnalignedMemory {
self.src.len() - 1
}

fn maximum_byte_size(&self) -> Option<usize> {
self.maximum
fn byte_capacity(&self) -> usize {
self.src.capacity() - 1
}

fn grow_to(&mut self, new_size: usize) -> Result<()> {
Expand All @@ -257,12 +255,6 @@ unsafe impl LinearMemory for UnalignedMemory {
// of memory is always unaligned.
self.src[1..].as_ptr() as *mut _
}

fn wasm_accessible(&self) -> Range<usize> {
let base = self.as_ptr() as usize;
let len = self.byte_size();
base..base + len
}
}

/// A mechanism to generate [`UnalignedMemory`] at runtime.
Expand All @@ -273,15 +265,14 @@ unsafe impl MemoryCreator for UnalignedMemoryCreator {
&self,
_ty: MemoryType,
minimum: usize,
maximum: Option<usize>,
_maximum: Option<usize>,
reserved_size_in_bytes: Option<usize>,
guard_size_in_bytes: usize,
) -> Result<Box<dyn LinearMemory>, String> {
assert_eq!(guard_size_in_bytes, 0);
assert!(reserved_size_in_bytes.is_none() || reserved_size_in_bytes == Some(0));
Ok(Box::new(UnalignedMemory {
src: vec![0; minimum + 1],
maximum,
}))
}
}

0 comments on commit a6dbf02

Please sign in to comment.