summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-10-13 12:32:17 +0200
committerGitHub <noreply@github.com>2024-10-13 12:32:17 +0200
commit6d5a1339950d44ece88123f69df276846cd8bf98 (patch)
treec7de8a694851170aeceb775d3949ea989c362de2 /src
parent6e1488be723bda084e395b09aaecb0ee2a9ca89f (diff)
parent9f0f0352f7b6fd9c4062cc4f161ae35d33fb37c3 (diff)
downloadrust-6d5a1339950d44ece88123f69df276846cd8bf98.tar.gz
rust-6d5a1339950d44ece88123f69df276846cd8bf98.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/tools/compiletest/src/header.rs17
-rw-r--r--src/tools/compiletest/src/header/tests.rs2
2 files changed, 14 insertions, 5 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index c5f163dab1e..76e21c172d1 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -59,7 +59,7 @@ impl EarlyProps {
             rdr,
             &mut |DirectiveLine { directive: ln, .. }| {
                 parse_and_update_aux(config, ln, &mut props.aux);
-                config.parse_and_update_revisions(ln, &mut props.revisions);
+                config.parse_and_update_revisions(testfile, ln, &mut props.revisions);
             },
         );
 
@@ -391,7 +391,7 @@ impl TestProps {
                         has_edition = true;
                     }
 
-                    config.parse_and_update_revisions(ln, &mut self.revisions);
+                    config.parse_and_update_revisions(testfile, ln, &mut self.revisions);
 
                     if let Some(flags) = config.parse_name_value_directive(ln, RUN_FLAGS) {
                         self.run_flags.extend(split_flags(&flags));
@@ -897,12 +897,21 @@ fn iter_header(
 }
 
 impl Config {
-    fn parse_and_update_revisions(&self, line: &str, existing: &mut Vec<String>) {
+    fn parse_and_update_revisions(&self, testfile: &Path, line: &str, existing: &mut Vec<String>) {
         if let Some(raw) = self.parse_name_value_directive(line, "revisions") {
+            if self.mode == Mode::RunMake {
+                panic!("`run-make` tests do not support revisions: {}", testfile.display());
+            }
+
             let mut duplicates: HashSet<_> = existing.iter().cloned().collect();
             for revision in raw.split_whitespace().map(|r| r.to_string()) {
                 if !duplicates.insert(revision.clone()) {
-                    panic!("Duplicate revision: `{}` in line `{}`", revision, raw);
+                    panic!(
+                        "duplicate revision: `{}` in line `{}`: {}",
+                        revision,
+                        raw,
+                        testfile.display()
+                    );
                 }
                 existing.push(revision);
             }
diff --git a/src/tools/compiletest/src/header/tests.rs b/src/tools/compiletest/src/header/tests.rs
index 22dfa349e2b..c3c9496c4d2 100644
--- a/src/tools/compiletest/src/header/tests.rs
+++ b/src/tools/compiletest/src/header/tests.rs
@@ -423,7 +423,7 @@ fn test_extract_version_range() {
 }
 
 #[test]
-#[should_panic(expected = "Duplicate revision: `rpass1` in line ` rpass1 rpass1`")]
+#[should_panic(expected = "duplicate revision: `rpass1` in line ` rpass1 rpass1`")]
 fn test_duplicate_revisions() {
     let config: Config = cfg().build();
     parse_rs(&config, "//@ revisions: rpass1 rpass1");