vyre-conform 0.1.0

Conformance suite for vyre backends — proves byte-identical output to CPU reference
Documentation
#![deny(unsafe_code)]
#![cfg_attr(not(test), deny(clippy::todo, clippy::unimplemented))]

//! Unified command line entry point for `vyre-conform`.

use clap::{Parser, Subcommand};

#[path = "../adversarial/mod.rs"]
pub(crate) mod adversarial;
#[path = "../enforce/mod.rs"]
pub(crate) mod enforce;
#[path = "../generate/mod.rs"]
pub(crate) mod generate;
#[path = "../meta/mod.rs"]
pub(crate) mod meta;
#[path = "../pipeline/mod.rs"]
pub(crate) mod pipeline;
#[path = "../proof/mod.rs"]
pub(crate) mod proof;
#[path = "../spec/mod.rs"]
pub(crate) mod spec;
#[path = "../verify/mod.rs"]
pub(crate) mod verify;

#[path = "../pipeline/bin/mod.rs"]
mod command;

pub use crate::enforce::EnforceGate;
pub use crate::generate::archetypes::Archetype;
pub use crate::pipeline::certify::certify;
pub use crate::pipeline::certify::Certificate;
pub use crate::pipeline::certify::Violation;
pub use crate::proof::oracles::Oracle;
pub use crate::spec::types::MutationClass;
pub use crate::spec::types::OpSpec;
pub use crate::spec::Finding;
pub use vyre::VyreBackend;
pub use vyre_spec::{AlgebraicLaw, Category};

pub(crate) use crate::meta::contribute;
pub(crate) use crate::pipeline::execution::InputCase;
pub(crate) use crate::pipeline::reporter;
pub(crate) use crate::spec::op_registry;
pub(crate) use crate::spec::registry;
pub(crate) use crate::spec::types::{
    BufferAccess, ChainSpec, Convention, DataType, OpSignature, ParityFailure, Strictness,
};
pub(crate) use crate::verify::regression;

/// Top-level `vyre-conform` arguments.
#[derive(Debug, Parser)]
#[command(name = "vyre-conform", about = "Vyre conformance command line tools")]
struct Cli {
    /// Subcommand to execute.
    #[command(subcommand)]
    command: Command,
}

/// Unified conform subcommands.
#[derive(Debug, Subcommand)]
enum Command {
    /// Certify a backend against the compiled conformance registry.
    Certify(command::certify::Args),
    /// Verify a certificate against the compiled registry hash.
    VerifyCert(command::verify_cert::Args),
    /// Run the contributor feedback loop.
    Contribute(command::contribute::Args),
    /// Freeze missing golden files.
    FreezeGoldens(command::freeze_goldens::Args),
    /// Run Phase 6 calibration.
    Calibrate(command::phase6_calibrate::Args),
    /// Emit the law coverage matrix.
    Coverage(command::coverage::Args),
    /// Materialize generated tests.
    GenTests(command::gen_tests::Args),
}

fn main() {
    if let Err(error) = run(Cli::parse()) {
        eprintln!("{error}");
        std::process::exit(1);
    }
}

fn run(cli: Cli) -> Result<(), Box<dyn std::error::Error>> {
    match cli.command {
        Command::Certify(args) => command::certify::run(args),
        Command::VerifyCert(args) => command::verify_cert::run(args),
        Command::Contribute(args) => command::contribute::run(args),
        Command::FreezeGoldens(args) => command::freeze_goldens::run(args),
        Command::Calibrate(args) => command::phase6_calibrate::run(args),
        Command::Coverage(args) => command::coverage::run(args),
        Command::GenTests(args) => command::gen_tests::run(args),
    }
}