From 6a9fa50f4abd60748ee17aeba8bc539a6eeefe41 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Fri, 10 Nov 2017 17:26:10 +0100 Subject: [PATCH] Fix test case header parsing code in presence of multiple revisions. The previous code would parse the TestProps, and then parse them again with a revision set, adding some elements (like aux_builds) a second time to the existing TestProps. --- src/tools/compiletest/src/header.rs | 12 ++++++------ src/tools/compiletest/src/runtest.rs | 9 +++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 19195838791..e03d9f89e5d 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -259,9 +259,9 @@ 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 } @@ -269,10 +269,10 @@ impl TestProps { /// 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| { diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 80ca0afe72b..2ff3eb7678f 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -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, @@ -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, @@ -2614,4 +2615,4 @@ fn read2_abbreviated(mut child: Child) -> io::Result { stdout: stdout.into_bytes(), stderr: stderr.into_bytes(), }) -} \ No newline at end of file +}