diff --git a/.woodpecker.yml b/.woodpecker.yml index 2936a03..520cc45 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -23,8 +23,8 @@ pipeline: base_url: https://git.metaunix.net files: - "target/release/*${CI_COMMIT_TAG}-linux-x86_64" - - "target/debian/hardware-tests_${CI_COMMIT_TAG}*.deb" - - "target/generate-rpm/hardware-tests-${CI_COMMIT_TAG}*.rpm" + - "target/debian/hardware-tests*.deb" + - "target/generate-rpm/hardware-tests*.rpm" title: "${CI_COMMIT_TAG}" when: event: tag diff --git a/Cargo.toml b/Cargo.toml index f9efde3..6d596a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,6 @@ version = "0.2.3" edition = "2021" readme = "README.md" license = "BSD 2-Clause" -license-file = "LICENSE" authors = ["Gregory Ballantine "] [[bin]] diff --git a/src/main.rs b/src/main.rs index 03eb441..48d26a2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ mod tests; -use clap::{Parser, Subcommand}; +use clap::{Args, Parser, Subcommand}; #[derive(Parser)] #[clap(name = "Bit Goblin Benchmark", author, version, about = "Bit Goblin's hardware benchmarking tool.", long_about = None)] @@ -8,6 +8,9 @@ use clap::{Parser, Subcommand}; struct Cli { #[clap(subcommand)] command: Commands, + + #[clap(short = 'l', default_value_t = 1, help = "Number of times to run test. Default = 1", global = true)] + loopcount: u8, } #[derive(Subcommand)] @@ -20,9 +23,9 @@ enum Commands { Net(Net), } -#[derive(Parser)] +#[derive(Args)] struct Disk { - #[structopt(subcommand)] + #[clap(subcommand)] disk_commands: DiskCommands, } @@ -98,15 +101,45 @@ fn main() { // map subcommands back to the main command match &cli.command { Commands::Disk(args) => match &args.disk_commands { - DiskCommands::ReadSeqTest { tempfile, size } => tests::disk::disk_read_seq_test(tempfile, size), - DiskCommands::ReadRandTest { tempfile, size } => tests::disk::disk_read_rand_test(tempfile, size), - DiskCommands::WriteSeqTest { tempfile, size } => tests::disk::disk_write_seq_test(tempfile, size), - DiskCommands::WriteRandTest { tempfile, size } => tests::disk::disk_write_rand_test(tempfile, size), + DiskCommands::ReadSeqTest { tempfile, size } => { + for i in 0..cli.loopcount { + println!("Test run number {}.", i + 1); + tests::disk::disk_read_seq_test(tempfile, size); + } + }, + DiskCommands::ReadRandTest { tempfile, size } => { + for i in 0..cli.loopcount { + println!("Test run number {}.", i + 1); + tests::disk::disk_read_rand_test(tempfile, size); + } + }, + DiskCommands::WriteSeqTest { tempfile, size } => { + for i in 0..cli.loopcount { + println!("Test run number {}.", i + 1); + tests::disk::disk_write_seq_test(tempfile, size); + } + }, + DiskCommands::WriteRandTest { tempfile, size } => { + for i in 0..cli.loopcount { + println!("Test run number {}.", i + 1); + tests::disk::disk_write_rand_test(tempfile, size); + } + }, } Commands::Net(args) => match &args.net_commands { - NetCommands::Ping { host, count } => tests::network::ping_host(host, count), - NetCommands::Bandwidth { download, output } => tests::network::bandwidth_test(download, output), + NetCommands::Ping { host, count } => { + for i in 0..cli.loopcount { + println!("Test run number {}.", i + 1); + tests::network::ping_host(host, count); + } + }, + NetCommands::Bandwidth { download, output } => { + for i in 0..cli.loopcount { + println!("Test run number {}.", i + 1); + tests::network::bandwidth_test(download, output); + } + }, }, } }