about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDennis Duda <git@seri.tools>2020-05-31 17:36:17 +0200
committerDennis Duda <git@seri.tools>2020-05-31 17:36:17 +0200
commit036da3a6dcc084db90dbe6ea2831eb7332a1c535 (patch)
tree4a2d1788b011504c417002a90883696c1a77be3d
parent0199fdc0f72ec6942d93d0bf23c7fa1fb9fbf54f (diff)
downloadrust-036da3a6dcc084db90dbe6ea2831eb7332a1c535.tar.gz
rust-036da3a6dcc084db90dbe6ea2831eb7332a1c535.zip
Make `remote-test-client` work as cargo runner again
Since cargo appends executable/args, the support_lib count
parameter has to come first.
-rw-r--r--src/bootstrap/test.rs2
-rw-r--r--src/tools/compiletest/src/runtest.rs3
-rw-r--r--src/tools/remote-test-client/src/main.rs8
3 files changed, 7 insertions, 6 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index f1305e2540b..3ae6c34d228 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -1762,7 +1762,7 @@ impl Step for Crate {
         } else if builder.remote_tested(target) {
             cargo.env(
                 format!("CARGO_TARGET_{}_RUNNER", envify(&target)),
-                format!("{} run", builder.tool_exe(Tool::RemoteTestClient).display()),
+                format!("{} run 0", builder.tool_exe(Tool::RemoteTestClient).display()),
             );
         }
 
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index a6995eb820a..4f8cf92b869 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1608,8 +1608,7 @@ impl<'test> TestCx<'test> {
                 let mut test_client =
                     Command::new(self.config.remote_test_client.as_ref().unwrap());
                 test_client
-                    .args(&["run", &prog])
-                    .arg(support_libs.len().to_string())
+                    .args(&["run", &support_libs.len().to_string(), &prog])
                     .args(support_libs)
                     .args(args)
                     .envs(env.clone());
diff --git a/src/tools/remote-test-client/src/main.rs b/src/tools/remote-test-client/src/main.rs
index 88eaaac287b..259477e9a1c 100644
--- a/src/tools/remote-test-client/src/main.rs
+++ b/src/tools/remote-test-client/src/main.rs
@@ -45,8 +45,10 @@ fn main() {
         ),
         "push" => push(Path::new(&args.next().unwrap())),
         "run" => run(
-            args.next().unwrap(),
             args.next().and_then(|count| count.parse().ok()).unwrap(),
+            // the last required parameter must remain the executable
+            // path so that the client works as a cargo runner
+            args.next().unwrap(),
             args.collect(),
         ),
         "help" | "-h" | "--help" => help(),
@@ -201,7 +203,7 @@ fn push(path: &Path) {
     println!("done pushing {:?}", path);
 }
 
-fn run(exe: String, support_lib_count: usize, all_args: Vec<String>) {
+fn run(support_lib_count: usize, exe: String, all_args: Vec<String>) {
     let device_address = env::var(REMOTE_ADDR_ENV).unwrap_or(DEFAULT_ADDR.to_string());
     let client = t!(TcpStream::connect(device_address));
     let mut client = BufWriter::new(client);
@@ -306,7 +308,7 @@ Usage: {0} <command> [<args>]
 Sub-commands:
     spawn-emulator <target> <server> <tmpdir> [rootfs]   See below
     push <path>                                          Copy <path> to emulator
-    run <file> <support_lib_count> [support_libs...] [args...]
+    run <support_lib_count> <file> [support_libs...] [args...]
                                                          Run program on emulator
     help                                                 Display help message