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;
6969pub mod unit_tests;
7070pub mod unstable_book;
7171pub mod walk;
72+ pub mod x;
Original file line number Diff line number Diff line change @@ -53,6 +53,21 @@ fn main() {
5353 VecDeque :: with_capacity ( concurrency. get ( ) ) ;
5454
5555 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+
5671 ( $p: ident $( , $args: expr) * ) => {
5772 drain_handles( & mut handles) ;
5873
@@ -64,7 +79,8 @@ fn main() {
6479 }
6580 } ) ;
6681 handles. push_back( handle) ;
67- }
82+ } ;
83+
6884 }
6985
7086 check ! ( target_specific_tests, & src_path) ;
@@ -107,6 +123,8 @@ fn main() {
107123 check ! ( alphabetical, & compiler_path) ;
108124 check ! ( alphabetical, & library_path) ;
109125
126+ check ! ( x) ;
127+
110128 let collected = {
111129 drain_handles ( & mut handles) ;
112130
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> {
5252}
5353
5454fn 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+ }
5563 let current = match env:: current_dir ( ) {
5664 Ok ( dir) => dir,
5765 Err ( err) => {
You can’t perform that action at this time.
0 commit comments