Skip to content

Commit aba4cf2

Browse files
committed
---
yaml --- r: 276935 b: refs/heads/try c: 068142a h: refs/heads/master i: 276933: baed8ca 276931: 646e153 276927: 447ae1e
1 parent b5f0149 commit aba4cf2

File tree

8 files changed

+241
-4
lines changed

8 files changed

+241
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 6dbb0e86aec11050480beb76eade6fb805010ba7
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
4-
refs/heads/try: 3fb40c1d95dd3a14ad14d71e3ec847a0a102bd49
4+
refs/heads/try: 068142a2e6d8a72e52091ccebd3368ffaf267643
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/mk/tests.mk

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ check-stage$(1)-T-$(2)-H-$(3)-exec: \
305305
check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec \
306306
check-stage$(1)-T-$(2)-H-$(3)-debuginfo-gdb-exec \
307307
check-stage$(1)-T-$(2)-H-$(3)-debuginfo-lldb-exec \
308+
check-stage$(1)-T-$(2)-H-$(3)-incremental-exec \
308309
check-stage$(1)-T-$(2)-H-$(3)-doc-exec \
309310
check-stage$(1)-T-$(2)-H-$(3)-pretty-exec
310311

@@ -481,6 +482,7 @@ DEBUGINFO_LLDB_RS := $(call rwildcard,$(S)src/test/debuginfo/,*.rs)
481482
CODEGEN_RS := $(call rwildcard,$(S)src/test/codegen/,*.rs)
482483
CODEGEN_CC := $(call rwildcard,$(S)src/test/codegen/,*.cc)
483484
CODEGEN_UNITS_RS := $(call rwildcard,$(S)src/test/codegen-units/,*.rs)
485+
INCREMENTAL_RS := $(call rwildcard,$(S)src/test/incremental/,*.rs)
484486
RUSTDOCCK_RS := $(call rwildcard,$(S)src/test/rustdoc/,*.rs)
485487

486488
RPASS_TESTS := $(RPASS_RS)
@@ -496,6 +498,7 @@ DEBUGINFO_GDB_TESTS := $(DEBUGINFO_GDB_RS)
496498
DEBUGINFO_LLDB_TESTS := $(DEBUGINFO_LLDB_RS)
497499
CODEGEN_TESTS := $(CODEGEN_RS) $(CODEGEN_CC)
498500
CODEGEN_UNITS_TESTS := $(CODEGEN_UNITS_RS)
501+
INCREMENTAL_TESTS := $(INCREMENTAL_RS)
499502
RUSTDOCCK_TESTS := $(RUSTDOCCK_RS)
500503

501504
CTEST_SRC_BASE_rpass = run-pass
@@ -558,6 +561,11 @@ CTEST_BUILD_BASE_codegen-units = codegen-units
558561
CTEST_MODE_codegen-units = codegen-units
559562
CTEST_RUNTOOL_codegen-units = $(CTEST_RUNTOOL)
560563

564+
CTEST_SRC_BASE_incremental = incremental
565+
CTEST_BUILD_BASE_incremental = incremental
566+
CTEST_MODE_incremental = incremental
567+
CTEST_RUNTOOL_incremental = $(CTEST_RUNTOOL)
568+
561569
CTEST_SRC_BASE_rustdocck = rustdoc
562570
CTEST_BUILD_BASE_rustdocck = rustdoc
563571
CTEST_MODE_rustdocck = rustdoc
@@ -681,6 +689,7 @@ CTEST_DEPS_debuginfo-lldb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_LLDB_TESTS) \
681689
$(S)src/etc/lldb_rust_formatters.py
682690
CTEST_DEPS_codegen_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_TESTS)
683691
CTEST_DEPS_codegen-units_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_UNITS_TESTS)
692+
CTEST_DEPS_incremental_$(1)-T-$(2)-H-$(3) = $$(INCREMENTAL_TESTS)
684693
CTEST_DEPS_rustdocck_$(1)-T-$(2)-H-$(3) = $$(RUSTDOCCK_TESTS) \
685694
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
686695
$(S)src/etc/htmldocck.py
@@ -747,7 +756,7 @@ endif
747756
endef
748757

749758
CTEST_NAMES = rpass rpass-valgrind rpass-full rfail-full cfail-full rfail cfail pfail \
750-
debuginfo-gdb debuginfo-lldb codegen codegen-units rustdocck
759+
debuginfo-gdb debuginfo-lldb codegen codegen-units rustdocck incremental
751760

