Skip to content

Fix test case header parsing code in presence of multiple revisions. #45914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,20 +259,20 @@ impl TestProps {
props
}

pub fn from_file(testfile: &Path, config: &Config) -> Self {
pub fn from_file(testfile: &Path, cfg: Option<&str>, config: &Config) -> Self {
let mut props = TestProps::new();
props.load_from(testfile, None, config);
props.load_from(testfile, cfg, config);
props
}

/// Load properties from `testfile` into `props`. If a property is
/// tied to a particular revision `foo` (indicated by writing
/// `//[foo]`), then the property is ignored unless `cfg` is
/// `Some("foo")`.
pub fn load_from(&mut self,
testfile: &Path,
cfg: Option<&str>,
config: &Config) {
fn load_from(&mut self,
testfile: &Path,
cfg: Option<&str>,
config: &Config) {
iter_header(testfile,
cfg,
&mut |ln| {
Expand Down
9 changes: 5 additions & 4 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub fn run(config: Config, testpaths: &TestPaths) {
print!("\n\n");
}
debug!("running {:?}", testpaths.file.display());
let base_props = TestProps::from_file(&testpaths.file, &config);
let base_props = TestProps::from_file(&testpaths.file, None, &config);

let base_cx = TestCx { config: &config,
props: &base_props,
Expand All @@ -81,8 +81,9 @@ pub fn run(config: Config, testpaths: &TestPaths) {
base_cx.run_revision()
} else {
for revision in &base_props.revisions {
let mut revision_props = base_props.clone();
revision_props.load_from(&testpaths.file, Some(revision), &config);
let revision_props = TestProps::from_file(&testpaths.file,
Some(revision),
&config);
let rev_cx = TestCx {
config: &config,
props: &revision_props,
Expand Down Expand Up @@ -2614,4 +2615,4 @@ fn read2_abbreviated(mut child: Child) -> io::Result<Output> {
stdout: stdout.into_bytes(),
stderr: stderr.into_bytes(),
})
}
}