about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-09-27 10:17:00 -0600
committerTom Tromey <tom@tromey.com>2018-10-30 12:09:11 -0600
commitd36e37e43ef1fad628cbe194cfb2b96172de014f (patch)
tree61e7789f389b34a26d59444d9a73f2568e1b1e27 /src/tools
parent8bbb62f849c6b97900751ac0f0cff0d4c9b1328a (diff)
downloadrust-d36e37e43ef1fad628cbe194cfb2b96172de014f.tar.gz
rust-d36e37e43ef1fad628cbe194cfb2b96172de014f.zip
Add legacy debuginfo tests
The enum debuginfo patch includes a legacy mode that is used when
building against LLVM 5 and LLVM 6.  The main enum debuginfo tests
have been updated to rely on the new approach and a new-enough gdb.
This patch makes a copy of these tests so that the fallback mode will
continue to be tested.

Note that nil-enum.rs is not copied; it seemed not to provide enough
value to bother.

A new header directive is added, "ignore-llvm-version".  I will send a
patch to update the rustc documentation once this lands.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/compiletest/src/header.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index 06eeef61a19..f12dd31c402 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -243,6 +243,29 @@ impl EarlyProps {
                     // Ignore if using system LLVM and actual version
                     // is smaller the minimum required version
                     config.system_llvm && &actual_version[..] < min_version
+                } else if line.starts_with("ignore-llvm-version") {
+                    // Syntax is: "ignore-llvm-version <version1> [- <version2>]"
+                    let range_components = line.split(' ')
+                        .skip(1) // Skip the directive.
+                        .map(|s| s.trim())
+                        .filter(|word| !word.is_empty() && word != &"-")
+                        .take(3) // 3 or more = invalid, so take at most 3.
+                        .collect::<Vec<&str>>();
+                    match range_components.len() {
+                        1 => {
+                            &actual_version[..] == range_components[0]
+                        }
+                        2 => {
+                            let v_min = range_components[0];
+                            let v_max = range_components[1];
+                            if v_max < v_min {
+                                panic!("Malformed LLVM version range: max < min")
+                            }
+                            // Ignore if version lies inside of range.
+                            &actual_version[..] >= v_min && &actual_version[..] <= v_max
+                        }
+                        _ => panic!("Malformed LLVM version directive"),
+                    }
                 } else {
                     false
                 }