1pub mod bench;
2pub mod bytecode;
3pub mod eofvalidation;
4pub mod evmrunner;
5pub mod statetest;
6
7use clap::Parser;
8
9#[derive(Parser, Debug)]
10#[command(infer_subcommands = true)]
11#[allow(clippy::large_enum_variant)]
12pub enum MainCmd {
13 Statetest(statetest::Cmd),
15 EofValidation(eofvalidation::Cmd),
17 Evm(evmrunner::Cmd),
19 Bytecode(bytecode::Cmd),
21 Bench(bench::Cmd),
23}
24
25#[derive(Debug, thiserror::Error)]
26pub enum Error {
27 #[error(transparent)]
28 Statetest(#[from] statetest::Error),
29 #[error(transparent)]
30 EvmRunnerErrors(#[from] evmrunner::Errors),
31 #[error("Eof validation failed: {:?}/{total_tests}", total_tests-failed_test)]
32 EofValidation {
33 failed_test: usize,
34 total_tests: usize,
35 },
36 #[error("Custom error: {0}")]
37 Custom(&'static str),
38}
39
40impl MainCmd {
41 pub fn run(&self) -> Result<(), Error> {
42 match self {
43 Self::Statetest(cmd) => cmd.run()?,
44 Self::EofValidation(cmd) => cmd.run()?,
45 Self::Evm(cmd) => cmd.run()?,
46 Self::Bytecode(cmd) => {
47 cmd.run();
48 }
49 Self::Bench(cmd) => {
50 cmd.run();
51 }
52 }
53 Ok(())
54 }
55}