Skip to content

Commit 4803061

Browse files
committed
---
yaml --- r: 149403 b: refs/heads/try2 c: 06e1281 h: refs/heads/master i: 149401: cb0d13f 149399: 41f1931 v: v3
1 parent c190ed7 commit 4803061

Some content is hidden

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

93 files changed

+960
-468
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: efaa1ea979c60dcb6884be12dcb12ceb09dbc5bd
8+
refs/heads/try2: 06e1281198da31219b89a7cdb32f3c05b76afc07
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/crates.mk

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
################################################################################
5151

5252
TARGET_CRATES := std extra green rustuv native flate arena glob term semver \
53-
uuid serialize sync getopts collections num
53+
uuid serialize sync getopts collections num test
5454
HOST_CRATES := syntax rustc rustdoc fourcc
5555
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5656
TOOLS := compiletest rustdoc rustc
@@ -63,7 +63,8 @@ DEPS_native := std
6363
DEPS_syntax := std term serialize collections
6464
DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts \
6565
collections extra
66-
DEPS_rustdoc := rustc native:sundown serialize sync getopts collections
66+
DEPS_rustdoc := rustc native:sundown serialize sync getopts collections \
67+
test
6768
DEPS_flate := std native:miniz
6869
DEPS_arena := std collections
6970
DEPS_glob := std
@@ -76,8 +77,9 @@ DEPS_getopts := std
7677
DEPS_collections := std serialize
7778
DEPS_fourcc := syntax std
7879
DEPS_num := std extra
80+
DEPS_test := std extra collections getopts serialize term
7981

80-
TOOL_DEPS_compiletest := extra green rustuv getopts
82+
TOOL_DEPS_compiletest := test green rustuv getopts
8183
TOOL_DEPS_rustdoc := rustdoc green rustuv
8284
TOOL_DEPS_rustc := rustc green rustuv
8385
TOOL_SOURCE_compiletest := $(S)src/compiletest/compiletest.rs

branches/try2/mk/tests.mk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,10 +537,6 @@ TEST_SREQ$(1)_T_$(2)_H_$(3) = \
537537
# remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898).
538538
CTEST_RUSTC_FLAGS := $$(subst --cfg ndebug,,$$(CFG_RUSTC_FLAGS))
539539

540-
# There's no need our entire test suite to take up gigabytes of space on disk
541-
# including copies of libstd/libextra all over the place
542-
CTEST_RUSTC_FLAGS := $$(CTEST_RUSTC_FLAGS) -C prefer-dynamic
543-
544540
# The tests can not be optimized while the rest of the compiler is optimized, so
545541
# filter out the optimization (if any) from rustc and then figure out if we need
546542
# to be optimized

branches/try2/src/compiletest/compiletest.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,13 @@
1313
#[allow(non_camel_case_types)];
1414
#[deny(warnings)];
1515

16-
extern crate extra;
16+
extern crate test;
1717
extern crate getopts;
1818

1919
use std::os;
2020
use std::io;
2121
use std::io::fs;
22-
2322
use getopts::{optopt, optflag, reqopt};
24-
use extra::test;
25-
2623
use common::config;
2724
use common::mode_run_pass;
2825
use common::mode_run_fail;

branches/try2/src/compiletest/header.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ pub struct TestProps {
3232
force_host: bool,
3333
// Check stdout for error-pattern output as well as stderr
3434
check_stdout: bool,
35+
// Don't force a --crate-type=dylib flag on the command line
36+
no_prefer_dynamic: bool,
3537
}
3638

