@@ -2394,7 +2394,8 @@ impl<'test> TestCx<'test> {
2394
2394
2395
2395
let proc_res = new_rustdoc. document ( & compare_dir) ;
2396
2396
if !proc_res. status . success ( ) {
2397
- proc_res. fatal ( Some ( "failed to run nightly rustdoc" ) , || ( ) ) ;
2397
+ eprintln ! ( "failed to run nightly rustdoc" ) ;
2398
+ return ;
2398
2399
}
2399
2400
2400
2401
#[ rustfmt:: skip]
@@ -2408,28 +2409,22 @@ impl<'test> TestCx<'test> {
2408
2409
"-modify" ,
2409
2410
] ;
2410
2411
let tidy_dir = |dir| {
2411
- let tidy = |file : & _ | {
2412
- Command :: new ( "tidy" )
2413
- . args ( & tidy_args)
2414
- . arg ( file)
2415
- . spawn ( )
2416
- . unwrap_or_else ( |err| {
2417
- self . fatal ( & format ! ( "failed to run tidy - is it installed? - {}" , err) )
2418
- } )
2419
- . wait ( )
2420
- . unwrap ( )
2421
- } ;
2422
2412
for entry in walkdir:: WalkDir :: new ( dir) {
2423
2413
let entry = entry. expect ( "failed to read file" ) ;
2424
2414
if entry. file_type ( ) . is_file ( )
2425
2415
&& entry. path ( ) . extension ( ) . and_then ( |p| p. to_str ( ) ) == Some ( "html" . into ( ) )
2426
2416
{
2427
- tidy ( entry. path ( ) ) ;
2417
+ let status =
2418
+ Command :: new ( "tidy" ) . args ( & tidy_args) . arg ( entry. path ( ) ) . status ( ) . unwrap ( ) ;
2419
+ // `tidy` returns 1 if it modified the file.
2420
+ assert ! ( status. success( ) || status. code( ) == Some ( 1 ) ) ;
2428
2421
}
2429
2422
}
2430
2423
} ;
2431
- tidy_dir ( out_dir) ;
2432
- tidy_dir ( & compare_dir) ;
2424
+ if self . config . has_tidy {
2425
+ tidy_dir ( out_dir) ;
2426
+ tidy_dir ( & compare_dir) ;
2427
+ }
2433
2428
2434
2429
let pager = {
2435
2430
let output = Command :: new ( "git" ) . args ( & [ "config" , "--get" , "core.pager" ] ) . output ( ) . ok ( ) ;
@@ -2442,7 +2437,8 @@ impl<'test> TestCx<'test> {
2442
2437
} )
2443
2438
} ;
2444
2439
let mut diff = Command :: new ( "diff" ) ;
2445
- diff. args ( & [ "-u" , "-r" ] ) . args ( & [ & compare_dir, out_dir] ) ;
2440
+ // diff recursively, showing context, and excluding .css files
2441
+ diff. args ( & [ "-u" , "-r" , "-x" , "*.css" ] ) . args ( & [ & compare_dir, out_dir] ) ;
2446
2442
2447
2443
let output = if let Some ( pager) = pager {
2448
2444
let diff_pid = diff. stdout ( Stdio :: piped ( ) ) . spawn ( ) . expect ( "failed to run `diff`" ) ;
0 commit comments