Changed the parameter for the network ping test
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Gregory Ballantine 2022-08-17 18:03:48 -04:00
parent 6fdc52b320
commit 9cd88d923d
2 changed files with 7 additions and 7 deletions

View File

@ -4,12 +4,12 @@ use std::{fs,process};
use crate::text; use crate::text;
// ping a host // ping a host
pub fn ping_host(host: &str, count: &u16) { pub fn ping_host(address: &str, count: &u16) {
println!("Pinging host {}, {} times.", host, count); println!("Pinging host {}, {} times.", address, count);
// run the ping command // run the ping command
let output = process::Command::new("ping") let output = process::Command::new("ping")
.arg(host) .arg(address)
.arg(format!("-c {}", count)) .arg(format!("-c {}", count))
.output() .output()
.expect("Failed to execute command"); .expect("Failed to execute command");

View File

@ -102,8 +102,8 @@ enum NetCommands {
// ping subcommand // ping subcommand
#[clap(name = "ping", about = "Ping a host to determine network latency.")] #[clap(name = "ping", about = "Ping a host to determine network latency.")]
Ping { Ping {
#[clap(short = 't', long, default_value_t = String::from("8.8.8.8"))] #[clap(short = 'a', long, default_value_t = String::from("8.8.8.8"))]
host: String, address: String,
#[clap(short = 'c', long, default_value_t = 30)] #[clap(short = 'c', long, default_value_t = 30)]
count: u16, count: u16,
}, },
@ -155,10 +155,10 @@ fn main() {
} }
Commands::Net(args) => match &args.net_commands { Commands::Net(args) => match &args.net_commands {
NetCommands::Ping { host, count } => { NetCommands::Ping { address, count } => {
for i in 0..cli.loopcount { for i in 0..cli.loopcount {
println!("Test run number {}.", i + 1); println!("Test run number {}.", i + 1);
benchmarks::network::ping_host(host, count); benchmarks::network::ping_host(address, count);
} }
}, },
NetCommands::Bandwidth { download, output } => { NetCommands::Bandwidth { download, output } => {