From c057d04b926314803769f7fda31b75fe01e911ec Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 23 Sep 2022 11:17:52 +0200 Subject: [PATCH 1/4] make remote-test-server cli parsing more consistent --- src/tools/remote-test-server/src/main.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/tools/remote-test-server/src/main.rs b/src/tools/remote-test-server/src/main.rs index cd9d5300964..8164b2b29ee 100644 --- a/src/tools/remote-test-server/src/main.rs +++ b/src/tools/remote-test-server/src/main.rs @@ -41,8 +41,8 @@ static TEST: AtomicUsize = AtomicUsize::new(0); #[derive(Copy, Clone)] struct Config { - pub remote: bool, - pub verbose: bool, + remote: bool, + verbose: bool, } impl Config { @@ -56,12 +56,8 @@ impl Config { let args = env::args().skip(1); for argument in args { match &argument[..] { - "remote" => { - config.remote = true; - } - "verbose" | "-v" => { - config.verbose = true; - } + "--remote" => config.remote = true, + "--verbose" | "-v" => config.verbose = true, arg => panic!("unknown argument: {}", arg), } } From 02869e3041cf7c30d8cb71c967931352dea66b80 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 23 Sep 2022 14:53:38 +0200 Subject: [PATCH 2/4] replace --remote with the --bind flag in remote-test-server --- src/tools/remote-test-server/src/main.rs | 32 ++++++++++++++++-------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/tools/remote-test-server/src/main.rs b/src/tools/remote-test-server/src/main.rs index 8164b2b29ee..058cf9a911a 100644 --- a/src/tools/remote-test-server/src/main.rs +++ b/src/tools/remote-test-server/src/main.rs @@ -12,6 +12,7 @@ #[cfg(not(windows))] use std::fs::Permissions; +use std::net::SocketAddr; #[cfg(not(windows))] use std::os::unix::prelude::*; @@ -41,26 +42,41 @@ static TEST: AtomicUsize = AtomicUsize::new(0); #[derive(Copy, Clone)] struct Config { - remote: bool, verbose: bool, + bind: SocketAddr, } impl Config { pub fn default() -> Config { - Config { remote: false, verbose: false } + Config { + verbose: false, + bind: if cfg!(target_os = "android") || cfg!(windows) { + ([0, 0, 0, 0], 12345).into() + } else { + ([10, 0, 2, 15], 12345).into() + }, + } } pub fn parse_args() -> Config { let mut config = Config::default(); let args = env::args().skip(1); + let mut next_is_bind = false; for argument in args { match &argument[..] { - "--remote" => config.remote = true, + bind if next_is_bind => { + config.bind = t!(bind.parse()); + next_is_bind = false; + } + "--bind" => next_is_bind = true, "--verbose" | "-v" => config.verbose = true, arg => panic!("unknown argument: {}", arg), } } + if next_is_bind { + panic!("missing value for --bind"); + } config } @@ -77,13 +93,7 @@ fn main() { let config = Config::parse_args(); - let bind_addr = if cfg!(target_os = "android") || cfg!(windows) || config.remote { - "0.0.0.0:12345" - } else { - "10.0.2.15:12345" - }; - - let listener = t!(TcpListener::bind(bind_addr)); + let listener = t!(TcpListener::bind(config.bind)); let (work, tmp): (PathBuf, PathBuf) = if cfg!(target_os = "android") { ("/data/tmp/work".into(), "/data/tmp/work/tmp".into()) } else { @@ -93,7 +103,7 @@ fn main() { tmp_dir.push("tmp"); (work_dir, tmp_dir) }; - println!("listening on {}!", bind_addr); + println!("listening on {}!", config.bind); t!(fs::create_dir_all(&work)); t!(fs::create_dir_all(&tmp)); From db14a527139355a13c61e109884c0b1f31d67c94 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 23 Sep 2022 14:54:55 +0200 Subject: [PATCH 3/4] add the --sequential flag to compiletest --- src/tools/remote-test-server/src/main.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/tools/remote-test-server/src/main.rs b/src/tools/remote-test-server/src/main.rs index 058cf9a911a..0c60d500a80 100644 --- a/src/tools/remote-test-server/src/main.rs +++ b/src/tools/remote-test-server/src/main.rs @@ -43,6 +43,7 @@ static TEST: AtomicUsize = AtomicUsize::new(0); #[derive(Copy, Clone)] struct Config { verbose: bool, + sequential: bool, bind: SocketAddr, } @@ -50,6 +51,7 @@ impl Config { pub fn default() -> Config { Config { verbose: false, + sequential: false, bind: if cfg!(target_os = "android") || cfg!(windows) { ([0, 0, 0, 0], 12345).into() } else { @@ -70,6 +72,7 @@ impl Config { next_is_bind = false; } "--bind" => next_is_bind = true, + "--sequential" => config.sequential = true, "--verbose" | "-v" => config.verbose = true, arg => panic!("unknown argument: {}", arg), } @@ -125,7 +128,12 @@ fn main() { let lock = lock.clone(); let work = work.clone(); let tmp = tmp.clone(); - thread::spawn(move || handle_run(socket, &work, &tmp, &lock, config)); + let f = move || handle_run(socket, &work, &tmp, &lock, config); + if config.sequential { + f(); + } else { + thread::spawn(f); + } } else { panic!("unknown command {:?}", buf); } From 20638eba8029ba471233ced4f38efade33a6dea7 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 23 Sep 2022 15:43:01 +0200 Subject: [PATCH 4/4] add changelog lines for the remote-test-server changes --- src/bootstrap/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bootstrap/CHANGELOG.md b/src/bootstrap/CHANGELOG.md index 85afc1f5f6c..64b74ecc9de 100644 --- a/src/bootstrap/CHANGELOG.md +++ b/src/bootstrap/CHANGELOG.md @@ -13,6 +13,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Change the names for `dist` commands to match the component they generate. [#90684](https://github.com/rust-lang/rust/pull/90684) - The `build.fast-submodules` option has been removed. Fast submodule checkouts are enabled unconditionally. Automatic submodule handling can still be disabled with `build.submodules = false`. - Several unsupported `./configure` options have been removed: `optimize`, `parallel-compiler`. These can still be enabled with `--set`, although it isn't recommended. +- `remote-test-server`'s `verbose` argument has been removed in favor of the `--verbose` flag +- `remote-test-server`'s `remote` argument has been removed in favor of the `--bind` flag. Use `--bind 0.0.0.0:12345` to replicate the behavior of the `remote` argument. ### Non-breaking changes