Skip to content

Commit e9d97ae

Browse files
committed
---
yaml --- r: 151641 b: refs/heads/try2 c: af00c57 h: refs/heads/master i: 151639: 0905851 v: v3
1 parent 1c8142f commit e9d97ae

File tree

130 files changed

+1392
-2986
lines changed

Some content is hidden

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

130 files changed

+1392
-2986
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: e4414739a5897ff2a4b35de5f7e1436b6e3f3f10
8+
refs/heads/try2: af00c57379bcc323d76656cae970b5a1b503bcdb
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/docs.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ DOCS := index intro tutorial guide-ffi guide-macros guide-lifetimes \
3030
guide-tasks guide-container guide-pointers guide-testing \
3131
guide-runtime complement-bugreport complement-cheatsheet \
3232
complement-lang-faq complement-project-faq rust rustdoc \
33-
guide-unsafe not_found
33+
guide-unsafe
3434

3535
PDF_DOCS := tutorial rust
3636

branches/try2/src/compiletest/common.rs

Lines changed: 10 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,19 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::from_str::FromStr;
12-
use std::fmt;
13-
1411
#[deriving(Clone, Eq)]
15-
pub enum Mode {
16-
CompileFail,
17-
RunFail,
18-
RunPass,
19-
Pretty,
20-
DebugInfoGdb,
21-
DebugInfoLldb,
22-
Codegen
23-
}
24-
25-
impl FromStr for Mode {
26-
fn from_str(s: &str) -> Option<Mode> {
27-
match s {
28-
"compile-fail" => Some(CompileFail),
29-
"run-fail" => Some(RunFail),
30-
"run-pass" => Some(RunPass),
31-
"pretty" => Some(Pretty),
32-
"debuginfo-lldb" => Some(DebugInfoLldb),
33-
"debuginfo-gdb" => Some(DebugInfoGdb),
34-
"codegen" => Some(Codegen),
35-
_ => None,
36-
}
37-
}
38-
}
39-
40-
impl fmt::Show for Mode {
41-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
42-
let msg = match *self {
43-
CompileFail => "compile-fail",
44-
RunFail => "run-fail",
45-
RunPass => "run-pass",
46-
Pretty => "pretty",
47-
DebugInfoGdb => "debuginfo-gdb",
48-
DebugInfoLldb => "debuginfo-lldb",
49-
Codegen => "codegen",
50-
};
51-
write!(f.buf, "{}", msg)
52-
}
12+
pub enum mode {
13+
mode_compile_fail,
14+
mode_run_fail,
15+
mode_run_pass,
16+
mode_pretty,
17+
mode_debug_info_gdb,
18+
mode_debug_info_lldb,
19+
mode_codegen
5320
}
5421

