Skip to content

Commit c678841

Browse files
committed
rust test: pass the remaining arguments through
The arguments after `rust test filename.rs` should be passed through to the test binary. This allows the `rust` command to be used to run a subset of tests, to run ignored tests, and to run benchmarks.
1 parent c8c3c3b commit c678841

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/librust/rust.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ static COMMANDS: &'static [Command<'static>] = &'static [
8484
usage_full: UsgStr(
8585
"The test command is an shortcut for the command line \n\
8686
\"rustc --test <filename> -o <filestem>test~ && \
87-
./<filestem>test~\"\n\nUsage:\trust test <filename>"
87+
./<filestem>test~ [<arguments>...]\"\
88+
\n\nUsage:\trust test <filename> [<arguments>...]"
8889
)
8990
},
9091
Command {
@@ -155,12 +156,12 @@ fn cmd_help(args: &[~str]) -> ValidUsage {
155156

156157
fn cmd_test(args: &[~str]) -> ValidUsage {
157158
match args {
158-
[ref filename] => {
159+
[ref filename, ..prog_args] => {
159160
let p = Path(*filename);
160161
let test_exec = p.filestem().unwrap() + "test~";
161162
invoke("rustc", &[~"--test", filename.to_owned(),
162163
~"-o", test_exec.to_owned()], rustc::main_args);
163-
let exit_code = run::process_status(~"./" + test_exec, []);
164+
let exit_code = run::process_status(~"./" + test_exec, prog_args);
164165
Valid(exit_code)
165166
}
166167
_ => Invalid

0 commit comments

Comments
 (0)