4 Commits

Author SHA1 Message Date
beffae7cd4 Version bump to v0.2.4
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2022-08-06 17:31:27 -04:00
477ad7482a Added a global parameter to loop tests
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-08-06 17:31:02 -04:00
833c71bed5 Version bump to v0.2.3
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2022-08-06 01:54:37 -04:00
182d9b3cb4 Added package info for packaging
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2022-08-06 01:54:17 -04:00
3 changed files with 64 additions and 14 deletions

View File

@ -2,12 +2,15 @@ pipeline:
test_build: test_build:
image: rust:1.62 image: rust:1.62
commands: commands:
- cargo build - "cargo build"
build_release: build_release:
image: rust:1.62 image: rust:1.62
commands: commands:
- cargo build --release - "cargo install cargo-deb cargo-generate-rpm"
- "cargo build --release"
- "cargo deb"
- "cargo generate-rpm"
- "mv target/release/bgbench target/release/bgbench-${CI_COMMIT_TAG}-linux-x86_64" - "mv target/release/bgbench target/release/bgbench-${CI_COMMIT_TAG}-linux-x86_64"
when: when:
event: tag event: tag
@ -20,6 +23,8 @@ pipeline:
base_url: https://git.metaunix.net base_url: https://git.metaunix.net
files: files:
- "target/release/*${CI_COMMIT_TAG}-linux-x86_64" - "target/release/*${CI_COMMIT_TAG}-linux-x86_64"
- "target/debian/hardware-tests*.deb"
- "target/generate-rpm/hardware-tests*.rpm"
title: "${CI_COMMIT_TAG}" title: "${CI_COMMIT_TAG}"
when: when:
event: tag event: tag

View File

@ -1,14 +1,26 @@
[package] [package]
name = "hardware-tests" name = "hardware-tests"
version = "0.2.2" description = "Bit Goblin PC hardware test suite."
version = "0.2.4"
edition = "2021" edition = "2021"
readme = "README.md"
license = "BSD 2-Clause"
authors = ["Gregory Ballantine <gballantine@bitgoblin.tech>"]
[[bin]] [[bin]]
name = "bgbench" name = "bgbench"
path = "src/main.rs" path = "src/main.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
chrono = "0.4.20" chrono = "0.4.20"
clap = { version = "3.2.16", features = ["derive"] } clap = { version = "3.2.16", features = ["derive"] }
[package.metadata.deb]
depends = "fio"
[package.metadata.generate-rpm]
assets = [
{ source = "target/release/bgbench", dest = "/usr/bin/bgbench", mode = "755" },
]
[package.metadata.generate-rpm.requires]
fio = "*"

View File

@ -1,6 +1,6 @@
mod tests; mod tests;
use clap::{Parser, Subcommand}; use clap::{Args, Parser, Subcommand};
#[derive(Parser)] #[derive(Parser)]
#[clap(name = "Bit Goblin Benchmark", author, version, about = "Bit Goblin's hardware benchmarking tool.", long_about = None)] #[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 { struct Cli {
#[clap(subcommand)] #[clap(subcommand)]
command: Commands, command: Commands,
#[clap(short = 'l', default_value_t = 1, help = "Number of times to run test. Default = 1", global = true)]
loopcount: u8,
} }
#[derive(Subcommand)] #[derive(Subcommand)]
@ -20,9 +23,9 @@ enum Commands {
Net(Net), Net(Net),
} }
#[derive(Parser)] #[derive(Args)]
struct Disk { struct Disk {
#[structopt(subcommand)] #[clap(subcommand)]
disk_commands: DiskCommands, disk_commands: DiskCommands,
} }
@ -98,15 +101,45 @@ fn main() {
// map subcommands back to the main command // map subcommands back to the main command
match &cli.command { match &cli.command {
Commands::Disk(args) => match &args.disk_commands { Commands::Disk(args) => match &args.disk_commands {
DiskCommands::ReadSeqTest { tempfile, size } => tests::disk::disk_read_seq_test(tempfile, size), DiskCommands::ReadSeqTest { tempfile, size } => {
DiskCommands::ReadRandTest { tempfile, size } => tests::disk::disk_read_rand_test(tempfile, size), for i in 0..cli.loopcount {
DiskCommands::WriteSeqTest { tempfile, size } => tests::disk::disk_write_seq_test(tempfile, size), println!("Test run number {}.", i + 1);
DiskCommands::WriteRandTest { tempfile, size } => tests::disk::disk_write_rand_test(tempfile, size), 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 { Commands::Net(args) => match &args.net_commands {
NetCommands::Ping { host, count } => tests::network::ping_host(host, count), NetCommands::Ping { host, count } => {
NetCommands::Bandwidth { download, output } => tests::network::bandwidth_test(download, output), 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);
}
},
}, },
} }
} }