Commit 8c9e53a
Fix compiletest's
compiletests lets you specify one or more target architectures. E.g. on
CI we run this:
```
cargo run -p compiletests --release --no-default-features -- \
--target-arch compute_61,compute_70,compute_90
```
While trying out various different target architectures, including
invalid ones, I get strange results.
First, if the target arch has fewer than 8 chars (e.g. `--target-arch
blah`), then nvvm panics:
```
thread 'rustc' panicked at crates/nvvm/src/lib.rs:246:38: byte
index 8 is out of bounds of `blah`
```
Second, if the target arch has 8 or more chars but is invalid, it is
just ignored. This means invalid flags like `--target-arch compute_999`
run, but just use the default target architecture.
This commit fixes the problems.
- Fix the slicing into the `-arch=` option to avoid the bounds panic.
- In `CodegenArgs::parse`, check for the `Err` case and panic instead of
swallowing it. A panic isn't ideal, but it's much better than silently
accepting and ignoring invalid input.
- Use a `String` instead of `&'static str` for the `Err` case, so the
error message is more informative, i.e. it includes the bad flag
value.
Also, the commit improves the `NvvmOption::from_str` test.
- Move inputs next to expected outputs, which makes it easier to
read and update.
- Add the missing compute capabilities.
- Add some checks for invalid inputs.--target-arch handling.1 parent a459452 commit 8c9e53a
2 files changed
+70
-65
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
| 195 | + | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | | - | |
| 206 | + | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
| 217 | + | |
218 | 218 | | |
219 | | - | |
| 219 | + | |
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
| 228 | + | |
229 | 229 | | |
230 | | - | |
| 230 | + | |
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
| 239 | + | |
240 | 240 | | |
241 | | - | |
| 241 | + | |
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
246 | 249 | | |
247 | 250 | | |
248 | 251 | | |
| |||
277 | 280 | | |
278 | 281 | | |
279 | 282 | | |
280 | | - | |
| 283 | + | |
281 | 284 | | |
282 | 285 | | |
283 | 286 | | |
284 | | - | |
| 287 | + | |
285 | 288 | | |
286 | 289 | | |
287 | 290 | | |
| |||
1013 | 1016 | | |
1014 | 1017 | | |
1015 | 1018 | | |
1016 | | - | |
1017 | | - | |
1018 | | - | |
1019 | | - | |
1020 | | - | |
1021 | | - | |
1022 | | - | |
1023 | | - | |
1024 | | - | |
1025 | | - | |
1026 | | - | |
1027 | | - | |
1028 | | - | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
1036 | | - | |
1037 | | - | |
1038 | | - | |
1039 | | - | |
1040 | | - | |
1041 | | - | |
1042 | | - | |
1043 | | - | |
1044 | | - | |
1045 | | - | |
1046 | | - | |
1047 | | - | |
1048 | | - | |
1049 | | - | |
1050 | | - | |
1051 | | - | |
1052 | | - | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
1056 | | - | |
1057 | | - | |
1058 | | - | |
1059 | | - | |
1060 | | - | |
1061 | | - | |
1062 | | - | |
1063 | | - | |
1064 | | - | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
1065 | 1066 | | |
1066 | 1067 | | |
1067 | 1068 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
673 | 673 | | |
674 | 674 | | |
675 | 675 | | |
676 | | - | |
677 | | - | |
678 | | - | |
| 676 | + | |
679 | 677 | | |
680 | 678 | | |
681 | 679 | | |
| |||
714 | 712 | | |
715 | 713 | | |
716 | 714 | | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
717 | 721 | | |
718 | 722 | | |
719 | 723 | | |
| |||
0 commit comments