Skip to content

Commit

Permalink
Rollup merge of #102962 - flba-eb:remote_test_server_help, r=pietroal…
Browse files Browse the repository at this point in the history
…bini

remote-test-server: Show command line arguments

The user of remote-test-server should get at least some minimal command line help as this is often started manually.

r? `@pietroalbini`
  • Loading branch information
matthiaskrgr authored Oct 17, 2022
2 parents c19a893 + 690b9fa commit 9a615fd
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions src/tools/remote-test-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ impl Config {
"--bind" => next_is_bind = true,
"--sequential" => config.sequential = true,
"--verbose" | "-v" => config.verbose = true,
arg => panic!("unknown argument: {}", arg),
"--help" | "-h" => {
show_help();
std::process::exit(0);
}
arg => panic!("unknown argument: {}, use `--help` for known arguments", arg),
}
}
if next_is_bind {
Expand All @@ -85,16 +89,31 @@ impl Config {
}
}

fn show_help() {
eprintln!(
r#"Usage:
{} [OPTIONS]
OPTIONS:
--bind <IP>:<PORT> Specify IP address and port to listen for requests, e.g. "0.0.0.0:12345"
--sequential Run only one test at a time
-v, --verbose Show status messages
-h, --help Show this help screen
"#,
std::env::args().next().unwrap()
);
}

fn print_verbose(s: &str, conf: Config) {
if conf.verbose {
println!("{}", s);
}
}

fn main() {
println!("starting test server");

let config = Config::parse_args();
println!("starting test server");

let listener = t!(TcpListener::bind(config.bind));
let (work, tmp): (PathBuf, PathBuf) = if cfg!(target_os = "android") {
Expand Down

0 comments on commit 9a615fd

Please sign in to comment.