Skip to content

Commit 036da3a

Browse files
committed
Make remote-test-client work as cargo runner again
Since cargo appends executable/args, the support_lib count parameter has to come first.
1 parent 0199fdc commit 036da3a

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/bootstrap/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1762,7 +1762,7 @@ impl Step for Crate {
17621762
} else if builder.remote_tested(target) {
17631763
cargo.env(
17641764
format!("CARGO_TARGET_{}_RUNNER", envify(&target)),
1765-
format!("{} run", builder.tool_exe(Tool::RemoteTestClient).display()),
1765+
format!("{} run 0", builder.tool_exe(Tool::RemoteTestClient).display()),
17661766
);
17671767
}
17681768

src/tools/compiletest/src/runtest.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1608,8 +1608,7 @@ impl<'test> TestCx<'test> {
16081608
let mut test_client =
16091609
Command::new(self.config.remote_test_client.as_ref().unwrap());
16101610
test_client
1611-
.args(&["run", &prog])
1612-
.arg(support_libs.len().to_string())
1611+
.args(&["run", &support_libs.len().to_string(), &prog])
16131612
.args(support_libs)
16141613
.args(args)
16151614
.envs(env.clone());

src/tools/remote-test-client/src/main.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ fn main() {
4545
),
4646
"push" => push(Path::new(&args.next().unwrap())),
4747
"run" => run(
48-
args.next().unwrap(),
4948
args.next().and_then(|count| count.parse().ok()).unwrap(),
49+
// the last required parameter must remain the executable
50+
// path so that the client works as a cargo runner
51+
args.next().unwrap(),
5052
args.collect(),
5153
),
5254
"help" | "-h" | "--help" => help(),
@@ -201,7 +203,7 @@ fn push(path: &Path) {
201203
println!("done pushing {:?}", path);
202204
}
203205

204-
fn run(exe: String, support_lib_count: usize, all_args: Vec<String>) {
206+
fn run(support_lib_count: usize, exe: String, all_args: Vec<String>) {
205207
let device_address = env::var(REMOTE_ADDR_ENV).unwrap_or(DEFAULT_ADDR.to_string());
206208
let client = t!(TcpStream::connect(device_address));
207209
let mut client = BufWriter::new(client);
@@ -306,7 +308,7 @@ Usage: {0} <command> [<args>]
306308
Sub-commands:
307309
spawn-emulator <target> <server> <tmpdir> [rootfs] See below
308310
push <path> Copy <path> to emulator
309-
run <file> <support_lib_count> [support_libs...] [args...]
311+
run <support_lib_count> <file> [support_libs...] [args...]
310312
Run program on emulator
311313
help Display help message
312314

0 commit comments

Comments
 (0)