@@ -9,6 +9,8 @@ struct Test {
9
9
sha : & ' static str ,
10
10
lock : Option < & ' static str > ,
11
11
packages : & ' static [ & ' static str ] ,
12
+ features : Option < & ' static [ & ' static str ] > ,
13
+ manifest_path : Option < & ' static str > ,
12
14
}
13
15
14
16
const TEST_REPOS : & [ Test ] = & [
@@ -18,27 +20,35 @@ const TEST_REPOS: &[Test] = &[
18
20
sha : "cf056ea5e8052c1feea6141e40ab0306715a2c33" ,
19
21
lock : None ,
20
22
packages : & [ ] ,
23
+ features : None ,
24
+ manifest_path : None ,
21
25
} ,
22
26
Test {
23
27
name : "ripgrep" ,
24
28
repo : "https://github.com/BurntSushi/ripgrep" ,
25
29
sha : "3de31f752729525d85a3d1575ac1978733b3f7e7" ,
26
30
lock : None ,
27
31
packages : & [ ] ,
32
+ features : None ,
33
+ manifest_path : None ,
28
34
} ,
29
35
Test {
30
36
name : "tokei" ,
31
37
repo : "https://github.com/XAMPPRocky/tokei" ,
32
38
sha : "fdf3f8cb279a7aeac0696c87e5d8b0cd946e4f9e" ,
33
39
lock : None ,
34
40
packages : & [ ] ,
41
+ features : None ,
42
+ manifest_path : None ,
35
43
} ,
36
44
Test {
37
45
name : "xsv" ,
38
46
repo : "https://github.com/BurntSushi/xsv" ,
39
47
sha : "66956b6bfd62d6ac767a6b6499c982eae20a2c9f" ,
40
48
lock : None ,
41
49
packages : & [ ] ,
50
+ features : None ,
51
+ manifest_path : None ,
42
52
} ,
43
53
Test {
44
54
name : "servo" ,
@@ -48,6 +58,23 @@ const TEST_REPOS: &[Test] = &[
48
58
// Only test Stylo a.k.a. Quantum CSS, the parts of Servo going into Firefox.
49
59
// This takes much less time to build than all of Servo and supports stable Rust.
50
60
packages : & [ "selectors" ] ,
61
+ features : None ,
62
+ manifest_path : None ,
63
+ } ,
64
+ Test {
65
+ name : "diesel" ,
66
+ repo : "https://github.com/diesel-rs/diesel" ,
67
+ sha : "91493fe47175076f330ce5fc518f0196c0476f56" ,
68
+ lock : None ,
69
+ packages : & [ ] ,
70
+ // Test the embeded sqlite variant of diesel
71
+ // This does not require any dependency to be present,
72
+ // sqlite will be compiled as part of the build process
73
+ features : Some ( & [ "sqlite" , "libsqlite3-sys/bundled" ] ) ,
74
+ // We are only interested in testing diesel itself
75
+ // not any other crate present in the diesel workspace
76
+ // (This is required to set the feature flags above)
77
+ manifest_path : Some ( "diesel/Cargo.toml" ) ,
51
78
} ,
52
79
] ;
53
80
@@ -68,7 +95,7 @@ fn test_repo(cargo: &Path, out_dir: &Path, test: &Test) {
68
95
if let Some ( lockfile) = test. lock {
69
96
fs:: write ( & dir. join ( "Cargo.lock" ) , lockfile) . unwrap ( ) ;
70
97
}
71
- if !run_cargo_test ( cargo, & dir, test. packages ) {
98
+ if !run_cargo_test ( cargo, & dir, test. packages , test . features , test . manifest_path ) {
72
99
panic ! ( "tests failed for {}" , test. repo) ;
73
100
}
74
101
}
@@ -120,12 +147,31 @@ fn clone_repo(test: &Test, out_dir: &Path) -> PathBuf {
120
147
out_dir
121
148
}
122
149
123
- fn run_cargo_test ( cargo_path : & Path , crate_path : & Path , packages : & [ & str ] ) -> bool {
150
+ fn run_cargo_test (
151
+ cargo_path : & Path ,
152
+ crate_path : & Path ,
153
+ packages : & [ & str ] ,
154
+ features : Option < & [ & str ] > ,
155
+ manifest_path : Option < & str > ,
156
+ ) -> bool {
124
157
let mut command = Command :: new ( cargo_path) ;
125
158
command. arg ( "test" ) ;
159
+
160
+ if let Some ( path) = manifest_path {
161
+ command. arg ( format ! ( "--manifest-path={}" , path) ) ;
162
+ }
163
+
164
+ if let Some ( features) = features {
165
+ command. arg ( "--no-default-features" ) ;
166
+ for feature in features {
167
+ command. arg ( format ! ( "--features={}" , feature) ) ;
168
+ }
169
+ }
170
+
126
171
for name in packages {
127
172
command. arg ( "-p" ) . arg ( name) ;
128
173
}
174
+
129
175
let status = command
130
176
// Disable rust-lang/cargo's cross-compile tests
131
177
. env ( "CFG_DISABLE_CROSS_TESTS" , "1" )
0 commit comments