File tree Expand file tree Collapse file tree 4 files changed +47
-1
lines changed Expand file tree Collapse file tree 4 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -69,3 +69,4 @@ pub mod ui_tests;
69
69
pub mod unit_tests;
70
70
pub mod unstable_book;
71
71
pub mod walk;
72
+ pub mod x;
Original file line number Diff line number Diff line change @@ -53,6 +53,21 @@ fn main() {
53
53
VecDeque :: with_capacity ( concurrency. get ( ) ) ;
54
54
55
55
macro_rules! check {
56
+ ( $p: ident) => {
57
+ while handles. len( ) >= concurrency. get( ) {
58
+ handles. pop_front( ) . unwrap( ) . join( ) . unwrap( ) ;
59
+ }
60
+
61
+ let handle = s. spawn( || {
62
+ let mut flag = false ;
63
+ $p:: check( & mut flag) ;
64
+ if ( flag) {
65
+ bad. store( true , Ordering :: Relaxed ) ;
66
+ }
67
+ } ) ;
68
+ handles. push_back( handle) ;
69
+ } ;
70
+
56
71
( $p: ident $( , $args: expr) * ) => {
57
72
drain_handles( & mut handles) ;
58
73
@@ -64,7 +79,8 @@ fn main() {
64
79
}
65
80
} ) ;
66
81
handles. push_back( handle) ;
67
- }
82
+ } ;
83
+
68
84
}
69
85
70
86
check ! ( target_specific_tests, & src_path) ;
@@ -107,6 +123,8 @@ fn main() {
107
123
check ! ( alphabetical, & compiler_path) ;
108
124
check ! ( alphabetical, & library_path) ;
109
125
126
+ check ! ( x) ;
127
+
110
128
let collected = {
111
129
drain_handles ( & mut handles) ;
112
130
Original file line number Diff line number Diff line change
1
+ use std:: process:: Command ;
2
+
3
+ pub fn check ( _bad : & mut bool ) {
4
+ let result = Command :: new ( "x" )
5
+ . arg ( "--version" )
6
+ . output ( ) ;
7
+ let output = match result {
8
+ Ok ( output) => output,
9
+ Err ( _e) => todo ! ( ) ,
10
+ } ;
11
+
12
+ if output. status . success ( ) {
13
+ let version = String :: from_utf8_lossy ( & output. stdout ) ;
14
+ assert_eq ! ( "0.1.0" , version. trim_end( ) ) ;
15
+ }
16
+ // FIXME: throw some kind of tidy error when the version of x isn't
17
+ // greater than or equal to the version we'd expect.
18
+ //tidy_error!(bad, "Current version of x is {version} Consider updating to the newer version of x by running `cargo install --path src/tools/x`")
19
+ }
Original file line number Diff line number Diff line change @@ -52,6 +52,14 @@ fn exec_or_status(command: &mut Command) -> io::Result<ExitStatus> {
52
52
}
53
53
54
54
fn main ( ) {
55
+ match env:: args ( ) . skip ( 1 ) . next ( ) . as_deref ( ) {
56
+ Some ( "--version" ) => {
57
+ let version = env ! ( "CARGO_PKG_VERSION" ) ;
58
+ println ! ( "{}" , version) ;
59
+ return ;
60
+ }
61
+ _ => { }
62
+ }
55
63
let current = match env:: current_dir ( ) {
56
64
Ok ( dir) => dir,
57
65
Err ( err) => {
You can’t perform that action at this time.
0 commit comments