752761
$(foreach host,$(CFG_HOST), \
753762
$(eval $(foreach target,$(CFG_TARGET), \
@@ -945,6 +954,7 @@ TEST_GROUPS = \
945954
debuginfo-lldb \
946955
codegen \
947956
codegen-units \
957+
incremental \
948958
doc \
949959
$(foreach docname,$(DOC_NAMES),doc-$(docname)) \
950960
pretty \

branches/try/src/compiletest/common.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ pub enum Mode {
2525
DebugInfoLldb,
2626
Codegen,
2727
Rustdoc,
28-
CodegenUnits
28+
CodegenUnits,
29+
Incremental,
2930
}
3031

3132
impl FromStr for Mode {
@@ -43,6 +44,7 @@ impl FromStr for Mode {
4344
"codegen" => Ok(Codegen),
4445
"rustdoc" => Ok(Rustdoc),
4546
"codegen-units" => Ok(CodegenUnits),
47+
"incremental" => Ok(Incremental),
4648
_ => Err(()),
4749
}
4850
}
@@ -62,6 +64,7 @@ impl fmt::Display for Mode {
6264
Codegen => "codegen",
6365
Rustdoc => "rustdoc",
6466
CodegenUnits => "codegen-units",
67+
Incremental => "incremental",
6568
}, f)
6669
}
6770
}

branches/try/src/compiletest/compiletest.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ pub fn parse_config(args: Vec<String> ) -> Config {
7171
reqopt("", "aux-base", "directory to find auxiliary test files", "PATH"),
7272
reqopt("", "stage-id", "the target-stage identifier", "stageN-TARGET"),
7373
reqopt("", "mode", "which sort of compile tests to run",
74-
"(compile-fail|parse-fail|run-fail|run-pass|run-pass-valgrind|pretty|debug-info)"),
74+
"(compile-fail|parse-fail|run-fail|run-pass|\
75+
run-pass-valgrind|pretty|debug-info|incremental)"),
7576
optflag("", "ignored", "run tests marked as ignored"),
7677
optopt("", "runtool", "supervisor program to run tests under \
7778
(eg. emulator, valgrind)", "PROGRAM"),

branches/try/src/compiletest/runtest.rs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use common::Config;
1212
use common::{CompileFail, ParseFail, Pretty, RunFail, RunPass, RunPassValgrind};
1313
use common::{Codegen, DebugInfoLldb, DebugInfoGdb, Rustdoc, CodegenUnits};
14+
use common::{Incremental};
1415
use errors::{self, ErrorKind};
1516
use header::TestProps;
1617
use header;
@@ -59,6 +60,7 @@ pub fn run(config: Config, testpaths: &TestPaths) {
5960
Codegen => run_codegen_test(&config, &props, &testpaths),
6061
Rustdoc => run_rustdoc_test(&config, &props, &testpaths),
6162
CodegenUnits => run_codegen_units_test(&config, &props, &testpaths),
63+
Incremental => run_incremental_test(&config, &props, &testpaths),
6264
}
6365
}
6466

