Skip to content

Commit

Permalink
feat(zk_toolbox): Add zk_supervisor test prover command (#2614)
Browse files Browse the repository at this point in the history
## What ❔
Add zk_supervisor test prover command
  • Loading branch information
matias-gonz authored Aug 12, 2024
1 parent e07a39d commit 0fe173b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
8 changes: 6 additions & 2 deletions zk_toolbox/crates/zk_supervisor/src/commands/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ use clap::Subcommand;
use xshell::Shell;

use crate::messages::{
MSG_INTEGRATION_TESTS_ABOUT, MSG_RECOVERY_TEST_ABOUT, MSG_REVERT_TEST_ABOUT,
MSG_UPGRADE_TEST_ABOUT,
MSG_INTEGRATION_TESTS_ABOUT, MSG_PROVER_TEST_ABOUT, MSG_RECOVERY_TEST_ABOUT,
MSG_REVERT_TEST_ABOUT, MSG_UPGRADE_TEST_ABOUT,
};

mod args;
mod integration;
mod prover;
mod recovery;
mod revert;
mod upgrade;
Expand All @@ -23,6 +24,8 @@ pub enum TestCommands {
Recovery(RecoveryArgs),
#[clap(about = MSG_UPGRADE_TEST_ABOUT, alias = "u")]
Upgrade,
#[clap(about = MSG_PROVER_TEST_ABOUT, alias = "p")]
Prover,
}

pub fn run(shell: &Shell, args: TestCommands) -> anyhow::Result<()> {
Expand All @@ -31,5 +34,6 @@ pub fn run(shell: &Shell, args: TestCommands) -> anyhow::Result<()> {
TestCommands::Revert(args) => revert::run(shell, args),
TestCommands::Recovery(args) => recovery::run(shell, args),
TestCommands::Upgrade => upgrade::run(shell),
TestCommands::Prover => prover::run(shell),
}
}
17 changes: 17 additions & 0 deletions zk_toolbox/crates/zk_supervisor/src/commands/test/prover.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use common::{cmd::Cmd, logger};
use config::EcosystemConfig;
use xshell::{cmd, Shell};

use crate::messages::MSG_PROVER_TEST_SUCCESS;

pub fn run(shell: &Shell) -> anyhow::Result<()> {
let ecosystem = EcosystemConfig::from_file(shell)?;
let _dir_guard = shell.push_dir(&ecosystem.link_to_code.join("prover"));

Cmd::new(cmd!(shell, "cargo test --release --workspace --locked"))
.with_force_run()
.run()?;

logger::outro(MSG_PROVER_TEST_SUCCESS);
Ok(())
}
2 changes: 2 additions & 0 deletions zk_toolbox/crates/zk_supervisor/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ pub(super) const MSG_UPGRADE_TEST_ABOUT: &str = "Run upgrade tests";
pub(super) const MSG_TESTS_EXTERNAL_NODE_HELP: &str = "Run tests for external node";
pub(super) const MSG_TESTS_RECOVERY_SNAPSHOT_HELP: &str =
"Run recovery from a snapshot instead of genesis";
pub(super) const MSG_PROVER_TEST_ABOUT: &str = "Run prover tests";
pub(super) const MSG_PROVER_TEST_SUCCESS: &str = "Prover tests ran successfully";

// Integration tests related messages
pub(super) fn msg_integration_tests_run(external_node: bool) -> String {
Expand Down

0 comments on commit 0fe173b

Please sign in to comment.