From cddaada18e62d97702f5a55416dbbd5036fe8569 Mon Sep 17 00:00:00 2001 From: Igor Zhirkov Date: Fri, 10 Jan 2025 14:55:54 +0100 Subject: [PATCH] Fix mode filters (#132) --- README.md | 3 ++- compiler_tester/src/compilers/mode/imode.rs | 4 ++-- compiler_tester/src/compilers/mode/mod.rs | 1 + compiler_tester/src/filters.rs | 7 ++++++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 76142535..2eabfa22 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,6 @@ Most of the specifiers support wildcards `*` (any), `^` ('3' and 'z'). With no mode argument, iterates over all option combinations (approximately 800). - ## Usage Each command assumes you are at the root of the `compiler-tester` repository. @@ -228,6 +227,8 @@ cargo run --release --bin compiler-tester -- -DT \ --zksolc '../era-compiler-solidity/target/release/zksolc' ``` +Modes are insensitive to spaces, therefore options such as `'Y+M3B3 0.8.26'` and `'Y + M3B3 0.8.26'` are equivalent. + ### Example 2 Run all simple Yul tests. This currently runs about three hundred tests and takes about eight minutes. diff --git a/compiler_tester/src/compilers/mode/imode.rs b/compiler_tester/src/compilers/mode/imode.rs index 92a72475..e479d05a 100644 --- a/compiler_tester/src/compilers/mode/imode.rs +++ b/compiler_tester/src/compilers/mode/imode.rs @@ -17,13 +17,13 @@ pub trait IMode { } pub fn mode_to_string_aux(mode: &impl IMode, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - for (i, element) in [mode.optimizations(), mode.codegen(), mode.version()] + for (i, element) in [mode.codegen(), mode.optimizations(), mode.version()] .iter() .flatten() .enumerate() { if i > 0 { - write!(f, " ")?; + write!(f, " ")?; } write!(f, "{}", element)?; } diff --git a/compiler_tester/src/compilers/mode/mod.rs b/compiler_tester/src/compilers/mode/mod.rs index 5bcb58b5..7072f1d5 100644 --- a/compiler_tester/src/compilers/mode/mod.rs +++ b/compiler_tester/src/compilers/mode/mod.rs @@ -211,6 +211,7 @@ impl Mode { } } + current = current.replace(' ', ""); current } } diff --git a/compiler_tester/src/filters.rs b/compiler_tester/src/filters.rs index 7e09992c..8a0ed2e7 100644 --- a/compiler_tester/src/filters.rs +++ b/compiler_tester/src/filters.rs @@ -30,7 +30,12 @@ impl Filters { ) -> Self { Self { path_filters: path_filters.into_iter().collect(), - mode_filters: mode_filters.into_iter().collect(), + // Mode filters are stripped of spaces so filters like "Y+M3B3 + // 0.2.1 " and "Y +M3B3 0.2.1" become equivalent + mode_filters: mode_filters + .into_iter() + .map(|f| f.replace(' ', "")) + .collect(), group_filters: group_filters.into_iter().collect(), } }