@@ -13,6 +13,8 @@ struct Test {
13
13
manifest_path : Option < & ' static str > ,
14
14
/// `filters` are passed to libtest (i.e., after a `--` in the `cargo test` invocation).
15
15
filters : & ' static [ & ' static str ] ,
16
+ override_script : Option < & ' static Path > ,
17
+ run_by_default : bool ,
16
18
}
17
19
18
20
const TEST_REPOS : & [ Test ] = & [
@@ -25,6 +27,8 @@ const TEST_REPOS: &[Test] = &[
25
27
features : None ,
26
28
manifest_path : None ,
27
29
filters : & [ ] ,
30
+ override_script : None ,
31
+ run_by_default : true ,
28
32
} ,
29
33
Test {
30
34
name : "ripgrep" ,
@@ -35,6 +39,8 @@ const TEST_REPOS: &[Test] = &[
35
39
features : None ,
36
40
manifest_path : None ,
37
41
filters : & [ ] ,
42
+ override_script : None ,
43
+ run_by_default : true ,
38
44
} ,
39
45
Test {
40
46
name : "tokei" ,
@@ -45,6 +51,8 @@ const TEST_REPOS: &[Test] = &[
45
51
features : None ,
46
52
manifest_path : None ,
47
53
filters : & [ ] ,
54
+ override_script : None ,
55
+ run_by_default : true ,
48
56
} ,
49
57
Test {
50
58
name : "xsv" ,
@@ -69,6 +77,8 @@ const TEST_REPOS: &[Test] = &[
69
77
"test_stats::" ,
70
78
"test_table::" ,
71
79
] ,
80
+ override_script : None ,
81
+ run_by_default : true ,
72
82
} ,
73
83
Test {
74
84
name : "servo" ,
@@ -81,6 +91,8 @@ const TEST_REPOS: &[Test] = &[
81
91
features : None ,
82
92
manifest_path : None ,
83
93
filters : & [ ] ,
94
+ override_script : None ,
95
+ run_by_default : true ,
84
96
} ,
85
97
Test {
86
98
name : "diesel" ,
@@ -97,6 +109,21 @@ const TEST_REPOS: &[Test] = &[
97
109
// (This is required to set the feature flags above)
98
110
manifest_path : Some ( "diesel/Cargo.toml" ) ,
99
111
filters : & [ ] ,
112
+ override_script : None ,
113
+ run_by_default : true ,
114
+ } ,
115
+ Test {
116
+ name : "fuchsia" ,
117
+ repo : "https://fuchsia.googlesource.com/fuchsia.git" ,
118
+ // TODO
119
+ sha : "refs/changes/58/938058/1" ,
120
+ lock : None ,
121
+ packages : & [ ] ,
122
+ features : None ,
123
+ manifest_path : None ,
124
+ filters : & [ ] ,
125
+ override_script : Some ( Path :: new ( "scripts/rust/build_fuchsia_from_rust_ci.sh" ) ) ,
126
+ run_by_default : false ,
100
127
} ,
101
128
] ;
102
129
@@ -107,7 +134,10 @@ fn main() {
107
134
let cargo = & Path :: new ( cargo) ;
108
135
109
136
for test in TEST_REPOS . iter ( ) . rev ( ) {
110
- if args[ 3 ..] . is_empty ( ) || args[ 3 ..] . iter ( ) . any ( |s| s. contains ( test. name ) ) {
137
+ // TODO: uninvert run_by_default below
138
+ if ( args[ 3 ..] . is_empty ( ) && !test. run_by_default )
139
+ || args[ 3 ..] . iter ( ) . any ( |s| s. contains ( test. name ) )
140
+ {
111
141
test_repo ( cargo, out_dir, test) ;
112
142
}
113
143
}
@@ -119,8 +149,18 @@ fn test_repo(cargo: &Path, out_dir: &Path, test: &Test) {
119
149
if let Some ( lockfile) = test. lock {
120
150
fs:: write ( & dir. join ( "Cargo.lock" ) , lockfile) . unwrap ( ) ;
121
151
}
122
- if !run_cargo_test ( cargo, & dir, test. packages , test. features , test. manifest_path , test. filters )
123
- {
152
+ let success = match test. override_script {
153
+ Some ( script) => run_script ( & dir, script) ,
154
+ None => run_cargo_test (
155
+ cargo,
156
+ & dir,
157
+ test. packages ,
158
+ test. features ,
159
+ test. manifest_path ,
160
+ test. filters ,
161
+ ) ,
162
+ } ;
163
+ if !success {
124
164
panic ! ( "tests failed for {}" , test. repo) ;
125
165
}
126
166
}
@@ -148,9 +188,10 @@ fn clone_repo(test: &Test, out_dir: &Path) -> PathBuf {
148
188
assert ! ( status. success( ) ) ;
149
189
}
150
190
191
+ let reset_to = if test. sha . contains ( '/' ) { "FETCH_HEAD" } else { test. sha } ;
151
192
let status = Command :: new ( "git" )
152
193
. arg ( "reset" )
153
- . arg ( test . sha )
194
+ . arg ( reset_to )
154
195
. arg ( "--hard" )
155
196
. current_dir ( & out_dir)
156
197
. status ( )
@@ -165,6 +206,7 @@ fn clone_repo(test: &Test, out_dir: &Path) -> PathBuf {
165
206
if !found {
166
207
panic ! ( "unable to find commit {}" , test. sha)
167
208
}
209
+
168
210
let status =
169
211
Command :: new ( "git" ) . arg ( "clean" ) . arg ( "-fdx" ) . current_dir ( & out_dir) . status ( ) . unwrap ( ) ;
170
212
assert ! ( status. success( ) ) ;
@@ -216,3 +258,7 @@ fn run_cargo_test(
216
258
217
259
status. success ( )
218
260
}
261
+
262
+ fn run_script ( crate_path : & Path , script : & ' static Path ) -> bool {
263
+ Command :: new ( & crate_path. join ( script) ) . status ( ) . unwrap ( ) . success ( )
264
+ }
0 commit comments