about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--mk/tests.mk31
-rw-r--r--src/compiletest/compiletest.rs37
-rw-r--r--src/compiletest/runtest.rs23
3 files changed, 62 insertions, 29 deletions
diff --git a/mk/tests.mk b/mk/tests.mk
index b887f7b887f..5818561b52d 100644
--- a/mk/tests.mk
+++ b/mk/tests.mk
@@ -458,21 +458,22 @@ $(foreach host,$(CFG_HOST), \
 # Rules for the compiletest tests (rpass, rfail, etc.)
 ######################################################################
 
-RPASS_RS := $(wildcard $(S)src/test/run-pass/*.rs)
-RPASS_VALGRIND_RS := $(wildcard $(S)src/test/run-pass-valgrind/*.rs)
-RPASS_FULL_RS := $(wildcard $(S)src/test/run-pass-fulldeps/*.rs)
-RFAIL_FULL_RS := $(wildcard $(S)src/test/run-fail-fulldeps/*.rs)
-CFAIL_FULL_RS := $(wildcard $(S)src/test/compile-fail-fulldeps/*.rs)
-RFAIL_RS := $(wildcard $(S)src/test/run-fail/*.rs)
-CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
-PFAIL_RS := $(wildcard $(S)src/test/parse-fail/*.rs)
-PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
-DEBUGINFO_GDB_RS := $(wildcard $(S)src/test/debuginfo/*.rs)
-DEBUGINFO_LLDB_RS := $(wildcard $(S)src/test/debuginfo/*.rs)
-CODEGEN_RS := $(wildcard $(S)src/test/codegen/*.rs)
-CODEGEN_CC := $(wildcard $(S)src/test/codegen/*.cc)
-CODEGEN_UNITS_RS := $(wildcard $(S)src/test/codegen-units/*.rs)
-RUSTDOCCK_RS := $(wildcard $(S)src/test/rustdoc/*.rs)
+RPASS_RS := $(call rwildcard,$(S)src/test/run-pass/,*.rs)
+RPASS_VALGRIND_RS := $(call rwildcard,$(S)src/test/run-pass-valgrind/,*.rs)
+RPASS_FULL_RS := $(call rwildcard,$(S)src/test/run-pass-fulldeps/,*.rs)
+RFAIL_FULL_RS := $(call rwildcard,$(S)src/test/run-fail-fulldeps/,*.rs)
+CFAIL_FULL_RS := $(call rwildcard,$(S)src/test/compile-fail-fulldeps/,*.rs)
+RFAIL_RS := $(call rwildcard,$(S)src/test/run-fail/,*.rs)
+RFAIL_RS := $(call rwildcard,$(S)src/test/run-fail/,*.rs)
+CFAIL_RS := $(call rwildcard,$(S)src/test/compile-fail/,*.rs)
+PFAIL_RS := $(call rwildcard,$(S)src/test/parse-fail/,*.rs)
+PRETTY_RS := $(call rwildcard,$(S)src/test/pretty/,*.rs)
+DEBUGINFO_GDB_RS := $(call rwildcard,$(S)src/test/debuginfo/,*.rs)
+DEBUGINFO_LLDB_RS := $(call rwildcard,$(S)src/test/debuginfo/,*.rs)
+CODEGEN_RS := $(call rwildcard,$(S)src/test/codegen/,*.rs)
+CODEGEN_CC := $(call rwildcard,$(S)src/test/codegen/,*.cc)
+CODEGEN_UNITS_RS := $(call rwildcard,$(S)src/test/codegen-units/,*.rs)
+RUSTDOCCK_RS := $(call rwildcard,$(S)src/test/rustdoc/,*.rs)
 
 RPASS_TESTS := $(RPASS_RS)
 RPASS_VALGRIND_TESTS := $(RPASS_VALGRIND_RS)
diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs
index e29a55bbadc..d57ffe1533c 100644
--- a/src/compiletest/compiletest.rs
+++ b/src/compiletest/compiletest.rs
@@ -284,6 +284,16 @@ fn collect_tests_from_dir(config: &Config,
                           relative_dir_path: &Path,
                           tests: &mut Vec<test::TestDescAndFn>)
                           -> io::Result<()> {
+    // Ignore directories that contain a file
+    // `compiletest-ignore-dir`.
+    for file in try!(fs::read_dir(dir)) {
+        let file = try!(file);
+        if file.file_name() == *"compiletest-ignore-dir" {
+            return Ok(());
+        }
+    }
+
+    let dirs = try!(fs::read_dir(dir));
     for file in dirs {
         let file = try!(file);
         let file_path = file.path();
@@ -295,6 +305,13 @@ fn collect_tests_from_dir(config: &Config,
                 relative_dir: relative_dir_path.to_path_buf(),
             };
             tests.push(make_test(config, &paths))
+        } else if file_path.is_dir() {
+            let relative_file_path = relative_dir_path.join(file.file_name());
+            try!(collect_tests_from_dir(config,
+                                        base,
+                                        &file_path,
+                                        &relative_file_path,
+                                        tests));
         }
     }
     Ok(())
@@ -338,17 +355,15 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn
     }
 }
 
-pub fn make_test_name(config: &Config, testfile: &Path) -> test::TestName {
-
-    // Try to elide redundant long paths
-    fn shorten(path: &Path) -> String {
-        let filename = path.file_name().unwrap().to_str();
-        let p = path.parent().unwrap();
-        let dir = p.file_name().unwrap().to_str();
-        format!("{}/{}", dir.unwrap_or(""), filename.unwrap_or(""))
-    }
-
-    test::DynTestName(format!("[{}] {}", config.mode, shorten(testfile)))
+pub fn make_test_name(config: &Config, testpaths: &TestPaths) -> test::TestName {
+    // Convert a complete path to something like
+    //
+    //    run-pass/foo/bar/baz.rs
+    let path =
+        PathBuf::from(config.mode.to_string())
+        .join(&testpaths.relative_dir)
+        .join(&testpaths.file.file_name().unwrap());
+    test::DynTestName(format!("[{}] {}", config.mode, path.display()))
 }
 
 pub fn make_test_closure(config: &Config, testpaths: &TestPaths) -> test::TestFn {
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index 601033ff5e8..1e6e3d3e679 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -1214,6 +1214,21 @@ fn exec_compiled_test(config: &Config, props: &TestProps,
     }
 }
 
+fn compute_aux_test_paths(config: &Config,
+                          testpaths: &TestPaths,
+                          rel_ab: &str)
+                          -> TestPaths
+{
+    let abs_ab = config.aux_base.join(rel_ab);
+    TestPaths {
+        file: abs_ab,
+        base: testpaths.base.clone(),
+        relative_dir: Path::new(rel_ab).parent()
+                                       .map(|p| p.to_path_buf())
+                                       .unwrap_or_else(|| PathBuf::new())
+    }
+}
+
 fn compose_and_run_compiler(config: &Config, props: &TestProps,
                             testpaths: &TestPaths, args: ProcArgs,
                             input: Option<String>) -> ProcRes {
@@ -1501,9 +1516,11 @@ fn output_testname(filepath: &Path) -> PathBuf {
     PathBuf::from(filepath.file_stem().unwrap())
 }
 
-fn output_base_name(config: &Config, testfile: &Path) -> PathBuf {
-    config.build_base
-        .join(&output_testname(testfile))
+fn output_base_name(config: &Config, testpaths: &TestPaths) -> PathBuf {
+    let dir = config.build_base.join(&testpaths.relative_dir);
+    fs::create_dir_all(&dir).unwrap();
+    dir
+        .join(&output_testname(&testpaths.file))
         .with_extension(&config.stage_id)
 }