diff --git a/compiler_tester/src/compiler_tester/arguments.rs b/compiler_tester/src/compiler_tester/arguments.rs index b42bb078..f6d5a7a7 100644 --- a/compiler_tester/src/compiler_tester/arguments.rs +++ b/compiler_tester/src/compiler_tester/arguments.rs @@ -103,6 +103,10 @@ pub struct Arguments { /// Sets the `debug logging` option in LLVM. #[structopt(long = "llvm-debug-logging")] pub llvm_debug_logging: bool, + + /// Builds the test code but does not run tests. + #[structopt(long = "build-only")] + pub build_only: bool, } impl Arguments { diff --git a/compiler_tester/src/compiler_tester/main.rs b/compiler_tester/src/compiler_tester/main.rs index 5dbd45cd..3a988d3a 100644 --- a/compiler_tester/src/compiler_tester/main.rs +++ b/compiler_tester/src/compiler_tester/main.rs @@ -11,6 +11,7 @@ use std::time::Instant; use colored::Colorize; use self::arguments::Arguments; +use compiler_tester::Workflow; /// The rayon worker stack size. const RAYON_WORKER_STACK_SIZE: usize = 16 * 1024 * 1024; @@ -92,8 +93,17 @@ fn main_inner(arguments: Arguments) -> anyhow::Result<()> { let filters = compiler_tester::Filters::new(arguments.paths, arguments.modes, arguments.groups); - let compiler_tester = - compiler_tester::CompilerTester::new(summary.clone(), filters, debug_config.clone())?; + let workflow = if arguments.build_only { + Workflow::BuildOnly + } else { + Workflow::BuildAndRun + }; + let compiler_tester = compiler_tester::CompilerTester::new( + summary.clone(), + filters, + debug_config.clone(), + workflow, + )?; let binary_download_config_paths = vec![ arguments diff --git a/compiler_tester/src/lib.rs b/compiler_tester/src/lib.rs index cb58ea9a..5814b062 100644 --- a/compiler_tester/src/lib.rs +++ b/compiler_tester/src/lib.rs @@ -53,6 +53,16 @@ pub const TRACE_DIRECTORY: &str = "./trace/"; /// type Test = (Arc, Arc, Mode); +/// +/// Describes sets of actions that compiler tester is able to perform. +/// +pub enum Workflow { + /// Only build tests but not execute them. + BuildOnly, + /// Build and execute tests. + BuildAndRun, +} + /// /// The compiler tester. /// @@ -63,6 +73,8 @@ pub struct CompilerTester { pub filters: Filters, /// The debug config. pub debug_config: Option, + /// Actions to perform. + pub workflow: Workflow, } impl CompilerTester { @@ -98,11 +110,13 @@ impl CompilerTester { summary: Arc>, filters: Filters, debug_config: Option, + workflow: Workflow, ) -> anyhow::Result { Ok(Self { summary, filters, debug_config, + workflow, }) } @@ -131,7 +145,9 @@ impl CompilerTester { &self.filters, specialized_debug_config, ) { - test.run::(self.summary.clone(), vm.clone()); + if let Workflow::BuildAndRun = self.workflow { + test.run::(self.summary.clone(), vm.clone()) + }; } }) .collect(); @@ -160,7 +176,9 @@ impl CompilerTester { &self.filters, specialized_debug_config, ) { - test.run(self.summary.clone()); + if let Workflow::BuildAndRun = self.workflow { + test.run(self.summary.clone()) + }; } }) .collect(); diff --git a/fuzzer/fuzz_targets/common.rs b/fuzzer/fuzz_targets/common.rs index bb2463f0..b3023f60 100644 --- a/fuzzer/fuzz_targets/common.rs +++ b/fuzzer/fuzz_targets/common.rs @@ -3,7 +3,7 @@ use std::{ sync::Arc, }; -use compiler_tester::{Buildable, EthereumTest, Mode, SolidityCompiler, SolidityMode, Summary}; +use compiler_tester::{Buildable, EthereumTest, Mode, SolidityCompiler, SolidityMode, Summary, Workflow}; pub use solidity_adapter::{ test::function_call::parser::{ lexical::token::{ @@ -173,6 +173,7 @@ pub fn build_and_run(test: EthereumTest) -> anyhow::Result { compiler_tester::Summary::new(true, false).wrap(), compiler_tester::Filters::new(vec![], vec![], vec![]), None, + Workflow::BuildAndRun )?; zkevm_tester::runners::compiler_tests::set_tracing_mode( zkevm_tester::runners::compiler_tests::VmTracingOptions::from_u64(0),