From a5122281416e2c627c0610096ea3064a01bc2bb0 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 9 Nov 2017 14:04:12 -0700 Subject: [PATCH] Allow minimum system LLVM version in tests This adds a "min-system-llvm-version" directive, so that a test can indicate that it will either work with rust-llvm or with some minimal system LLVM. This makes it simpler to write a test that requires an LLVM patch that landed upstream and was then backported to rust-llvm. --- src/tools/compiletest/src/header.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index e03d9f89e5d..430c02ccbf8 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -150,6 +150,14 @@ impl EarlyProps { // Ignore if actual version is smaller the minimum required // version &actual_version[..] < min_version + } else if line.starts_with("min-system-llvm-version") { + let min_version = line.trim_right() + .rsplit(' ') + .next() + .expect("Malformed llvm version directive"); + // Ignore if using system LLVM and actual version + // is smaller the minimum required version + !(config.system_llvm && &actual_version[..] < min_version) } else { false }