Commit bccb9bb
committed
Auto merge of rust-lang#120881 - jieyouxu:migrate-ui-test-directives, r=oli-obk
Migrate ui tests from legacy compiletest-style directives `//` to `ui_test`-style directives `//@`
## Preface
There's an on-going effort to rewrite parts of or the entirety of compiletest
(<rust-lang/compiler-team#536>). A step towards this involve migrating
ui tests to use the [`ui_test`](https://github.com/oli-obk/ui_test) framework, which involves
changing compiletest directives in `// <directive-name>` style to `ui_test` `//@ <directive-name>`
style (rust-lang/compiler-team#512).
This PR aims to implement the directive-style change from `//` to `//`@`` for ui tests only and
make compiletest only accept `//`@`` directives in the "ui" test suite (only).
## Key Changes
1. All ui test `//` directives are replaced by `//`@`` directives.
2. Only accept `//`@`` directives for "ui" test suite.
3. Errors if a comment could be interpreted as a legacy-style `//` directive.
## Diff Generation
The diff is generated by:
- Collecting directives from ui tests via hacking on compiletest.
- Using a migration tool to replace `//` directives in ui tests with `//`@`.`
### Reproduction Steps
0. Delete the temporary directory `$RUSTC_REPO_PATH/build/x86_64-apple-darwin/test/ui/__directive_lines` and the temporary file `$RUSTC_REPO_PATH/build/x86_64-apple-darwin/test/ui/__directive_lines.txt` (if you ran the collection script before).
1. Use the <https://github.com/jieyouxu/rust/tree/collect-test-directives> collect-test-directives
script, which outputs temporary files recording headers occuring in each ui test.
- You need to checkout this branch: `git checkout collect-test-directives`.
- You might need to rebase on lastest master and ensure there are no conflicts.
- You likely need to run `./x test tests/ui --stage 1 --force-rerun` to generate the temporary
files consistently.
2. Checkout the `migrate-ui-test-directives` branch.
4. Run the migration tool <https://github.com/jieyouxu/compiletest-ui_test-header-migration>.
- You will need to first generate a `migration_config.toml` via `cargo run -- generate-config` under `$CWD`.
- Then, update `manual_directives = ["// should-fail"]` in `migration_config.toml`. This is required because the collection script doesn't deal with some special meta ui tests and there are no other `// should-fail` occurrences.
5. Check that the migration at least does not cause UI test failures if you change compiletest to
accept `//`@`` directives for ui tests only.
- `RUSTC_TEST_FAIL_FAST=1 ./x test tests/ui --stage 1 --bless`
6. Confirm that there is no difference after running the migration tool when you are on the
`migrate-ui-test-directives` branch.
## Next Steps
- [x] ~~Need to implement some kind of warning or tidy script to help contributors catch old-style
`// <directive-name>` directives, while only accepting `ui_test`-style `//@ <directive-name>`
directives.~~ An error is emitted if a comment that could be interpreted as legacy-style test directive is encountered.
- [ ] Need to properly document this change in e.g. rustc-dev-guide (rust-lang/rustc-dev-guide#1885).
- [x] Add a `README.md` to `tests/ui` describing the directive style change.File tree
9,930 files changed
+17008
-16703
lines changed- src/tools
- compiletest/src
- header
- tidy/src
- tests/ui
- abi
- cross-crate
- extern
- foreign
- issues
- mir
- numbers-arithmetic
- statics
- struct-enums
- union
- alloc-error
- allocator
- auxiliary
- annotate-snippet
- auxiliary
- anon-params
- auxiliary
- argument-suggestions
- array-slice-vec
- asm
- aarch64
- x86_64
- associated-consts
- associated-inherent-types
- bugs
- associated-item
- associated-type-bounds
- return-type-notation
- associated-types
- cache
- async-await
- async-closures
- auxiliary
- async-fn
- auxiliary
- await-keyword
- drop-order
- auxiliary
- future-sizes
- in-trait
- auxiliary
- issues
- auxiliary
- issue-65419
- multiple-lifetimes
- return-type-notation
- track-caller
- attributes
- auxiliary
- main-removed-2
- auxiliary
- unix_sigpipe
- auto-traits
- autoref-autoderef
- auxiliary
- bench
- binding
- binop
- block-result
- borrowck
- alias-liveness
- box
- unit
- btreemap
- builtin-superkinds
- c-variadic
- cast
- cfg
- assume-incomplete-release
- auxiliary
- auxiliary
- check-cfg
- closure-expected-type
- closures
- 2229_closure_analysis
- diagnostics
- borrowck
- match
- migrations
- optimization
- run_pass
- binder
- print
- cmse-nonsecure
- cmse-nonsecure-call
- cmse-nonsecure-entry
- codegen
- codemap_tests
- coercion
- coherence
- occurs-check
- coinduction
- command
- compiletest-self-test
- conditional-compilation
- const-generics
- adt_const_params
- array-impls
- auxiliary
- backcompat
- defaults
- early
- generic_arg_infer
- generic_const_exprs
- assoc_const_unification
- const_kind_expr
- issues
- late-bound-vars
- min_const_generics
- occurs-check
- std
- type-dependent
- const-ptr
- const_prop
- consts
- const-blocks
- const-eval
- heap
- simd
- stable-metric
- const-extern-fn
- const-mut-refs
- const_constructor
- const_in_pattern
- control-flow
- extra-const-ub
- min_const_fn
- miri_unleashed
- std
- coroutine
- auxiliary
- print
- crate-loading
- auxiliary
- cross-crate
- issue-64872
- auxiliary
- cross
- cross-crate-macro-backtrace
- cross-file-errors
- custom_test_frameworks
- debuginfo
- definition-reachable
- delegation
- dep-graph
- deployment-target
- deprecation
- deref-patterns
- derives
- auxiliary
- deriving
- auxiliary
- dest-prop
- destructuring-assignment
- diagnostic-flags
- diagnostic-width
- diagnostic_namespace
- auxiliary
- on_unimplemented
- did_you_mean
- directory_ownership
- macro_expanded_mod_helper/foo
- disallowed-deconstructing
- drop-bounds
- dropck
- drop
- duplicate
- dyn-keyword
- dyn-star
- dynamically-sized-types
- editions
- auxiliary
- empty
- entry-point
- enum-discriminant
- enum
- error-codes
- auxiliary
- e0119
- error-emitter
- errors
- auxiliary
- explicit-tail-calls
- explicit
- expr
- compound-assignment
- if
- attrs
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
9,930 files changed
+17008
-16703
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
| 213 | + | |
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
| 221 | + | |
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
237 | | - | |
| 236 | + | |
| 237 | + | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | | - | |
| 248 | + | |
249 | 249 | | |
250 | 250 | | |
251 | | - | |
| 251 | + | |
252 | 252 | | |
253 | 253 | | |
254 | | - | |
| 254 | + | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
| 257 | + | |
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
263 | | - | |
| 263 | + | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
| 266 | + | |
267 | 267 | | |
268 | 268 | | |
269 | | - | |
| 269 | + | |
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
281 | 281 | | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
296 | 296 | | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
308 | | - | |
309 | | - | |
| 308 | + | |
| 309 | + | |
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
315 | | - | |
| 315 | + | |
316 | 316 | | |
317 | 317 | | |
318 | | - | |
| 318 | + | |
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
325 | | - | |
| 325 | + | |
326 | 326 | | |
327 | 327 | | |
328 | | - | |
| 328 | + | |
329 | 329 | | |
330 | 330 | | |
331 | | - | |
| 331 | + | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
| 334 | + | |
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | | - | |
| 340 | + | |
341 | 341 | | |
342 | 342 | | |
343 | | - | |
| 343 | + | |
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
366 | | - | |
| 366 | + | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
| 369 | + | |
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
| |||
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
385 | | - | |
| 385 | + | |
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
393 | | - | |
394 | | - | |
395 | | - | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
396 | 396 | | |
397 | | - | |
398 | | - | |
399 | | - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
400 | 400 | | |
401 | 401 | | |
402 | 402 | | |
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
421 | | - | |
| 421 | + | |
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
| |||
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
435 | | - | |
| 435 | + | |
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
| |||
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
450 | | - | |
| 450 | + | |
451 | 451 | | |
452 | 452 | | |
453 | 453 | | |
| |||
461 | 461 | | |
462 | 462 | | |
463 | 463 | | |
464 | | - | |
| 464 | + | |
465 | 465 | | |
466 | 466 | | |
467 | 467 | | |
| |||
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
478 | | - | |
| 478 | + | |
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
| |||
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
494 | | - | |
| 494 | + | |
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
| |||
506 | 506 | | |
507 | 507 | | |
508 | 508 | | |
509 | | - | |
510 | | - | |
511 | | - | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
512 | 512 | | |
513 | 513 | | |
514 | 514 | | |
| |||
534 | 534 | | |
535 | 535 | | |
536 | 536 | | |
537 | | - | |
| 537 | + | |
538 | 538 | | |
539 | 539 | | |
540 | 540 | | |
| |||
555 | 555 | | |
556 | 556 | | |
557 | 557 | | |
558 | | - | |
559 | | - | |
| 558 | + | |
| 559 | + | |
560 | 560 | | |
561 | 561 | | |
562 | 562 | | |
| |||
566 | 566 | | |
567 | 567 | | |
568 | 568 | | |
| 569 | + | |
569 | 570 | | |
570 | 571 | | |
571 | 572 | | |
572 | | - | |
573 | | - | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
574 | 581 | | |
575 | 582 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
58 | 59 | | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| 65 | + | |
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
| |||
128 | 131 | | |
129 | 132 | | |
130 | 133 | | |
131 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
132 | 143 | | |
133 | 144 | | |
134 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | | - | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
0 commit comments