diff --git a/src/benchmarks/games.rs b/src/benchmarks/games.rs new file mode 100644 index 0000000..6d761b2 --- /dev/null +++ b/src/benchmarks/games.rs @@ -0,0 +1,31 @@ +use std::process::Command; + +pub fn run_civ6_ai_benchmark() { + // make sure CS:GO is installed via Steam + download_game_steam(289070); +} + +// run the CS:GO benchmark (using benchmark file from PTS) +pub fn run_csgo_benchmark() { + // make sure CS:GO is installed via Steam + download_game_steam(730); +} + +pub fn run_demd_benchmark() { + // make sure CS:GO is installed via Steam + download_game_steam(337000); +} + +fn download_game_steam(game_id: u32) { + // first we need to make sure CS:GO is installed via Steam + let install_output = Command::new("C:\\Program Files (x86)\\Steam\\steam.exe") + .arg(format!("steam://install/{}", game_id)) + .output() + .expect("Failed to execute command"); + + // check that the command succeeded + assert!(install_output.status.success()); + + // print the test's output + println!("{}", String::from_utf8_lossy(&install_output.stdout)); +} diff --git a/src/benchmarks/mod.rs b/src/benchmarks/mod.rs index 1b223d9..703e963 100644 --- a/src/benchmarks/mod.rs +++ b/src/benchmarks/mod.rs @@ -1,2 +1,3 @@ pub mod disk; +pub mod games; pub mod network; diff --git a/src/main.rs b/src/main.rs index cda1935..bdbc04c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,6 +23,9 @@ enum Commands { // disk benchmarks subcommand #[clap(name = "disk", about = "Hard drive and SSD benchmarks.")] Disk(Disk), + // games benchmarks subcommand + #[clap(name = "games", about = "Benchmark your system with games.")] + Games(Games), // network benchmarks subcommand #[clap(name = "network", about = "Test various aspects of your network.")] Net(Net), @@ -91,6 +94,27 @@ enum DiskCommands { }, } +#[derive(Parser)] +struct Games { + #[structopt(subcommand)] + games_commands: GamesCommands, +} + +#[derive(Subcommand)] +enum GamesCommands { + // Civilization 6 AI benchmark subcommand + #[clap(name = "civ6_ai", about = "Run the Civilization 6 AI benchmark via Steam.")] + Civ6AI {}, + + // CS:GO benchmark subcommand + #[clap(name = "csgo", about = "Run the CS:GO game benchmark via Steam.")] + CSGO {}, + + // Deus Ex: Mankind Divided benchmark subcommand + #[clap(name = "demd", about = "Run the Deus Ex: Mankind Divided game benchmark via Steam.")] + DEMD {}, +} + #[derive(Parser)] struct Net { #[structopt(subcommand)] @@ -161,7 +185,13 @@ fn main() { benchmarks::disk::disk_write_rand_test(tempfile, size); } }, - } + }, + + Commands::Games(args) => match &args.games_commands { + GamesCommands::Civ6AI {} => benchmarks::games::run_civ6_ai_benchmark(), + GamesCommands::CSGO {} => benchmarks::games::run_csgo_benchmark(), + GamesCommands::DEMD {} => benchmarks::games::run_demd_benchmark(), + }, Commands::Net(args) => match &args.net_commands { NetCommands::Ping { address, count } => {