Skip to content

Commit 6143ab4

Browse files
committed
---
yaml --- r: 114171 b: refs/heads/master c: 182c96c h: refs/heads/master i: 114169: 962107c 114167: 66f9617 v: v3
1 parent 6045c7f commit 6143ab4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+4469
-1697
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: b7676f2df5e1ff97e0baa3f7e70936d4bd4dacb5
2+
refs/heads/master: 182c96c9212a2b7e830fe5f9a6662e72f73775ec
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ec0258a381b88b5574e3f8ce72ae553ac3a574b7
55
refs/heads/try: 7c6c492fb2af9a85f21ff952942df3523b22fd17

trunk/mk/crates.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ DEPS_collections := std rand
8080
DEPS_fourcc := syntax std
8181
DEPS_hexfloat := syntax std
8282
DEPS_num := std rand
83-
DEPS_test := std collections getopts serialize term time
83+
DEPS_test := std collections getopts serialize term time regex
8484
DEPS_time := std serialize
8585
DEPS_rand := std
8686
DEPS_url := std collections

trunk/src/compiletest/common.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use std::from_str::FromStr;
1212
use std::fmt;
13+
use regex::Regex;
1314

1415
#[deriving(Clone, Eq)]
1516
pub enum Mode {
@@ -88,7 +89,7 @@ pub struct Config {
8889
pub run_ignored: bool,
8990

9091
// Only run tests that match this filter
91-
pub filter: Option<~str>,
92+
pub filter: Option<Regex>,
9293

9394
// Write out a parseable log of tests that were run
9495
pub logfile: Option<Path>,

trunk/src/compiletest/compiletest.rs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ extern crate log;
2323
extern crate green;
2424
extern crate rustuv;
2525

26+
extern crate regex;
27+
2628
use std::os;
2729
use std::io;
2830
use std::io::fs;
@@ -113,6 +115,19 @@ pub fn parse_config(args: Vec<~str> ) -> Config {
113115
Path::new(m.opt_str(nm).unwrap())
114116
}
115117

118+
let filter = if !matches.free.is_empty() {
119+
let s = matches.free.get(0).as_slice();
120+
match regex::Regex::new(s) {
121+
Ok(re) => Some(re),
122+
Err(e) => {
123+
println!("failed to parse filter /{}/: {}", s, e);
124+
fail!()
125+
}
126+
}
127+
} else {
128+
None
129+
};
130+
116131
Config {
117132
compile_lib_path: matches.opt_str("compile-lib-path").unwrap(),
118133
run_lib_path: matches.opt_str("run-lib-path").unwrap(),
@@ -125,12 +140,7 @@ pub fn parse_config(args: Vec<~str> ) -> Config {
125140
stage_id: matches.opt_str("stage-id").unwrap(),
126141
mode: FromStr::from_str(matches.opt_str("mode").unwrap()).expect("invalid mode"),
127142
run_ignored: matches.opt_present("ignored"),
128-
filter:
129-
if !matches.free.is_empty() {
130-
Some((*matches.free.get(0)).clone())
131-
} else {
132-
None
133-
},
143+
filter: filter,
134144
logfile: matches.opt_str("logfile").map(|s| Path::new(s)),
135145
save_metrics: matches.opt_str("save-metrics").map(|s| Path::new(s)),
136146
ratchet_metrics:
@@ -169,7 +179,7 @@ pub fn log_config(config: &Config) {
169179
logv(c, format!("stage_id: {}", config.stage_id));
170180
logv(c, format!("mode: {}", config.mode));
171181
logv(c, format!("run_ignored: {}", config.run_ignored));
172-
logv(c, format!("filter: {}", opt_str(&config.filter)));
182+
logv(c, format!("filter: {}", opt_str(&config.filter.as_ref().map(|re| re.to_str()))));
173183
logv(c, format!("runtool: {}", opt_str(&config.runtool)));
174184
logv(c, format!("host-rustcflags: {}", opt_str(&config.host_rustcflags)));
175185
logv(c, format!("target-rustcflags: {}", opt_str(&config.target_rustcflags)));
@@ -238,7 +248,7 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
238248
test::TestOpts {
239249
filter: match config.filter {
240250
None => None,
241-
Some(ref filter) => Some(filter.to_strbuf()),
251+
Some(ref filter) => Some(filter.clone()),
242252
},
243253
run_ignored: config.run_ignored,
244254
logfile: config.logfile.clone(),

trunk/src/compiletest/procsrv.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use std::os;
1212
use std::str;
13-
use std::io::process::{ProcessExit, Process, ProcessConfig, ProcessOutput};
13+
use std::io::process::{ProcessExit, Command, Process, ProcessOutput};
1414

1515
#[cfg(target_os = "win32")]
1616
fn target_env(lib_path: &str, prog: &str) -> Vec<(~str, ~str)> {
@@ -68,14 +68,7 @@ pub fn run(lib_path: &str,
6868
input: Option<~str>) -> Option<Result> {
6969

7070
let env = env.clone().append(target_env(lib_path, prog).as_slice());
71-
let opt_process = Process::configure(ProcessConfig {
72-
program: prog,
73-
args: args,
74-
env: Some(env.as_slice()),
75-
.. ProcessConfig::new()
76-
});
77-
78-
match opt_process {
71+
match Command::new(prog).args(args).env(env.as_slice()).spawn() {
7972
Ok(mut process) => {
8073
for input in input.iter() {
8174
process.stdin.get_mut_ref().write(input.as_bytes()).unwrap();
@@ -100,14 +93,7 @@ pub fn run_background(lib_path: &str,
10093
input: Option<~str>) -> Option<Process> {
10194

10295
let env = env.clone().append(target_env(lib_path, prog).as_slice());
103-
let opt_process = Process::configure(ProcessConfig {
104-
program: prog,
105-
args: args,
106-
env: Some(env.as_slice()),
107-
.. ProcessConfig::new()
108-
});
109-
110-
match opt_process {
96+
match Command::new(prog).args(args).env(env.as_slice()).spawn() {
11197
Ok(mut process) => {
11298
for input in input.iter() {
11399
process.stdin.get_mut_ref().write(input.as_bytes()).unwrap();

trunk/src/compiletest/runtest.rs

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
420420
}
421421

422422
fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path) {
423-
use std::io::process::{Process, ProcessConfig, ProcessOutput};
423+
use std::io::process::{Command, ProcessOutput};
424424

425425
if config.lldb_python_dir.is_none() {
426426
fatal("Can't run LLDB test because LLDB's python path is not set.".to_owned());
@@ -483,25 +483,13 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
483483

484484
fn run_lldb(config: &Config, test_executable: &Path, debugger_script: &Path) -> ProcRes {
485485
// Prepare the lldb_batchmode which executes the debugger script
486-
let lldb_batchmode_script = "./src/etc/lldb_batchmode.py".to_owned();
487-
let test_executable_str = test_executable.as_str().unwrap().to_owned();
488-
let debugger_script_str = debugger_script.as_str().unwrap().to_owned();
489-
let commandline = format!("python {} {} {}",
490-
lldb_batchmode_script.as_slice(),
491-
test_executable_str.as_slice(),
492-
debugger_script_str.as_slice());
493-
494-
let args = &[lldb_batchmode_script, test_executable_str, debugger_script_str];
495-
let env = &[("PYTHONPATH".to_owned(), config.lldb_python_dir.clone().unwrap())];
496-
497-
let opt_process = Process::configure(ProcessConfig {
498-
program: "python",
499-
args: args,
500-
env: Some(env),
501-
.. ProcessConfig::new()
502-
});
503-
504-
let (status, out, err) = match opt_process {
486+
let mut cmd = Command::new("python");
487+
cmd.arg("./src/etc/lldb_batchmode.py")
488+
.arg(test_executable)
489+
.arg(debugger_script)
490+
.env([("PYTHONPATH", config.lldb_python_dir.clone().unwrap().as_slice())]);
491+
492+
let (status, out, err) = match cmd.spawn() {
505493
Ok(process) => {
506494
let ProcessOutput { status, output, error } =
507495
process.wait_with_output().unwrap();
@@ -520,7 +508,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
520508
status: status,
521509
stdout: out,
522510
stderr: err,
523-
cmdline: commandline
511+
cmdline: format!("{}", cmd)
524512
};
525513
}
526514
}

trunk/src/doc/guide-testing.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,15 @@ fn test_out_of_bounds_failure() {
9090
~~~
9191

9292
A test runner built with the `--test` flag supports a limited set of
93-
arguments to control which tests are run: the first free argument
94-
passed to a test runner specifies a filter used to narrow down the set
95-
of tests being run; the `--ignored` flag tells the test runner to run
96-
only tests with the `ignore` attribute.
93+
arguments to control which tests are run:
94+
95+
- the first free argument passed to a test runner is interpreted as a
96+
regular expression
97+
([syntax reference](regex/index.html#syntax))
98+
and is used to narrow down the set of tests being run. Note: a plain
99+
string is a valid regular expression that matches itself.
100+
- the `--ignored` flag tells the test runner to run only tests with the
101+
`ignore` attribute.
97102

98103
## Parallelism
99104

@@ -146,16 +151,31 @@ result: FAILED. 1 passed; 1 failed; 0 ignored
146151

147152
### Running a subset of tests
148153

154+
Using a plain string:
155+
156+
~~~ {.notrust}
157+
$ mytests mytest23
158+
159+
running 1 tests
160+
running driver::tests::mytest23 ... ok
161+
162+
result: ok. 1 passed; 0 failed; 0 ignored
163+
~~~
164+
165+
Using some regular expression features:
166+
149167
~~~ {.notrust}
150-
$ mytests mytest1
168+
$ mytests 'mytest[145]'
151169
152-
running 11 tests
170+
running 13 tests
153171
running driver::tests::mytest1 ... ok
172+
running driver::tests::mytest4 ... ok
173+
running driver::tests::mytest5 ... ok
154174
running driver::tests::mytest10 ... ignored
155175
... snip ...
156176
running driver::tests::mytest19 ... ok
157177
158-
result: ok. 11 passed; 0 failed; 1 ignored
178+
result: ok. 13 passed; 0 failed; 1 ignored
159179
~~~
160180

161181
# Microbenchmarking

trunk/src/libnative/io/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@ use std::c_str::CString;
2727
use std::io;
2828
use std::io::IoError;
2929
use std::io::net::ip::SocketAddr;
30-
use std::io::process::ProcessConfig;
3130
use std::io::signal::Signum;
3231
use std::os;
3332
use std::rt::rtio;
3433
use std::rt::rtio::{RtioTcpStream, RtioTcpListener, RtioUdpSocket};
3534
use std::rt::rtio::{RtioUnixListener, RtioPipe, RtioFileStream, RtioProcess};
36-
use std::rt::rtio::{RtioSignal, RtioTTY, CloseBehavior, RtioTimer};
35+
use std::rt::rtio::{RtioSignal, RtioTTY, CloseBehavior, RtioTimer, ProcessConfig};
3736
use ai = std::io::net::addrinfo;
3837

3938
// Local re-exports
@@ -258,10 +257,10 @@ impl rtio::IoFactory for IoFactory {
258257
fn timer_init(&mut self) -> IoResult<Box<RtioTimer:Send>> {
259258
timer::Timer::new().map(|t| box t as Box<RtioTimer:Send>)
260259
}
261-
fn spawn(&mut self, config: ProcessConfig)
260+
fn spawn(&mut self, cfg: ProcessConfig)
262261
-> IoResult<(Box<RtioProcess:Send>,
263262
Vec<Option<Box<RtioPipe:Send>>>)> {
264-
process::Process::spawn(config).map(|(p, io)| {
263+
process::Process::spawn(cfg).map(|(p, io)| {
265264
(box p as Box<RtioProcess:Send>,
266265
io.move_iter().map(|p| p.map(|p| {
267266
box p as Box<RtioPipe:Send>

0 commit comments

Comments
 (0)