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/ui/obsolete-in-place/bad.rs" |
40         // Deprecated anonymous parameter syntax in traits
41         "tests/rust/src/test/ui/error-codes/e0119/auxiliary/issue-23563-a.rs" |
42         "tests/rust/src/test/ui/issues/issue-13105.rs" |
43         "tests/rust/src/test/ui/issues/issue-13775.rs" |
44         "tests/rust/src/test/ui/issues/issue-34074.rs" |
45         // Deprecated await macro syntax
46         "tests/rust/src/test/ui/async-await/await-macro.rs" |
47         // 2015-style dyn that libsyntax rejects
48         "tests/rust/src/test/ui/dyn-keyword/dyn-2015-no-warnings-without-lints.rs" |
49         // not actually test cases
50         "tests/rust/src/test/ui/macros/auxiliary/macro-comma-support.rs" |
51         "tests/rust/src/test/ui/macros/auxiliary/macro-include-items-expr.rs" |
52         "tests/rust/src/test/ui/issues/auxiliary/issue-21146-inc.rs" => false,
53         _ => true,
54     }
55 }
56 
clone_rust()57 pub fn clone_rust() {
58     let result = Command::new("tests/clone.sh").status().unwrap();
59     assert!(result.success());
60 }
61