Skip to content

Commit 6d5a133

Browse files
authored
Rollup merge of #131614 - jieyouxu:rmake-no-rev, r=Kobzol
Error on trying to use revisions in `run-make` tests Currently, `run-make` tests do not support revisions.
2 parents 6e1488b + 9f0f035 commit 6d5a133

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/tools/compiletest/src/header.rs

+13-4
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl EarlyProps {
5959
rdr,
6060
&mut |DirectiveLine { directive: ln, .. }| {
6161
parse_and_update_aux(config, ln, &mut props.aux);
62-
config.parse_and_update_revisions(ln, &mut props.revisions);
62+
config.parse_and_update_revisions(testfile, ln, &mut props.revisions);
6363
},
6464
);
6565

@@ -391,7 +391,7 @@ impl TestProps {
391391
has_edition = true;
392392
}
393393

394-
config.parse_and_update_revisions(ln, &mut self.revisions);
394+
config.parse_and_update_revisions(testfile, ln, &mut self.revisions);
395395

396396
if let Some(flags) = config.parse_name_value_directive(ln, RUN_FLAGS) {
397397
self.run_flags.extend(split_flags(&flags));
@@ -897,12 +897,21 @@ fn iter_header(
897897
}
898898

899899
impl Config {
900-
fn parse_and_update_revisions(&self, line: &str, existing: &mut Vec<String>) {
900+
fn parse_and_update_revisions(&self, testfile: &Path, line: &str, existing: &mut Vec<String>) {
901901
if let Some(raw) = self.parse_name_value_directive(line, "revisions") {
902+
if self.mode == Mode::RunMake {
903+
panic!("`run-make` tests do not support revisions: {}", testfile.display());
904+
}
905+
902906
let mut duplicates: HashSet<_> = existing.iter().cloned().collect();
903907
for revision in raw.split_whitespace().map(|r| r.to_string()) {
904908
if !duplicates.insert(revision.clone()) {
905-
panic!("Duplicate revision: `{}` in line `{}`", revision, raw);
909+
panic!(
910+
"duplicate revision: `{}` in line `{}`: {}",
911+
revision,
912+
raw,
913+
testfile.display()
914+
);
906915
}
907916
existing.push(revision);
908917
}

src/tools/compiletest/src/header/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ fn test_extract_version_range() {
423423
}
424424

425425
#[test]
426-
#[should_panic(expected = "Duplicate revision: `rpass1` in line ` rpass1 rpass1`")]
426+
#[should_panic(expected = "duplicate revision: `rpass1` in line ` rpass1 rpass1`")]
427427
fn test_duplicate_revisions() {
428428
let config: Config = cfg().build();
429429
parse_rs(&config, "//@ revisions: rpass1 rpass1");

0 commit comments

Comments
 (0)