@@ -19,6 +19,7 @@ struct Test {
1919 name : & ' static str ,
2020 sha : & ' static str ,
2121 lock : Option < & ' static str > ,
22+ packages : & ' static [ & ' static str ] ,
2223}
2324
2425const TEST_REPOS : & ' static [ Test ] = & [
@@ -27,30 +28,35 @@ const TEST_REPOS: &'static [Test] = &[
2728 repo : "https://github.com/iron/iron" ,
2829 sha : "21c7dae29c3c214c08533c2a55ac649b418f2fe3" ,
2930 lock : Some ( include_str ! ( "lockfiles/iron-Cargo.lock" ) ) ,
31+ packages : & [ ] ,
3032 } ,
3133 Test {
3234 name : "ripgrep" ,
3335 repo : "https://github.com/BurntSushi/ripgrep" ,
3436 sha : "b65bb37b14655e1a89c7cd19c8b011ef3e312791" ,
3537 lock : None ,
38+ packages : & [ ] ,
3639 } ,
3740 Test {
3841 name : "tokei" ,
3942 repo : "https://github.com/Aaronepower/tokei" ,
4043 sha : "5e11c4852fe4aa086b0e4fe5885822fbe57ba928" ,
4144 lock : None ,
45+ packages : & [ ] ,
4246 } ,
4347 Test {
4448 name : "treeify" ,
4549 repo : "https://github.com/dzamlo/treeify" ,
4650 sha : "999001b223152441198f117a68fb81f57bc086dd" ,
4751 lock : None ,
52+ packages : & [ ] ,
4853 } ,
4954 Test {
5055 name : "xsv" ,
5156 repo : "https://github.com/BurntSushi/xsv" ,
5257 sha : "4b308adbe48ac81657fd124b90b44f7c3263f771" ,
5358 lock : None ,
59+ packages : & [ ] ,
5460 } ,
5561] ;
5662
@@ -74,7 +80,7 @@ fn test_repo(cargo: &Path, out_dir: &Path, test: &Test) {
7480 . write_all ( lockfile. as_bytes ( ) )
7581 . expect ( "" ) ;
7682 }
77- if !run_cargo_test ( cargo, & dir) {
83+ if !run_cargo_test ( cargo, & dir, test . packages ) {
7884 panic ! ( "tests failed for {}" , test. repo) ;
7985 }
8086}
@@ -134,9 +140,13 @@ fn clone_repo(test: &Test, out_dir: &Path) -> PathBuf {
134140 out_dir
135141}
136142
137- fn run_cargo_test ( cargo_path : & Path , crate_path : & Path ) -> bool {
138- let status = Command :: new ( cargo_path)
139- . arg ( "test" )
143+ fn run_cargo_test ( cargo_path : & Path , crate_path : & Path , packages : & [ & str ] ) -> bool {
144+ let mut command = Command :: new ( cargo_path) ;
145+ command. arg ( "test" ) ;
146+ for name in packages {
147+ command. arg ( "-p" ) . arg ( name) ;
148+ }
149+ let status = command
140150 // Disable rust-lang/cargo's cross-compile tests
141151 . env ( "CFG_DISABLE_CROSS_TESTS" , "1" )
142152 . current_dir ( crate_path)
0 commit comments