about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-04-23 18:40:54 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-04-27 10:11:15 -0700
commit60f8f6bde9be62554a850c31c770357e7d3e576e (patch)
tree09d439b7e30ba4d145b699cae4ca3dbb2fa9a613
parent7dd62155d85e9556c2b2b70c03acce9910896696 (diff)
downloadrust-60f8f6bde9be62554a850c31c770357e7d3e576e.tar.gz
rust-60f8f6bde9be62554a850c31c770357e7d3e576e.zip
compiletest: Add support for `// ignore-musl`
Add the ability to ignore a test based on the environment of the triple being
used.
-rw-r--r--src/compiletest/header.rs4
-rw-r--r--src/compiletest/util.rs4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs
index f5505b6e83a..a648e51497e 100644
--- a/src/compiletest/header.rs
+++ b/src/compiletest/header.rs
@@ -170,6 +170,9 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
         format!("ignore-{}",
                 config.stage_id.split('-').next().unwrap())
     }
+    fn ignore_env(config: &Config) -> String {
+        format!("ignore-{}", util::get_env(&config.target).unwrap_or("<unknown>"))
+    }
     fn ignore_gdb(config: &Config, line: &str) -> bool {
         if config.mode != common::DebugInfoGdb {
             return false;
@@ -231,6 +234,7 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
         !parse_name_directive(ln, &ignore_target(config)) &&
         !parse_name_directive(ln, &ignore_architecture(config)) &&
         !parse_name_directive(ln, &ignore_stage(config)) &&
+        !parse_name_directive(ln, &ignore_env(config)) &&
         !(config.mode == common::Pretty && parse_name_directive(ln, "ignore-pretty")) &&
         !(config.target != config.host && parse_name_directive(ln, "ignore-cross-compile")) &&
         !ignore_gdb(config, ln) &&
diff --git a/src/compiletest/util.rs b/src/compiletest/util.rs
index a8b26cb3ef7..184d62db451 100644
--- a/src/compiletest/util.rs
+++ b/src/compiletest/util.rs
@@ -60,6 +60,10 @@ pub fn get_arch(triple: &str) -> &'static str {
     panic!("Cannot determine Architecture from triple");
 }
 
+pub fn get_env(triple: &str) -> Option<&str> {
+    triple.split('-').nth(3)
+}
+
 pub fn make_new_path(path: &str) -> String {
     assert!(cfg!(windows));
     // Windows just uses PATH as the library search path, so we have to