Support the —bins option to test

Change-Id: Ic38761f8b7bd2dc10cff0522a9569882580857da
Reviewed-on: https://fuchsia-review.googlesource.com/c/fargo/+/493993
Reviewed-by: Rob Tsuk <robtsuk@google.com>
diff --git a/src/command_line.rs b/src/command_line.rs
index 675c384..eab1eac 100644
--- a/src/command_line.rs
+++ b/src/command_line.rs
@@ -313,6 +313,10 @@
     #[structopt(long)]
     bin: Option<String>,
 
+    /// Test all binaries.
+    #[structopt(long)]
+    bins: bool,
+
     /// RunTest a specific example from the examples/ dir.
     #[structopt(long)]
     example: Option<String>,
@@ -699,6 +703,7 @@
                 test_opts.no_run,
                 test_opts.doc,
                 test_opts.lib,
+                test_opts.bins,
                 &target_options,
                 &params,
                 to_opt_str(&test_args),
diff --git a/src/lib.rs b/src/lib.rs
index 25b3a3b..3705a26 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -120,8 +120,17 @@
                 // TODO(raggi): provide a fuller ignore flag/pattern match solution here.
                 if !path.starts_with(&tgt) && !path.starts_with(&git) {
                     println!("autotest: running tests because {:?}", path);
-                    run_tests(run_cargo_options, false, false, false, target_options, &[], None)
-                        .ok();
+                    run_tests(
+                        run_cargo_options,
+                        false,
+                        false,
+                        false,
+                        false,
+                        target_options,
+                        &[],
+                        None,
+                    )
+                    .ok();
                 }
             }
             _ => {}
@@ -134,6 +143,7 @@
     no_run: bool,
     doc: bool,
     lib: bool,
+    bins: bool,
     target_options: &TargetOptions<'_, '_>,
     params: &[&str],
     target_params: Option<&str>,
@@ -152,6 +162,10 @@
         args.push("--lib");
     }
 
+    if bins {
+        args.push("--bins");
+    }
+
     for param in params {
         args.push(param);
     }