Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
beffae7cd4 | |||
477ad7482a | |||
833c71bed5 | |||
182d9b3cb4 |
@ -2,12 +2,15 @@ pipeline:
|
||||
test_build:
|
||||
image: rust:1.62
|
||||
commands:
|
||||
- cargo build
|
||||
- "cargo build"
|
||||
|
||||
build_release:
|
||||
image: rust:1.62
|
||||
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"
|
||||
when:
|
||||
event: tag
|
||||
@ -20,6 +23,8 @@ pipeline:
|
||||
base_url: https://git.metaunix.net
|
||||
files:
|
||||
- "target/release/*${CI_COMMIT_TAG}-linux-x86_64"
|
||||
- "target/debian/hardware-tests*.deb"
|
||||
- "target/generate-rpm/hardware-tests*.rpm"
|
||||
title: "${CI_COMMIT_TAG}"
|
||||
when:
|
||||
event: tag
|
||||
|
18
Cargo.toml
18
Cargo.toml
@ -1,14 +1,26 @@
|
||||
[package]
|
||||
name = "hardware-tests"
|
||||
version = "0.2.2"
|
||||
description = "Bit Goblin PC hardware test suite."
|
||||
version = "0.2.4"
|
||||
edition = "2021"
|
||||
readme = "README.md"
|
||||
license = "BSD 2-Clause"
|
||||
authors = ["Gregory Ballantine <gballantine@bitgoblin.tech>"]
|
||||
|
||||
[[bin]]
|
||||
name = "bgbench"
|
||||
path = "src/main.rs"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
chrono = "0.4.20"
|
||||
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 = "*"
|
||||
|
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