Compare commits

..

30 Commits

Author SHA1 Message Date
James Wilson 255de530c3 remove --networkid and arg, back to 5s timeout for geth 2025-08-15 16:32:41 +01:00
James Wilson c960f02417 fix line logging 2025-08-15 16:11:11 +01:00
James Wilson 5e19269124 Improve geth stdout logging on failure 2025-08-15 16:05:57 +01:00
James Wilson 458a0901d3 30s timeout 2025-08-15 15:54:41 +01:00
James Wilson 77f389bc74 Bump default geth timeout to 10s 2025-08-15 15:39:02 +01:00
James Wilson 897104857c Merge branch 'main' into jsdw-redo-modes 2025-08-15 14:02:47 +01:00
James Wilson 3837ab86d3 Update kitchensink weights too and fmt 2025-08-15 13:59:49 +01:00
James Wilson 9ae432b86a Update fallback tx weights to avoid out of gas errors 2025-08-15 13:58:13 +01:00
James Wilson 230d6729f4 clippy nits 2025-08-14 16:34:50 +01:00
James Wilson 7e26e5ebcc Remove now-unused deps 2025-08-14 16:20:39 +01:00
James Wilson e5c7bf300b Move compile check to prepare_tests 2025-08-14 16:12:48 +01:00
James Wilson b2290b3177 Re-arrange Mode things; ParsedMode in format and Mode etc in common 2025-08-14 13:02:46 +01:00
James Wilson df6d485471 Rename ModePipeline::E/Y 2025-08-14 12:34:43 +01:00
James Wilson 30a656844f fmt 2025-08-14 10:59:58 +01:00
James Wilson 1c335e5709 constants.mod, and Display for CaseIdx to use it 2025-08-14 10:58:02 +01:00
James Wilson 95ea886ba7 Move Mode to common crate 2025-08-14 10:42:58 +01:00
James Wilson c94e97cfd0 Merge branch 'main' into jsdw-redo-modes 2025-08-14 09:05:26 +01:00
James Wilson 036579fb32 Merge branch 'main' into jsdw-redo-modes 2025-08-13 15:12:26 +01:00
James Wilson 0bc55cf400 Improve test output a little; string modes and list ignored tests 2025-08-13 15:10:03 +01:00
James Wilson ea29bb86c4 Merge branch 'main' into jsdw-redo-modes 2025-08-13 15:00:19 +01:00
James Wilson fe6a4f790a Elide viaIR input if compiler does not support it 2025-08-11 17:33:10 +01:00
James Wilson f98c15121d Add ability for compiler to opt out if it can't work with some Mode/version 2025-08-08 17:43:12 +01:00
James Wilson 7b5ffed288 Address nits 2025-08-08 12:40:41 +01:00
James Wilson 2ca220da0f Remove mode we no longer support from test metadata 2025-08-08 11:56:57 +01:00
James Wilson 4c9c001ad7 clippy 2025-08-08 11:02:16 +01:00
James Wilson 88f31348eb fmt 2025-08-08 11:00:41 +01:00
James Wilson cfbb5eefff First pass integrated new mode bits 2025-08-08 10:59:49 +01:00
James Wilson 2d01045ad2 WIP integrate new Mode/ParsedMode into rest of code 2025-08-08 10:50:40 +01:00
James Wilson bd966300a5 test expanding, too 2025-08-08 10:34:50 +01:00
James Wilson e8fa992a3b WIP redo how we parse and use modes 2025-08-07 16:54:26 +01:00
2 changed files with 26 additions and 57 deletions
+1 -1
View File
@@ -125,7 +125,7 @@ fn collect_corpora(args: &Arguments) -> anyhow::Result<HashMap<Corpus, Vec<Metad
let corpus = Corpus::try_from_path(path)?;
tracing::info!("found corpus: {}", path.display());
let tests = corpus.enumerate_tests();
tracing::info!("corpus '{}' contains {} tests", &corpus.name(), tests.len());
tracing::info!("corpus '{}' contains {} tests", &corpus.name, tests.len());
corpora.insert(corpus, tests);
}
+25 -56
View File
@@ -8,74 +8,43 @@ use serde::{Deserialize, Serialize};
use crate::metadata::MetadataFile;
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
#[serde(untagged)]
pub enum Corpus {
SinglePath { name: String, path: PathBuf },
MultiplePaths { name: String, paths: Vec<PathBuf> },
#[derive(Clone, Debug, Default, Serialize, Deserialize, Eq, PartialEq, Hash)]
pub struct Corpus {
pub name: String,
pub path: PathBuf,
}
impl Corpus {
pub fn try_from_path(file_path: impl AsRef<Path>) -> anyhow::Result<Self> {
let mut corpus = File::open(file_path.as_ref())
.map_err(Into::<anyhow::Error>::into)
.and_then(|file| serde_json::from_reader::<_, Corpus>(file).map_err(Into::into))?;
/// Try to read and parse the corpus definition file at given `path`.
pub fn try_from_path(path: &Path) -> anyhow::Result<Self> {
let file = File::open(path)?;
let mut corpus: Corpus = serde_json::from_reader(file)?;
for path in corpus.paths_iter_mut() {
*path = file_path
.as_ref()
.parent()
.ok_or_else(|| {
anyhow::anyhow!("Corpus path '{}' does not point to a file", path.display())
})?
.canonicalize()
.map_err(|error| {
anyhow::anyhow!(
"Failed to canonicalize path to corpus '{}': {error}",
path.display()
)
})?
.join(path.as_path())
}
// Ensure that the path mentioned in the corpus is relative to the corpus file.
// Canonicalizing also helps make the path in any errors unambiguous.
corpus.path = path
.parent()
.ok_or_else(|| {
anyhow::anyhow!("Corpus path '{}' does not point to a file", path.display())
})?
.canonicalize()
.map_err(|error| {
anyhow::anyhow!(
"Failed to canonicalize path to corpus '{}': {error}",
path.display()
)
})?
.join(corpus.path);
Ok(corpus)
}
/// Scan the corpus base directory and return all tests found.
pub fn enumerate_tests(&self) -> Vec<MetadataFile> {
let mut tests = Vec::new();
for path in self.paths_iter() {
collect_metadata(path, &mut tests);
}
collect_metadata(&self.path, &mut tests);
tests
}
pub fn name(&self) -> &str {
match self {
Corpus::SinglePath { name, .. } | Corpus::MultiplePaths { name, .. } => name.as_str(),
}
}
pub fn paths_iter(&self) -> impl Iterator<Item = &Path> {
match self {
Corpus::SinglePath { path, .. } => {
Box::new(std::iter::once(path.as_path())) as Box<dyn Iterator<Item = _>>
}
Corpus::MultiplePaths { paths, .. } => {
Box::new(paths.iter().map(|path| path.as_path())) as Box<dyn Iterator<Item = _>>
}
}
}
pub fn paths_iter_mut(&mut self) -> impl Iterator<Item = &mut PathBuf> {
match self {
Corpus::SinglePath { path, .. } => {
Box::new(std::iter::once(path)) as Box<dyn Iterator<Item = _>>
}
Corpus::MultiplePaths { paths, .. } => {
Box::new(paths.iter_mut()) as Box<dyn Iterator<Item = _>>
}
}
}
}
/// Recursively walks `path` and parses any JSON or Solidity file into a test