1 extern crate walkdir;
2 
3 use std::process::Command;
4 
5 use self::walkdir::DirEntry;
6 
base_dir_filter(entry: &DirEntry) -> bool7 pub fn base_dir_filter(entry: &DirEntry) -> bool {
8     let path = entry.path();
9     if path.is_dir() {
10         return true; // otherwise walkdir does not visit the files
11     }
12     if path.extension().map(|e| e != "rs").unwrap_or(true) {
13         return false;
14     }
15     let path_string = path.to_string_lossy();
16     let path_string = if cfg!(windows) {
17         path_string.replace('\\', "/").into()
18     } else {
19         path_string
20     };
21     // TODO assert that parsing fails on the parse-fail cases
22     if path_string.starts_with("tests/rust/src/test/parse-fail")
23         || path_string.starts_with("tests/rust/src/test/compile-fail")
24         || path_string.starts_with("tests/rust/src/test/rustfix")
25     {
26         return false;
27     }
28 
29     if path_string.starts_with("tests/rust/src/test/ui") {
30         let stderr_path = path.with_extension("stderr");
31         if stderr_path.exists() {
32             // Expected to fail in some way
33             return false;
34         }
35     }
36 
37     match path_string.as_ref() {
38         // Deprecated placement syntax
39         "tests/rust/src/test/run-pass/new-box-syntax.rs" |
40         "tests/rust/src/test/ui/obsolete-in-place/bad.rs" |
41         // 2015-style dyn that libsyntax rejects
42         "tests/rust/src/test/ui/dyn-keyword/dyn-2015-no-warnings-without-lints.rs" |
43         // not actually test cases
44         "tests/rust/src/test/run-pass/macros/auxiliary/macro-comma-support.rs" |
45         "tests/rust/src/test/run-pass/macros/auxiliary/macro-include-items-expr.rs" |
46         "tests/rust/src/test/ui/issues/auxiliary/issue-21146-inc.rs" => false,
47         _ => true,
48     }
49 }
50 
clone_rust()51 pub fn clone_rust() {
52     let result = Command::new("tests/clone.sh").status().unwrap();
53     assert!(result.success());
54 }
55