@@ -1966,3 +1968,66 @@ fn run_codegen_units_test(config: &Config, props: &TestProps, testpaths: &TestPa
19661968
panic!();
19671969
}
19681970
}
1971+
1972+
fn run_incremental_test(config: &Config, props: &TestProps, testpaths: &TestPaths) {
1973+
// Basic plan for a test incremental/foo/bar.rs:
1974+
// - load list of revisions pass1, fail2, pass3
1975+
// - each should begin with `pass` or `fail`
1976+
// - if `pass`, expect compile to succeed
1977+
// - if `fail`, expect errors from file
1978+
// - create a directory build/foo/bar.incremental
1979+
// - compile foo/bar.rs with -Z incremental=.../foo/bar.incremental and -C pass1
1980+
// - because name of revision starts with "pass", expect success
1981+
// - compile foo/bar.rs with -Z incremental=.../foo/bar.incremental and -C fail2
1982+
// - because name of revision starts with "fail", expect an error
1983+
// - load expected errors as usual, but filter for those that end in `[fail2]`
1984+
// - compile foo/bar.rs with -Z incremental=.../foo/bar.incremental and -C pass3
1985+
// - because name of revision starts with "pass", expect success
1986+
// - execute build/foo/bar.exe and save output
1987+
//
1988+
// FIXME -- use non-incremental mode as an oracle? That doesn't apply
1989+
// to #[rustc_dirty] and clean tests I guess
1990+
1991+
assert!(!props.revisions.is_empty(), "incremental tests require a list of revisions");
1992+
1993+
let output_base_name = output_base_name(config, testpaths);
1994+
1995+
// Create the incremental workproduct directory.
1996+
let incremental_dir = output_base_name.with_extension("incremental");
1997+
if incremental_dir.exists() {
1998+
fs::remove_dir_all(&incremental_dir).unwrap();
1999+
}
2000+
fs::create_dir_all(&incremental_dir).unwrap();
2001+
2002+
if config.verbose {
2003+
print!("incremental_dir={}", incremental_dir.display());
2004+
}
2005+
2006+
for revision in &props.revisions {
2007+
let mut revision_props = props.clone();
2008+
header::load_props_into(&mut revision_props, &testpaths.file, Some(&revision));
2009+
2010+
revision_props.compile_flags.extend(vec![
2011+
format!("-Z"),
2012+
format!("incremental={}", incremental_dir.display()),
2013+
format!("--cfg"),
2014+
format!("{}", revision),
2015+
]);
2016+
2017+
if config.verbose {
2018+
print!("revision={:?} revision_props={:#?}", revision, revision_props);
2019+
}
2020+
2021+
if revision.starts_with("rpass") {
2022+
run_rpass_test_revision(config, &revision_props, testpaths, Some(&revision));
2023+
} else if revision.starts_with("rfail") {
2024+
run_rfail_test_revision(config, &revision_props, testpaths, Some(&revision));
2025+
} else if revision.starts_with("cfail") {
2026+
run_cfail_test_revision(config, &revision_props, testpaths, Some(&revision));
2027+
} else {
2028+
fatal(
2029+
Some(revision),
2030+
"revision name must begin with rpass, rfail, or cfail");
2031+
}
2032+
}
2033+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// revisions: rpass1 cfail2
12+
13+
#![allow(warnings)]
14+
#![feature(rustc_attrs)]
15+
16+
// Sanity check for the dirty-clean system. Give the opposite
17+
// annotations that we expect to see, so that we check that errors are
18+
// reported.
19+
20+
fn main() { }
21+
22+
mod x {
23+
#[cfg(rpass1)]
24+
pub fn x() -> usize {
25+
22
26+
}
27+
28+
#[cfg(cfail2)]
29+
pub fn x() -> u32 {
30+
22
31+
}
32+
}
33+
34+
mod y {
35+
use x;
36+
37+
#[rustc_clean(label="TypeckItemBody", cfg="cfail2")]
38+
#[rustc_clean(label="TransCrateItem", cfg="cfail2")]
39+
pub fn y() {
40+
//[cfail2]~^ ERROR `TypeckItemBody("y::y")` not found in dep graph, but should be clean
41+
//[cfail2]~| ERROR `TransCrateItem("y::y")` not found in dep graph, but should be clean
42+
x::x();
43+
}
44+
}
45+
46+
mod z {
47+
#[rustc_dirty(label="TypeckItemBody", cfg="cfail2")]
48+
#[rustc_dirty(label="TransCrateItem", cfg="cfail2")]
49+
pub fn z() {
50+
//[cfail2]~^ ERROR `TypeckItemBody("z::z")` found in dep graph, but should be dirty
51+
// FIXME(#32014) -- TransCrateItem ought to be clean, but it is in fact
52+
// dirty, hence we don't see an error here.
53+
}
54+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// revisions: rpass1 rpass2
12+
13+
#![allow(warnings)]
14+
#![feature(rustc_attrs)]
15+
16+
fn main() { }
17+
18+
mod x {
19+
#[cfg(rpass1)]
20+
pub fn x() -> i32 {
21+
1
22+
}
23+
24+
#[cfg(rpass2)]
25+
pub fn x() -> i32 {
26+
2
27+
}
28+
}
29+
30+
mod y {
31+
use x;
32+
33+
#[rustc_dirty(label="TypeckItemBody", cfg="rpass2")]
34+
pub fn y() {
35+
x::x();
36+
}
37+
}
38+
39+
mod z {
40+
use y;
41+
42+
#[rustc_clean(label="TypeckItemBody", cfg="rpass2")]
43+
pub fn z() {
44+
y::y();
45+
}
46+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// revisions: rpass1 rpass2
12+
13+
#![allow(warnings)]
14+
#![feature(rustc_attrs)]
15+
16+
// Here the only thing which changes is the string constant in `x`.
17+
// Therefore, the compiler deduces (correctly) that typeck is not
18+
// needed even for callers of `x`.
19+
//
20+
// It is not entirely clear why `TransCrateItem` invalidates `y` and
21+
// `z`, actually, I think it's because of the structure of
22+
// trans. -nmatsakis
23+
24+
fn main() { }
25+
26+
mod x {
27+
#[cfg(rpass1)]
28+
pub fn x() {
29+
println!("1");
30+
}
31+
32+
#[cfg(rpass2)]
33+
#[rustc_dirty(label="TypeckItemBody", cfg="rpass2")]
34+
#[rustc_dirty(label="TransCrateItem", cfg="rpass2")]
35+
pub fn x() {
36+
println!("2");
37+
}
38+
}
39+
40+
mod y {
41+
use x;
42+
43+
#[rustc_clean(label="TypeckItemBody", cfg="rpass2")]
44+
#[rustc_dirty(label="TransCrateItem", cfg="rpass2")]
45+
pub fn y() {
46+
x::x();
47+
}
48+
}
49+
50+
mod z {
51+
use y;
52+
53+
#[rustc_clean(label="TypeckItemBody", cfg="rpass2")]
54+
#[rustc_dirty(label="TransCrateItem", cfg="rpass2")]
55+
pub fn z() {
56+
y::y();
57+
}
58+
}

0 commit comments

Comments
 (0)