about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCorey Richardson <corey@octayn.net>2013-08-12 13:55:42 -0400
committerCorey Richardson <corey@octayn.net>2013-08-28 08:16:19 -0400
commit8a07f5708196dd72ec030018c2a215a4dd823b2e (patch)
treeaa92d959fb747d9becb1f0c5ed494b9371b103b7
parent14cdc26e8a7794e437946f46df5769362b42acdf (diff)
downloadrust-8a07f5708196dd72ec030018c2a215a4dd823b2e.tar.gz
rust-8a07f5708196dd72ec030018c2a215a4dd823b2e.zip
Teach compiletest to use multiple --src-base's
-rw-r--r--src/compiletest/common.rs2
-rw-r--r--src/compiletest/compiletest.rs34
2 files changed, 19 insertions, 17 deletions
diff --git a/src/compiletest/common.rs b/src/compiletest/common.rs
index 3ae3600cf88..bbe8026030f 100644
--- a/src/compiletest/common.rs
+++ b/src/compiletest/common.rs
@@ -36,7 +36,7 @@ pub struct config {
     llvm_bin_path: Option<Path>,
 
     // The directory containing the tests to run
-    src_base: Path,
+    src_base: ~[Path],
 
     // The directory where programs should be built
     build_base: Path,
diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs
index 8de79749b54..ab76fca865f 100644
--- a/src/compiletest/compiletest.rs
+++ b/src/compiletest/compiletest.rs
@@ -19,7 +19,7 @@ use std::os;
 use std::f64;
 
 use extra::getopts;
-use extra::getopts::groups::{optopt, optflag, reqopt};
+use extra::getopts::groups::{optopt, optflag, reqopt, optmulti};
 use extra::test;
 
 use common::config;
@@ -49,19 +49,19 @@ pub fn main() {
 pub fn parse_config(args: ~[~str]) -> config {
 
     let groups : ~[getopts::groups::OptGroup] =
-        ~[reqopt("", "compile-lib-path", "path to host shared libraries", "PATH"),
-          reqopt("", "run-lib-path", "path to target shared libraries", "PATH"),
-          reqopt("", "rustc-path", "path to rustc to use for compiling", "PATH"),
-          optopt("", "clang-path", "path to  executable for codegen tests", "PATH"),
-          optopt("", "llvm-bin-path", "path to directory holding llvm binaries", "DIR"),
-          reqopt("", "src-base", "directory to scan for test files", "PATH"),
-          reqopt("", "build-base", "directory to deposit test outputs", "PATH"),
-          reqopt("", "aux-base", "directory to find auxiliary test files", "PATH"),
-          reqopt("", "stage-id", "the target-stage identifier", "stageN-TARGET"),
-          reqopt("", "mode", "which sort of compile tests to run",
-                 "(compile-fail|run-fail|run-pass|pretty|debug-info)"),
-          optflag("", "ignored", "run tests marked as ignored / xfailed"),
-          optopt("", "runtool", "supervisor program to run tests under \
+        ~[reqopt   ("", "compile-lib-path", "path to host shared libraries", "PATH"),
+          reqopt   ("", "run-lib-path", "path to target shared libraries", "PATH"),
+          reqopt   ("", "rustc-path", "path to rustc to use for compiling", "PATH"),
+          optopt   ("", "clang-path", "path to  executable for codegen tests", "PATH"),
+          optopt   ("", "llvm-bin-path", "path to directory holding llvm binaries", "DIR"),
+          optmulti ("", "src-base", "directory to scan for test files", "PATH"),
+          reqopt   ("", "build-base", "directory to deposit test outputs", "PATH"),
+          reqopt   ("", "aux-base", "directory to find auxiliary test files", "PATH"),
+          reqopt   ("", "stage-id", "the target-stage identifier", "stageN-TARGET"),
+          reqopt   ("", "mode", "which sort of compile tests to run",
+                    " (compile-fail|run-fail|run-pass|pretty|debug-info)"),
+          optflag  ("", "ignored", "run tests marked as ignored / xfailed"),
+          optopt   ("", "runtool", "supervisor program to run tests under \
                                  (eg. emulator, valgrind)", "PROGRAM"),
           optopt("", "rustcflags", "flags to pass to rustc", "FLAGS"),
           optflag("", "verbose", "run tests verbosely, showing all output"),
@@ -105,6 +105,8 @@ pub fn parse_config(args: ~[~str]) -> config {
     fn opt_path(m: &getopts::Matches, nm: &str) -> Path {
         Path(getopts::opt_str(m, nm))
     }
+    
+    let src_base = getopts::opt_strs(matches, "src-base");
 
     config {
         compile_lib_path: getopts::opt_str(matches, "compile-lib-path"),
@@ -112,7 +114,7 @@ pub fn parse_config(args: ~[~str]) -> config {
         rustc_path: opt_path(matches, "rustc-path"),
         clang_path: getopts::opt_maybe_str(matches, "clang-path").map_move(|s| Path(s)),
         llvm_bin_path: getopts::opt_maybe_str(matches, "llvm-bin-path").map_move(|s| Path(s)),
-        src_base: opt_path(matches, "src-base"),
+        src_base: src_base.iter().map(|x| Path(x.clone())).collect(),
         build_base: opt_path(matches, "build-base"),
         aux_base: opt_path(matches, "aux-base"),
         stage_id: getopts::opt_str(matches, "stage-id"),
@@ -248,7 +250,7 @@ pub fn make_tests(config: &config) -> ~[test::TestDescAndFn] {
     debug!("making tests from %s",
            config.src_base.to_str());
     let mut tests = ~[];
-    let dirs = os::list_dir_path(&config.src_base);
+    let dirs = config.src_base.iter().flat_map(|x| os::list_dir_path(x).move_iter()).to_owned_vec();
     for file in dirs.iter() {
         let file = file.clone();
         debug!("inspecting file %s", file.to_str());