3739
// Load any test directives embedded in the file
@@ -45,6 +47,7 @@ pub fn load_props(testfile: &Path) -> TestProps {
4547
let mut check_lines = ~[];
4648
let mut force_host = false;
4749
let mut check_stdout = false;
50+
let mut no_prefer_dynamic = false;
4851
iter_header(testfile, |ln| {
4952
match parse_error_pattern(ln) {
5053
Some(ep) => error_patterns.push(ep),
@@ -67,6 +70,10 @@ pub fn load_props(testfile: &Path) -> TestProps {
6770
check_stdout = parse_check_stdout(ln);
6871
}
6972

73+
if !no_prefer_dynamic {
74+
no_prefer_dynamic = parse_no_prefer_dynamic(ln);
75+
}
76+
7077
match parse_aux_build(ln) {
7178
Some(ab) => { aux_builds.push(ab); }
7279
None => {}
@@ -99,6 +106,7 @@ pub fn load_props(testfile: &Path) -> TestProps {
99106
check_lines: check_lines,
100107
force_host: force_host,
101108
check_stdout: check_stdout,
109+
no_prefer_dynamic: no_prefer_dynamic,
102110
};
103111
}
104112

@@ -167,6 +175,10 @@ fn parse_check_stdout(line: &str) -> bool {
167175
parse_name_directive(line, "check-stdout")
168176
}
169177

178+
fn parse_no_prefer_dynamic(line: &str) -> bool {
179+
parse_name_directive(line, "no-prefer-dynamic")
180+
}
181+
170182
fn parse_exec_env(line: &str) -> Option<(~str, ~str)> {
171183
parse_name_value_directive(line, ~"exec-env").map(|nv| {
172184
// nv is either FOO or FOO=BAR

branches/try2/src/compiletest/runtest.rs

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use std::str;
3434
use std::task;
3535
use std::vec;
3636

37-
use extra::test::MetricMap;
37+
use test::MetricMap;
3838

3939
pub fn run(config: config, testfile: ~str) {
4040

@@ -258,15 +258,12 @@ actual:\n\
258258
}
259259

260260
fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
261-
262-
// do not optimize debuginfo tests
263-
let mut config = match config.target_rustcflags {
264-
Some(ref flags) => config {
265-
target_rustcflags: Some(flags.replace("-O", "")),
266-
.. (*config).clone()
267-
},
268-
None => (*config).clone()
261+
let mut config = config {
262+
target_rustcflags: cleanup_debug_info_options(&config.target_rustcflags),
263+
host_rustcflags: cleanup_debug_info_options(&config.host_rustcflags),
264+
.. config.clone()
269265
};
266+
270267
let config = &mut config;
271268
let check_lines = &props.check_lines;
272269
let mut cmds = props.debugger_cmds.connect("\n");
@@ -436,6 +433,20 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
436433
check_lines[i]), &ProcRes);
437434
}
438435
}
436+
437+
fn cleanup_debug_info_options(options: &Option<~str>) -> Option<~str> {
438+
if options.is_none() {
439+
return None;
440+
}
441+
442+
// Remove options that are either unwanted (-O) or may lead to duplicates due to RUSTFLAGS.
443+
let options_to_remove = [~"-O", ~"-g", ~"--debuginfo"];
444+
let new_options = split_maybe_args(options).move_iter()
445+
.filter(|x| !options_to_remove.contains(x))
446+
.to_owned_vec()
447+
.connect(" ");
448+
Some(new_options)
449+
}
439450
}
440451

441452
fn check_error_patterns(props: &TestProps,
@@ -704,9 +715,13 @@ fn compose_and_run_compiler(
704715
for rel_ab in props.aux_builds.iter() {
705716
let abs_ab = config.aux_base.join(rel_ab.as_slice());
706717
let aux_props = load_props(&abs_ab);
718+
let crate_type = if aux_props.no_prefer_dynamic {
719+
~[]
720+
} else {
721+
~[~"--crate-type=dylib"]
722+
};
707723
let aux_args =
708-
make_compile_args(config, &aux_props, ~[~"--crate-type=dylib"]
709-
+ extra_link_args,
724+
make_compile_args(config, &aux_props, crate_type + extra_link_args,
710725
|a,b| {
711726
let f = make_lib_name(a, b, testfile);
712727
ThisDirectory(f.dir_path())
@@ -770,6 +785,10 @@ fn make_compile_args(config: &config,
770785
~"-L", config.build_base.as_str().unwrap().to_owned(),
771786
~"--target=" + target]
772787
+ extras;
788+
if !props.no_prefer_dynamic {
789+
args.push(~"-C");
790+
args.push(~"prefer-dynamic");
791+
}
773792
let path = match xform_file {
774793
ThisFile(path) => { args.push(~"-o"); path }
775794
ThisDirectory(path) => { args.push(~"--out-dir"); path }

branches/try2/src/doc/guide-testing.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ runner.
170170

171171
The type signature of a benchmark function differs from a unit test:
172172
it takes a mutable reference to type
173-
`extra::test::BenchHarness`. Inside the benchmark function, any
173+
`test::BenchHarness`. Inside the benchmark function, any
174174
time-variable or "setup" code should execute first, followed by a call
175175
to `iter` on the benchmark harness, passing a closure that contains
176176
the portion of the benchmark you wish to actually measure the
@@ -185,9 +185,10 @@ amount.
185185
For example:
186186

187187
~~~
188-
extern crate extra;
188+
extern crate test;
189+
189190
use std::vec;
190-
use extra::test::BenchHarness;
191+
use test::BenchHarness;
191192
192193
#[bench]
193194
fn bench_sum_1024_ints(b: &mut BenchHarness) {
@@ -243,8 +244,8 @@ recognize that some calculation has no external effects and remove
243244
it entirely.
244245

245246
~~~
246-
extern crate extra;
247-
use extra::test::BenchHarness;
247+
extern crate test;
248+
use test::BenchHarness;
248249
249250
#[bench]
250251
fn bench_xor_1000_ints(bh: &mut BenchHarness) {
@@ -273,15 +274,15 @@ example above by adjusting the `bh.iter` call to
273274
bh.iter(|| range(0, 1000).fold(0, |old, new| old ^ new))
274275
~~~
275276

276-
Or, the other option is to call the generic `extra::test::black_box`
277+
Or, the other option is to call the generic `test::black_box`
277278
function, which is an opaque "black box" to the optimizer and so
278279
forces it to consider any argument as used.
279280

280281
~~~
281-
use extra::test::black_box
282+
extern crate test;
282283
283284
bh.iter(|| {
284-
black_box(range(0, 1000).fold(0, |old, new| old ^ new));
285+
test::black_box(range(0, 1000).fold(0, |old, new| old ^ new));
285286
});
286287
~~~
287288

branches/try2/src/doc/rustdoc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ testing this code, the `fib` function will be included (so it can compile).
154154

155155
Running tests often requires some special configuration to filter tests, find
156156
libraries, or try running ignored examples. The testing framework that rustdoc
157-
uses is build on `extra::test`, which is also used when you compile crates with
157+
uses is build on crate `test`, which is also used when you compile crates with
158158
rustc's `--test` flag. Extra arguments can be passed to rustdoc's test harness
159159
with the `--test-args` flag.
160160

branches/try2/src/libarena/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -503,10 +503,10 @@ impl<T> Drop for TypedArena<T> {
503503
}
504504

505505
#[cfg(test)]
506-
mod test {
507-
extern crate extra;
506+
mod tests {
507+
extern crate test;
508+
use self::test::BenchHarness;
508509
use super::{Arena, TypedArena};
509-
use self::extra::test::BenchHarness;
510510

511511
struct Point {
512512
x: int,

branches/try2/src/libcollections/bitv.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,8 @@ impl<'a> Iterator<uint> for BitPositions<'a> {
938938

939939
#[cfg(test)]
940940
mod tests {
941-
use extra::test::BenchHarness;
941+
extern crate test;
942+
use self::test::BenchHarness;
942943

943944
use bitv::{Bitv, SmallBitv, BigBitv, BitvSet, from_bools, from_fn,
944945
from_bytes};

branches/try2/src/libcollections/deque.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ pub trait Deque<T> : Mutable {
4141

4242
#[cfg(test)]
4343
pub mod bench {
44+
extern crate test;
45+
use self::test::BenchHarness;
4446
use std::container::MutableMap;
4547
use std::{vec, rand};
4648
use std::rand::Rng;
47-
use extra::test::BenchHarness;
4849

4950
pub fn insert_rand_n<M:MutableMap<uint,uint>>(n: uint,
5051
map: &mut M,

branches/try2/src/libcollections/dlist.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,8 +657,9 @@ impl<D:Decoder,T:Decodable<D>> Decodable<D> for DList<T> {
657657

658658
#[cfg(test)]
659659
mod tests {
660+
extern crate test;
661+
use self::test::BenchHarness;
660662
use deque::Deque;
661-
use extra::test;
662663
use std::rand;
663664
use super::{DList, Node, ListInsertion};
664665

branches/try2/src/libcollections/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#[feature(macro_rules, managed_boxes)];
2121

2222
extern crate serialize;
23-
#[cfg(test)] extern crate extra; // benchmark tests need this
23+
#[cfg(test)] extern crate test;
2424

2525
pub use bitv::Bitv;
2626
pub use btree::BTree;

branches/try2/src/libcollections/ringbuf.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,9 @@ impl<D:Decoder,T:Decodable<D>> Decodable<D> for RingBuf<T> {
431431

432432
#[cfg(test)]
433433
mod tests {
434+
extern crate test;
435+
use self::test::BenchHarness;
434436
use deque::Deque;
435-
use extra::test;
436437
use std::clone::Clone;
437438
use std::cmp::Eq;
438439
use super::RingBuf;

branches/try2/src/libcollections/smallintmap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,9 @@ mod test_map {
470470

471471
#[cfg(test)]
472472
mod bench {
473-
473+
extern crate test;
474+
use self::test::BenchHarness;
474475
use super::SmallIntMap;
475-
use extra::test::BenchHarness;
476476
use deque::bench::{insert_rand_n, insert_seq_n, find_rand_n, find_seq_n};
477477

478478
// Find seq

branches/try2/src/libcollections/treemap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,9 +1494,9 @@ mod test_treemap {
14941494

14951495
#[cfg(test)]
14961496
mod bench {
1497-
1497+
extern crate test;
1498+
use self::test::BenchHarness;
14981499
use super::TreeMap;
1499-
use extra::test::BenchHarness;
15001500
use deque::bench::{insert_rand_n, insert_seq_n, find_rand_n, find_seq_n};
15011501

15021502
// Find seq

branches/try2/src/libextra/lib.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,10 @@ Rust extras are part of the standard Rust distribution.
3636

3737
extern crate sync;
3838
extern crate serialize;
39-
4039
extern crate collections;
4140

4241
// Utility modules
43-
4442
pub mod c_vec;
45-
46-
// And ... other stuff
47-
4843
pub mod url;
4944
pub mod json;
5045
pub mod tempfile;
@@ -56,15 +51,11 @@ pub mod stats;
5651
#[cfg(unicode)]
5752
mod unicode;
5853

59-
// Compiler support modules
60-
61-
pub mod test;
62-
6354
// A curious inner-module that's not exported that contains the binding
6455
// 'extra' so that macro-expanded references to extra::serialize and such
6556
// can be resolved within libextra.
6657
#[doc(hidden)]
6758
pub mod extra {
6859
pub use serialize;
69-
pub use test;
7060
}
61+

branches/try2/src/libextra/stats.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,8 @@ mod tests {
10251025

10261026
#[cfg(test)]
10271027
mod bench {
1028-
use extra::test::BenchHarness;
1028+
extern crate test;
1029+
use self::test::BenchHarness;
10291030
use std::vec;
10301031
use stats::Stats;
10311032

0 commit comments

Comments
 (0)