@@ -25,13 +25,15 @@ extern crate rustc_serialize;
2525#[ macro_use]  
2626extern  crate  log; 
2727extern  crate  env_logger; 
28+ extern  crate  filetime; 
2829
2930use  std:: env; 
3031use  std:: ffi:: OsString ; 
3132use  std:: fs; 
3233use  std:: io; 
3334use  std:: path:: { Path ,  PathBuf } ; 
3435use  std:: process:: Command ; 
36+ use  filetime:: FileTime ; 
3537use  getopts:: { optopt,  optflag,  reqopt} ; 
3638use  common:: Config ; 
3739use  common:: { Pretty ,  DebugInfoGdb ,  DebugInfoLldb ,  Mode } ; 
@@ -457,7 +459,7 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn
457459    } ; 
458460
459461    // Debugging emscripten code doesn't make sense today 
460-     let  mut  ignore = early_props. ignore ; 
462+     let  mut  ignore = early_props. ignore  || ! up_to_date ( config ,  testpaths ,   & early_props ) ; 
461463    if  ( config. mode  == DebugInfoGdb  || config. mode  == DebugInfoLldb )  &&
462464        config. target . contains ( "emscripten" )  { 
463465        ignore = true ; 
@@ -473,6 +475,42 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn
473475    } 
474476} 
475477
478+ fn  stamp ( config :  & Config ,  testpaths :  & TestPaths )  -> PathBuf  { 
479+     let  stamp_name = format ! ( "{}-H-{}-T-{}-S-{}.stamp" , 
480+                              testpaths. file. file_name( ) . unwrap( ) 
481+                                            . to_str( ) . unwrap( ) , 
482+                              config. host, 
483+                              config. target, 
484+                              config. stage_id) ; 
485+     config. build_base . canonicalize ( ) 
486+           . unwrap_or ( config. build_base . clone ( ) ) 
487+           . join ( stamp_name) 
488+ } 
489+ 
490+ fn  up_to_date ( config :  & Config ,  testpaths :  & TestPaths ,  props :  & EarlyProps )  -> bool  { 
491+     let  stamp = mtime ( & stamp ( config,  testpaths) ) ; 
492+     let  mut  inputs = vec ! [ 
493+         mtime( & testpaths. file) , 
494+         mtime( & config. rustc_path) , 
495+     ] ; 
496+     for  aux in  props. aux . iter ( )  { 
497+         inputs. push ( mtime ( & testpaths. file . parent ( ) . unwrap ( ) 
498+                                          . join ( "auxiliary" ) 
499+                                          . join ( aux) ) ) ; 
500+     } 
501+     for  lib in  config. run_lib_path . read_dir ( ) . unwrap ( )  { 
502+         let  lib = lib. unwrap ( ) ; 
503+         inputs. push ( mtime ( & lib. path ( ) ) ) ; 
504+     } 
505+     inputs. iter ( ) . any ( |input| * input > stamp) 
506+ } 
507+ 
508+ fn  mtime ( path :  & Path )  -> FileTime  { 
509+     fs:: metadata ( path) . map ( |f| { 
510+         FileTime :: from_last_modification_time ( & f) 
511+     } ) . unwrap_or ( FileTime :: zero ( ) ) 
512+ } 
513+ 
476514pub  fn  make_test_name ( config :  & Config ,  testpaths :  & TestPaths )  -> test:: TestName  { 
477515    // Convert a complete path to something like 
478516    // 
0 commit comments