Added a global parameter to loop tests
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				ci/woodpecker/push/woodpecker Pipeline was successful
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	ci/woodpecker/push/woodpecker Pipeline was successful
				
			This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,6 @@ version = "0.2.3"
 | 
			
		||||
edition = "2021"
 | 
			
		||||
readme = "README.md"
 | 
			
		||||
license = "BSD 2-Clause"
 | 
			
		||||
license-file = "LICENSE"
 | 
			
		||||
authors = ["Gregory Ballantine <gballantine@bitgoblin.tech>"]
 | 
			
		||||
 | 
			
		||||
[[bin]]
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										51
									
								
								src/main.rs
									
									
									
									
									
								
							
							
						
						
									
										51
									
								
								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);
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
        },
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user