From d36e37e43ef1fad628cbe194cfb2b96172de014f Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 27 Sep 2018 10:17:00 -0600 Subject: 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. --- src/tools/compiletest/src/header.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/tools/compiletest') 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 [- ]" + 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::>(); + 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 } -- cgit 1.4.1-3-g733a5