6
6
7
7
use tidy::*;
8
8
9
+ use crossbeam_utils::thread::scope;
9
10
use std::env;
10
11
use std::path::PathBuf;
11
12
use std::process;
13
+ use std::sync::atomic::{AtomicBool, Ordering};
12
14
13
15
fn main() {
14
16
let root_path: PathBuf = env::args_os().nth(1).expect("need path to root of repo").into();
@@ -22,45 +24,68 @@ fn main() {
22
24
23
25
let args: Vec<String> = env::args().skip(1).collect();
24
26
25
- let mut bad = false;
26
27
let verbose = args.iter().any(|s| *s == "--verbose");
27
28
28
- // Checks over tests.
29
- debug_artifacts::check(&src_path, &mut bad);
30
- ui_tests::check(&src_path, &mut bad);
31
-
32
- // Checks that only make sense for the compiler.
33
- errors::check(&compiler_path, &mut bad);
34
- error_codes_check::check(&src_path, &mut bad);
35
-
36
- // Checks that only make sense for the std libs.
37
- pal::check(&library_path, &mut bad);
38
-
39
- // Checks that need to be done for both the compiler and std libraries.
40
- unit_tests::check(&src_path, &mut bad);
41
- unit_tests::check(&compiler_path, &mut bad);
42
- unit_tests::check(&library_path, &mut bad);
43
-
44
- bins::check(&src_path, &output_directory, &mut bad);
45
- bins::check(&compiler_path, &output_directory, &mut bad);
46
- bins::check(&library_path, &output_directory, &mut bad);
47
-
48
- style::check(&src_path, &mut bad);
49
- style::check(&compiler_path, &mut bad);
50
- style::check(&library_path, &mut bad);
51
-
52
- edition::check(&src_path, &mut bad);
53
- edition::check(&compiler_path, &mut bad);
54
- edition::check(&library_path, &mut bad);
55
-
56
- let collected = features::check(&src_path, &compiler_path, &library_path, &mut bad, verbose);
57
- unstable_book::check(&src_path, collected, &mut bad);
58
-
59
- // Checks that are done on the cargo workspace.
60
- deps::check(&root_path, &cargo, &mut bad);
61
- extdeps::check(&root_path, &mut bad);
62
-
63
- if bad {
29
+ let bad = std::sync::Arc::new(AtomicBool::new(false));
30
+
31
+ scope(|s| {
32
+ macro_rules! check {
33
+ ($p:ident $(, $args:expr)* ) => {
34
+ s.spawn(|_| {
35
+ let mut flag = false;
36
+ $p::check($($args),* , &mut flag);
37
+ if (flag) {
38
+ bad.store(true, Ordering::Relaxed);
39
+ }
40
+ });
41
+ }
42
+ }
43
+
44
+ // Checks that are done on the cargo workspace.
45
+ check!(deps, &root_path, &cargo);
46
+ check!(extdeps, &root_path);
47
+
48
+ // Checks over tests.
49
+ check!(debug_artifacts, &src_path);
50
+ check!(ui_tests, &src_path);
51
+
52
+ // Checks that only make sense for the compiler.
53
+ check!(errors, &compiler_path);
54
+ check!(error_codes_check, &src_path);
55
+
56
+ // Checks that only make sense for the std libs.
57
+ check!(pal, &library_path);
58
+
59
+ // Checks that need to be done for both the compiler and std libraries.
60
+ check!(unit_tests, &src_path);
61
+ check!(unit_tests, &compiler_path);
62
+ check!(unit_tests, &library_path);
63
+
64
+ check!(bins, &src_path, &output_directory);
65
+ check!(bins, &compiler_path, &output_directory);
66
+ check!(bins, &library_path, &output_directory);
67
+
68
+ check!(style, &src_path);
69
+ check!(style, &compiler_path);
70
+ check!(style, &library_path);
71
+
72
+ check!(edition, &src_path);
73
+ check!(edition, &compiler_path);
74
+ check!(edition, &library_path);
75
+
76
+ let collected = {
77
+ let mut flag = false;
78
+ let r = features::check(&src_path, &compiler_path, &library_path, &mut flag, verbose);
79
+ if flag {
80
+ bad.store(true, Ordering::Relaxed);
81
+ }
82
+ r
83
+ };
84
+ check!(unstable_book, &src_path, collected);
85
+ })
86
+ .unwrap();
87
+
88
+ if bad.load(Ordering::Relaxed) {
64
89
eprintln!("some tidy checks failed");
65
90
process::exit(1);
66
91
}
0 commit comments