Reworks workflows into script (#661)
* Reworks some workflows to run a script instead Advantages are: - Only one set of tests needs maintenance. - Local results match workflows, no surprises. - Reduced reliance on GitHub actions. Fixes #50, #168, #169, #171, #507 * Adds macos to the test matrix
This commit is contained in:
@@ -13,8 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
use fuzz_store::{fuzz, StatKey, Stats};
|
||||
use std::io::Write;
|
||||
use std::io::{stdout, Read};
|
||||
use std::io::{stdout, Read, Write};
|
||||
use std::path::Path;
|
||||
|
||||
fn usage(program: &str) {
|
||||
|
||||
@@ -490,7 +490,7 @@ impl StoreDriverOn {
|
||||
/// Checks that the given entries are wiped from the storage.
|
||||
fn check_deleted(&self, deleted: &[StoreHandle]) -> Result<(), StoreInvariant> {
|
||||
for handle in deleted {
|
||||
let value = self.store.inspect_value(&handle);
|
||||
let value = self.store.inspect_value(handle);
|
||||
if !value.iter().all(|&x| x == 0x00) {
|
||||
return Err(StoreInvariant::NotWiped {
|
||||
key: handle.get_key(),
|
||||
|
||||
@@ -187,7 +187,7 @@ impl Format {
|
||||
word_size == WORD_SIZE
|
||||
&& page_size % word_size == 0
|
||||
&& (MIN_PAGE_SIZE * word_size <= page_size && page_size <= MAX_PAGE_SIZE)
|
||||
&& (MIN_NUM_PAGES <= num_pages && num_pages <= MAX_PAGE_INDEX + 1)
|
||||
&& (MIN_NUM_PAGES..=MAX_PAGE_INDEX + 1).contains(&num_pages)
|
||||
&& max_word_writes >= 2
|
||||
&& max_page_erases <= MAX_ERASE_CYCLE
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ pub fn delete(store: &mut Store<impl Storage>, keys: &impl Keys) -> StoreResult<
|
||||
/// The handles are truncated to the keys that are present.
|
||||
fn get_handles(store: &Store<impl Storage>, keys: &impl Keys) -> StoreResult<Vec<StoreHandle>> {
|
||||
let keys_len = keys.len();
|
||||
let mut handles: Vec<Option<StoreHandle>> = vec![None; keys_len as usize];
|
||||
let mut handles: Vec<Option<StoreHandle>> = vec![None; keys_len];
|
||||
for handle in store.iter()? {
|
||||
let handle = handle?;
|
||||
let pos = match keys.pos(handle.get_key()) {
|
||||
|
||||
@@ -148,7 +148,7 @@ impl<S: Storage> Linear<S> {
|
||||
value = &value[len..];
|
||||
index.byte += len;
|
||||
// Write the unaligned end if needed.
|
||||
if value.len() > 0 {
|
||||
if !value.is_empty() {
|
||||
let mut word = self.storage.read_slice(index, word_size)?.into_owned();
|
||||
word[..value.len()].copy_from_slice(value);
|
||||
self.storage.write_slice(index, &word)?;
|
||||
|
||||
@@ -19,12 +19,10 @@ use crate::format::{
|
||||
Word, WordState,
|
||||
};
|
||||
#[cfg(feature = "std")]
|
||||
pub use crate::model::{StoreModel, StoreOperation};
|
||||
use crate::{usize_to_nat, Nat, Storage, StorageError, StorageIndex};
|
||||
pub use crate::model::StoreOperation;
|
||||
#[cfg(feature = "std")]
|
||||
pub use crate::{
|
||||
BufferStorage, StoreDriver, StoreDriverOff, StoreDriverOn, StoreInterruption, StoreInvariant,
|
||||
};
|
||||
pub use crate::BufferStorage;
|
||||
use crate::{usize_to_nat, Nat, Storage, StorageError, StorageIndex};
|
||||
use alloc::borrow::Cow;
|
||||
use alloc::boxed::Box;
|
||||
use alloc::vec::Vec;
|
||||
@@ -245,7 +243,7 @@ impl<S: Storage> Store<S> {
|
||||
}
|
||||
|
||||
/// Iterates over the entries.
|
||||
pub fn iter<'a>(&'a self) -> StoreResult<StoreIter<'a>> {
|
||||
pub fn iter(&self) -> StoreResult<StoreIter<'_>> {
|
||||
let head = or_invalid(self.head)?;
|
||||
Ok(Box::new(or_invalid(self.entries.as_ref())?.iter().map(
|
||||
move |&offset| {
|
||||
@@ -794,7 +792,7 @@ impl<S: Storage> Store<S> {
|
||||
|
||||
/// Continues a transaction after it has been written.
|
||||
fn transaction_apply(&mut self, sorted_keys: &[Nat], marker: Position) -> StoreResult<()> {
|
||||
self.delete_keys(&sorted_keys, marker)?;
|
||||
self.delete_keys(sorted_keys, marker)?;
|
||||
self.set_padding(marker)?;
|
||||
let end = or_invalid(self.head)? + self.format.window_size();
|
||||
let mut pos = marker + 1;
|
||||
|
||||
Reference in New Issue
Block a user