Skip to content

Commit 6a9fa50

Browse files
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.
1 parent 968b620 commit 6a9fa50

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/tools/compiletest/src/header.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -259,20 +259,20 @@ impl TestProps {
259259
props
260260
}
261261

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

268268
/// Load properties from `testfile` into `props`. If a property is
269269
/// tied to a particular revision `foo` (indicated by writing
270270
/// `//[foo]`), then the property is ignored unless `cfg` is
271271
/// `Some("foo")`.
272-
pub fn load_from(&mut self,
273-
testfile: &Path,
274-
cfg: Option<&str>,
275-
config: &Config) {
272+
fn load_from(&mut self,
273+
testfile: &Path,
274+
cfg: Option<&str>,
275+
config: &Config) {
276276
iter_header(testfile,
277277
cfg,
278278
&mut |ln| {

src/tools/compiletest/src/runtest.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub fn run(config: Config, testpaths: &TestPaths) {
6969
print!("\n\n");
7070
}
7171
debug!("running {:?}", testpaths.file.display());
72-
let base_props = TestProps::from_file(&testpaths.file, &config);
72+
let base_props = TestProps::from_file(&testpaths.file, None, &config);
7373

7474
let base_cx = TestCx { config: &config,
7575
props: &base_props,
@@ -81,8 +81,9 @@ pub fn run(config: Config, testpaths: &TestPaths) {
8181
base_cx.run_revision()
8282
} else {
8383
for revision in &base_props.revisions {
84-
let mut revision_props = base_props.clone();
85-
revision_props.load_from(&testpaths.file, Some(revision), &config);
84+
let revision_props = TestProps::from_file(&testpaths.file,
85+
Some(revision),
86+
&config);
8687
let rev_cx = TestCx {
8788
config: &config,
8889
props: &revision_props,
@@ -2614,4 +2615,4 @@ fn read2_abbreviated(mut child: Child) -> io::Result<Output> {
26142615
stdout: stdout.into_bytes(),
26152616
stderr: stderr.into_bytes(),
26162617
})
2617-
}
2618+
}

0 commit comments

Comments
 (0)