@@ -11,10 +11,11 @@ use serde::Serialize;
11
11
12
12
use std:: collections:: BTreeMap ;
13
13
use std:: env;
14
- use std:: fs;
14
+ use std:: fs:: { self , File } ;
15
15
use std:: io:: { self , Read , Write } ;
16
16
use std:: path:: { PathBuf , Path } ;
17
17
use std:: process:: { Command , Stdio } ;
18
+ use std:: collections:: HashMap ;
18
19
19
20
static HOSTS : & [ & str ] = & [
20
21
"aarch64-unknown-linux-gnu" ,
@@ -366,6 +367,7 @@ impl Builder {
366
367
self . lldb_git_commit_hash = self . git_commit_hash ( "lldb" , "x86_64-unknown-linux-gnu" ) ;
367
368
self . miri_git_commit_hash = self . git_commit_hash ( "miri" , "x86_64-unknown-linux-gnu" ) ;
368
369
370
+ self . check_toolstate ( ) ;
369
371
self . digest_and_sign ( ) ;
370
372
let manifest = self . build_manifest ( ) ;
371
373
self . write_channel_files ( & self . rust_release , & manifest) ;
@@ -375,6 +377,22 @@ impl Builder {
375
377
}
376
378
}
377
379
380
+ /// If a tool does not pass its tests, don't ship it.
381
+ /// Right now, we do this only for Miri.
382
+ fn check_toolstate ( & mut self ) {
383
+ // Get the toolstate for this rust revision.
384
+ let toolstates = File :: open ( self . input . join ( "toolstates-linux.json" ) )
385
+ . expect ( "failed to open toolstates file" ) ;
386
+ let toolstates: HashMap < String , String > = serde_json:: from_reader ( & toolstates)
387
+ . expect ( "toolstates file contains malformed JSON" ) ;
388
+ // Mark some tools as missing based on toolstate.
389
+ if toolstates. get ( "miri" ) . map ( |s| & * s as & str ) != Some ( "test-pass" ) {
390
+ println ! ( "Miri tests are not passing, removing component" ) ;
391
+ self . miri_version = None ;
392
+ self . miri_git_commit_hash = None ;
393
+ }
394
+ }
395
+
378
396
/// Hash all files, compute their signatures, and collect the hashes in `self.digests`.
379
397
fn digest_and_sign ( & mut self ) {
380
398
for file in t ! ( self . input. read_dir( ) ) . map ( |e| t ! ( e) . path ( ) ) {
0 commit comments