5522
#[deriving(Clone)]
56-
pub struct Config {
23+
pub struct config {
5724
// The library paths required for running the compiler
5825
pub compile_lib_path: ~str,
5926

@@ -82,7 +49,7 @@ pub struct Config {
8249
pub stage_id: ~str,
8350

8451
// The test mode, compile-fail, run-fail, run-pass
85-
pub mode: Mode,
52+
pub mode: mode,
8653

8754
// Run ignored tests
8855
pub run_ignored: bool,

branches/try2/src/compiletest/compiletest.rs

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// we use our own (green) start below; do not link in libnative; issue #13247.
1515
#![no_start]
1616

17+
#![allow(non_camel_case_types)]
1718
#![deny(warnings)]
1819

1920
extern crate test;
@@ -26,10 +27,9 @@ extern crate rustuv;
2627
use std::os;
2728
use std::io;
2829
use std::io::fs;
29-
use std::from_str::FromStr;
3030
use getopts::{optopt, optflag, reqopt};
31-
use common::Config;
32-
use common::{Pretty, DebugInfoGdb, Codegen};
31+
use common::{config, mode_run_pass, mode_run_fail, mode_compile_fail, mode_pretty,
32+
mode_debug_info_gdb, mode_debug_info_lldb, mode_codegen, mode};
3333
use util::logv;
3434

3535
pub mod procsrv;
@@ -51,7 +51,7 @@ pub fn main() {
5151
run_tests(&config);
5252
}
5353

54-
pub fn parse_config(args: Vec<~str> ) -> Config {
54+
pub fn parse_config(args: Vec<~str> ) -> config {
5555

5656
let groups : Vec<getopts::OptGroup> =
5757
vec!(reqopt("", "compile-lib-path", "path to host shared libraries", "PATH"),
@@ -112,7 +112,7 @@ pub fn parse_config(args: Vec<~str> ) -> Config {
112112
Path::new(m.opt_str(nm).unwrap())
113113
}
114114

115-
Config {
115+
config {
116116
compile_lib_path: matches.opt_str("compile-lib-path").unwrap(),
117117
run_lib_path: matches.opt_str("run-lib-path").unwrap(),
118118
rustc_path: opt_path(matches, "rustc-path"),
@@ -122,7 +122,7 @@ pub fn parse_config(args: Vec<~str> ) -> Config {
122122
build_base: opt_path(matches, "build-base"),
123123
aux_base: opt_path(matches, "aux-base"),
124124
stage_id: matches.opt_str("stage-id").unwrap(),
125-
mode: FromStr::from_str(matches.opt_str("mode").unwrap()).expect("invalid mode"),
125+
mode: str_mode(matches.opt_str("mode").unwrap()),
126126
run_ignored: matches.opt_present("ignored"),
127127
filter:
128128
if !matches.free.is_empty() {
@@ -155,7 +155,7 @@ pub fn parse_config(args: Vec<~str> ) -> Config {
155155
}
156156
}
157157

158-
pub fn log_config(config: &Config) {
158+
pub fn log_config(config: &config) {
159159
let c = config;
160160
logv(c, format!("configuration:"));
161161
logv(c, format!("compile_lib_path: {}", config.compile_lib_path));
@@ -164,7 +164,7 @@ pub fn log_config(config: &Config) {
164164
logv(c, format!("src_base: {}", config.src_base.display()));
165165
logv(c, format!("build_base: {}", config.build_base.display()));
166166
logv(c, format!("stage_id: {}", config.stage_id));
167-
logv(c, format!("mode: {}", config.mode));
167+
logv(c, format!("mode: {}", mode_str(config.mode)));
168168
logv(c, format!("run_ignored: {}", config.run_ignored));
169169
logv(c, format!("filter: {}", opt_str(&config.filter)));
170170
logv(c, format!("runtool: {}", opt_str(&config.runtool)));
@@ -198,10 +198,35 @@ pub fn opt_str2(maybestr: Option<~str>) -> ~str {
198198
match maybestr { None => "(none)".to_owned(), Some(s) => { s } }
199199
}
200200

201-
pub fn run_tests(config: &Config) {
201+
pub fn str_mode(s: ~str) -> mode {
202+
match s.as_slice() {
203+
"compile-fail" => mode_compile_fail,
204+
"run-fail" => mode_run_fail,
205+
"run-pass" => mode_run_pass,
206+
"pretty" => mode_pretty,
207+
"debuginfo-gdb" => mode_debug_info_gdb,
208+
"debuginfo-lldb" => mode_debug_info_lldb,
209+
"codegen" => mode_codegen,
210+
s => fail!("invalid mode: " + s)
211+
}
212+
}
213+
214+
pub fn mode_str(mode: mode) -> ~str {
215+
match mode {
216+
mode_compile_fail => "compile-fail".to_owned(),
217+
mode_run_fail => "run-fail".to_owned(),
218+
mode_run_pass => "run-pass".to_owned(),
219+
mode_pretty => "pretty".to_owned(),
220+
mode_debug_info_gdb => "debuginfo-gdb".to_owned(),
221+
mode_debug_info_lldb => "debuginfo-lldb".to_owned(),
222+
mode_codegen => "codegen".to_owned(),
223+
}
224+
}
225+
226+
pub fn run_tests(config: &config) {
202227
if config.target == "arm-linux-androideabi".to_owned() {
203-
match config.mode {
204-
DebugInfoGdb => {
228+
match config.mode{
229+
mode_debug_info_gdb => {
205230
println!("arm-linux-androideabi debug-info \
206231
test uses tcp 5039 port. please reserve it");
207232
}
@@ -230,7 +255,7 @@ pub fn run_tests(config: &Config) {
230255
}
231256
}
232257

233-
pub fn test_opts(config: &Config) -> test::TestOpts {
258+
pub fn test_opts(config: &config) -> test::TestOpts {
234259
test::TestOpts {
235260
filter: config.filter.clone(),
236261
run_ignored: config.run_ignored,
@@ -245,7 +270,7 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
245270
}
246271
}
247272

248-
pub fn make_tests(config: &Config) -> Vec<test::TestDescAndFn> {
273+
pub fn make_tests(config: &config) -> Vec<test::TestDescAndFn> {
249274
debug!("making tests from {}",
250275
config.src_base.display());
251276
let mut tests = Vec::new();
@@ -256,7 +281,7 @@ pub fn make_tests(config: &Config) -> Vec<test::TestDescAndFn> {
256281
if is_test(config, &file) {
257282
let t = make_test(config, &file, || {
258283
match config.mode {
259-
Codegen => make_metrics_test_closure(config, &file),
284+
mode_codegen => make_metrics_test_closure(config, &file),
260285
_ => make_test_closure(config, &file)
261286
}
262287
});
@@ -266,11 +291,11 @@ pub fn make_tests(config: &Config) -> Vec<test::TestDescAndFn> {
266291
tests
267292
}
268293

269-
pub fn is_test(config: &Config, testfile: &Path) -> bool {
294+
pub fn is_test(config: &config, testfile: &Path) -> bool {
270295
// Pretty-printer does not work with .rc files yet
271296
let valid_extensions =
272297
match config.mode {
273-
Pretty => vec!(".rs".to_owned()),
298+
mode_pretty => vec!(".rs".to_owned()),
274299
_ => vec!(".rc".to_owned(), ".rs".to_owned())
275300
};
276301
let invalid_prefixes = vec!(".".to_owned(), "#".to_owned(), "~".to_owned());
@@ -289,7 +314,7 @@ pub fn is_test(config: &Config, testfile: &Path) -> bool {
289314
return valid;
290315
}
291316

292-
pub fn make_test(config: &Config, testfile: &Path, f: || -> test::TestFn)
317+
pub fn make_test(config: &config, testfile: &Path, f: || -> test::TestFn)
293318
-> test::TestDescAndFn {
294319
test::TestDescAndFn {
295320
desc: test::TestDesc {
@@ -301,7 +326,7 @@ pub fn make_test(config: &Config, testfile: &Path, f: || -> test::TestFn)
301326
}
302327
}
303328

304-
pub fn make_test_name(config: &Config, testfile: &Path) -> test::TestName {
329+
pub fn make_test_name(config: &config, testfile: &Path) -> test::TestName {
305330

306331
// Try to elide redundant long paths
307332
fn shorten(path: &Path) -> ~str {
@@ -311,17 +336,19 @@ pub fn make_test_name(config: &Config, testfile: &Path) -> test::TestName {
311336
format!("{}/{}", dir.unwrap_or(""), filename.unwrap_or(""))
312337
}
313338

314-
test::DynTestName(format!("[{}] {}", config.mode, shorten(testfile)))
339+
test::DynTestName(format!("[{}] {}",
340+
mode_str(config.mode),
341+
shorten(testfile)))
315342
}
316343

317-
pub fn make_test_closure(config: &Config, testfile: &Path) -> test::TestFn {
344+
pub fn make_test_closure(config: &config, testfile: &Path) -> test::TestFn {
318345
let config = (*config).clone();
319346
// FIXME (#9639): This needs to handle non-utf8 paths
320347
let testfile = testfile.as_str().unwrap().to_owned();
321348
test::DynTestFn(proc() { runtest::run(config, testfile) })
322349
}
323350

324-
pub fn make_metrics_test_closure(config: &Config, testfile: &Path) -> test::TestFn {
351+
pub fn make_metrics_test_closure(config: &config, testfile: &Path) -> test::TestFn {
325352
let config = (*config).clone();
326353
// FIXME (#9639): This needs to handle non-utf8 paths
327354
let testfile = testfile.as_str().unwrap().to_owned();

branches/try2/src/compiletest/header.rs

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use common::Config;
11+
use common::config;
1212
use common;
1313
use util;
1414

@@ -34,8 +34,6 @@ pub struct TestProps {
3434
pub check_stdout: bool,
3535
// Don't force a --crate-type=dylib flag on the command line
3636
pub no_prefer_dynamic: bool,
37-
// Don't run --pretty expanded when running pretty printing tests
38-
pub no_pretty_expanded: bool,
3937
}
4038

4139
// Load any test directives embedded in the file
@@ -50,7 +48,6 @@ pub fn load_props(testfile: &Path) -> TestProps {
5048
let mut force_host = false;
5149
let mut check_stdout = false;
5250
let mut no_prefer_dynamic = false;
53-
let mut no_pretty_expanded = false;
5451
iter_header(testfile, |ln| {
5552
match parse_error_pattern(ln) {
5653
Some(ep) => error_patterns.push(ep),
@@ -81,10 +78,6 @@ pub fn load_props(testfile: &Path) -> TestProps {
8178
no_prefer_dynamic = parse_no_prefer_dynamic(ln);
8279
}
8380

84-
if !no_pretty_expanded {
85-
no_pretty_expanded = parse_no_pretty_expanded(ln);
86-
}
87-
8881
match parse_aux_build(ln) {
8982
Some(ab) => { aux_builds.push(ab); }
9083
None => {}
@@ -114,23 +107,22 @@ pub fn load_props(testfile: &Path) -> TestProps {
114107
force_host: force_host,
115108
check_stdout: check_stdout,
116109
no_prefer_dynamic: no_prefer_dynamic,
117-
no_pretty_expanded: no_pretty_expanded,
118110
}
119111
}
120112

121-
pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
122-
fn ignore_target(config: &Config) -> ~str {
113+
pub fn is_test_ignored(config: &config, testfile: &Path) -> bool {
114+
fn ignore_target(config: &config) -> ~str {
123115
"ignore-".to_owned() + util::get_os(config.target)
124116
}
125-
fn ignore_stage(config: &Config) -> ~str {
117+
fn ignore_stage(config: &config) -> ~str {
126118
"ignore-".to_owned() + config.stage_id.split('-').next().unwrap()
127119
}
128120

129121
let val = iter_header(testfile, |ln| {
130122
if parse_name_directive(ln, "ignore-test") { false }
131123
else if parse_name_directive(ln, ignore_target(config)) { false }
132124
else if parse_name_directive(ln, ignore_stage(config)) { false }
133-
else if config.mode == common::Pretty &&
125+
else if config.mode == common::mode_pretty &&
134126
parse_name_directive(ln, "ignore-pretty") { false }
135127
else if config.target != config.host &&
136128
parse_name_directive(ln, "ignore-cross-compile") { false }
@@ -188,10 +180,6 @@ fn parse_no_prefer_dynamic(line: &str) -> bool {
188180
parse_name_directive(line, "no-prefer-dynamic")
189181
}
190182

191-
fn parse_no_pretty_expanded(line: &str) -> bool {
192-
parse_name_directive(line, "no-pretty-expanded")
193-
}
194-
195183
fn parse_exec_env(line: &str) -> Option<(~str, ~str)> {
196184
parse_name_value_directive(line, "exec-env".to_owned()).map(|nv| {
197185
// nv is either FOO or FOO=BAR

branches/try2/src/compiletest/procsrv.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,19 @@ 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 {
71+
let mut opt_process = Process::configure(ProcessConfig {
7272
program: prog,
7373
args: args,
7474
env: Some(env.as_slice()),
7575
.. ProcessConfig::new()
7676
});
7777

7878
match opt_process {
79-
Ok(mut process) => {
79+
Ok(ref mut process) => {
8080
for input in input.iter() {
8181
process.stdin.get_mut_ref().write(input.as_bytes()).unwrap();
8282
}
83-
let ProcessOutput { status, output, error } =
84-
process.wait_with_output().unwrap();
83+
let ProcessOutput { status, output, error } = process.wait_with_output();
8584

8685
Some(Result {
8786
status: status,

0 commit comments

Comments
 (0)