about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-05-11 00:42:29 +0100
committervarkor <github@varkor.com>2019-05-11 00:42:29 +0100
commitbf3c46cfc9dbe677ae801f0459cea5b8e5e5a178 (patch)
tree277f5d97df1ecb9c434cd564e783c2adfd9064e8
parentcff1bdbd77d29a28a94ff9f5bf1e1c84e5bb6259 (diff)
downloadrust-bf3c46cfc9dbe677ae801f0459cea5b8e5e5a178.tar.gz
rust-bf3c46cfc9dbe677ae801f0459cea5b8e5e5a178.zip
Allow subdirectories to be tested by x.py test
-rw-r--r--src/bootstrap/test.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index a3d96836aad..3847a2a1e46 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -1184,8 +1184,13 @@ impl Step for Compiletest {
                     Err(_) => p,
                 }
             })
-            .filter(|p| p.starts_with(suite_path) && p.is_file())
-            .map(|p| p.strip_prefix(suite_path).unwrap().to_str().unwrap())
+            .filter(|p| p.starts_with(suite_path) && (p.is_dir() || p.is_file()))
+            .filter_map(|p| {
+                match p.strip_prefix(suite_path).ok().and_then(|p| p.to_str()) {
+                    Some(s) if s != "" => Some(s),
+                    _ => None,
+                }
+            })
             .collect();
 
         test_args.append(&mut builder.config.cmd.test_args());