Commit c635ea3
committed
Record issues generated within exit tests.
This PR introduces a "back channel" file handle to exit tests, allowing us to
record issues that occur within exit test bodies. For example:
```swift
await #expect(exitsWith: .failure) {
let context = try #require(possiblyMissingContext)
...
}
```
In this example, if the call to `try #require()` finds `nil`, it will record an
issue, but that issue today will be lost because there's no mechanism to forward
the issue back to the parent process hosting the exit test. This PR fixes that!
Issues are converted to JSON using the same schema we use for event handling,
then written over a pipe back to the parent process where they are decoded. This
decoding is lossy, so there will be further refinement needed here to try to
preserve more information about the recorded issues. That said, "it's got good
bones" right?
On Darwin, Linux, and FreeBSD, the pipe's write end is allowed to survive into
the child process (i.e. no `FD_CLOEXEC`). On Windows, the equivalent is to tell
`CreateProcessW()` to explicitly inherit a `HANDLE`. The identity of this file
descriptor or handle is passed to the child process via environment variable.
The child process then parses the file descriptor or handle out of the
environment and converts it back to a `FileHandle` that is then connected to an
instance of `Configuration` with an event handler set, and off we go.
Because we can now report these issues back to the parent process, I've removed
the compile-time diagnostic in the `#expect(exitsWith:)` macro implementation
that we emit when we see a nested `#expect()` or `#require()` call.1 parent 4e7dd97 commit c635ea3
File tree
14 files changed
+493
-170
lines changed- Sources
- TestingMacros
- Testing
- ABI
- EntryPoints
- v0
- ExitTests
- Support/Additions
- _TestingInternals
- include
- Tests
- TestingMacrosTests
- TestingTests
14 files changed
+493
-170
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
471 | | - | |
472 | | - | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
473 | 476 | | |
474 | 477 | | |
475 | 478 | | |
| |||
536 | 539 | | |
537 | 540 | | |
538 | 541 | | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
539 | 545 | | |
540 | 546 | | |
541 | 547 | | |
542 | 548 | | |
543 | 549 | | |
544 | 550 | | |
545 | | - | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
546 | 556 | | |
547 | 557 | | |
548 | 558 | | |
| |||
551 | 561 | | |
552 | 562 | | |
553 | 563 | | |
554 | | - | |
| 564 | + | |
555 | 565 | | |
556 | 566 | | |
557 | 567 | | |
558 | 568 | | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
600 | | - | |
601 | | - | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | 569 | | |
606 | 570 | | |
607 | 571 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
13 | 46 | | |
14 | 47 | | |
15 | 48 | | |
16 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
17 | 53 | | |
18 | 54 | | |
19 | 55 | | |
| |||
27 | 63 | | |
28 | 64 | | |
29 | 65 | | |
| 66 | + | |
30 | 67 | | |
31 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
32 | 75 | | |
33 | | - | |
| 76 | + | |
34 | 77 | | |
35 | 78 | | |
36 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
69 | 95 | | |
70 | 96 | | |
71 | 97 | | |
| |||
76 | 102 | | |
77 | 103 | | |
78 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
79 | 124 | | |
80 | | - | |
| 125 | + | |
81 | 126 | | |
82 | 127 | | |
83 | 128 | | |
| |||
342 | 387 | | |
343 | 388 | | |
344 | 389 | | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
350 | 493 | | |
351 | 494 | | |
352 | 495 | | |
| |||
0 commit comments