1
2
3
4
5
6
7
8
9
10
11
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
//! Scaffolding the suite shares, and nothing production reads. Compiled only
//! under `cfg(test)`.
//!
//! Three things live here that live nowhere else in the crate, and all three
//! are deliberate:
//!
//! - **The notice sink** ([`Notices`]) and **the pause sink** ([`Waits`]). A
//! serving foot says things without ending anything — that it was disarmed
//! while a tool ran (DESIGN §3.7), that a channel dropped and is about to be
//! dialled again (DESIGN §3.8) — and it sleeps between those dials. Writing
//! to stderr and sleeping are both effects no test can read back, so both
//! live in `src/main.rs` and the suite hands channels recorders instead. The
//! pause recorder is also the only way to assert that a loop waited the
//! *right* amount rather than merely that it waited.
//!
//! - **The fork lock** the spawn boundary takes ([`fork_lock`]). It is the
//! `Mutex` the lock-confinement rule would otherwise send to `src/state.rs`,
//! and the rule's own text says why it does not: a test's serialization lock
//! is scaffolding, and folding it into the chokepoint would put test
//! machinery in the file that inventories the program.
//! - **The certificate mint** ([`mint`]). thrall mints nothing (REMOTE §1.4,
//! DESIGN §3.3) — the operator carries a pair to the box by hand — so the
//! suite has to perform that act on the operator's behalf before it can test
//! a channel at all. It is `cfg(test)`, it shells to the tool an operator
//! would use, and **no certificate is ever committed**: a fixture key in a
//! tree is a private key in a repository, which is the exact class
//! `make leak-scan` refuses.
use ;
use ;
use ;
use ;
use Duration;
/// The stand-in for the far end of the wire.
pub
/// The operator's out-of-channel act, performed by the suite.
pub
/// The binary-wide fork lock. See [`crate::spawn::output`] for the ETXTBSY
/// race it closes and why the discipline belongs at the fork rather than at the
/// write.
static FORK: = new;
/// Take the fork lock. Poisoning is ignored on purpose: a panicking test tells
/// us about that test, and a poisoned lock that refused every later fork would
/// turn one failure into a suite.
pub
/// **The notice sink, recording.** A serving foot writes what it has to say
/// mid-channel to stderr (`src/main.rs`), which no test can read back — so the
/// suite hands it this instead and reads the sentences as values.
///
/// One sink for the whole suite rather than one per test module, because an
/// empty closure written in five files is five code locations the coverage
/// floor then owes a caller apiece.
pub ;
/// One notice, kept.
///
/// The line is owned before the lock is taken rather than inside the `push`,
/// which is the shape [`engine`]'s recorder already uses: a temporary built
/// inside the locked call earns a drop region llvm-cov reports uncovered on
/// however many times the line runs.
/// **The pause sink, recording.** A foot's wait between dials is a real sleep
/// (`src/main.rs`), so the suite hands it this instead and reads back the
/// durations the redial *decided* on — which is the assertion that matters,
/// and the reason the whole suite proves a minute-long backoff in no time at
/// all.
///
/// **It is a channel where [`Notices`] is a `Mutex`, and that is a coverage
/// fact rather than a taste.** A `MutexGuard` dropped at the end of a
/// statement earns a cleanup region llvm-cov reports uncovered however often
/// the function runs, unless the enclosing function has some other value to
/// drop at its closing brace for the region to land on. [`record`] has one —
/// the `String` it owns first — and a duration recorder cannot, `Duration`
/// being `Copy`. Measured twice, at 831/832. A `Sender` has nothing to drop
/// per send, so the hazard is dissolved rather than dodged.
pub ;
/// One wait, kept. A free function for [`record`]'s reason: a braced closure
/// body earns a region llvm-cov reports uncovered however often it runs.
///
/// The send's failure is ignored because [`unwaited`] is exactly the case that
/// produces it — the recorder is dropped and only the pause is kept — and a
/// test that kept no recorder is a test asking for no waits.
/// A pause for a test whose subject is not how long the foot waited. It is
/// [`aside`]'s twin, and never sleeps.
pub
/// A sink for a test whose subject is not what the channel said. It records
/// into a recorder nobody reads, which is cheaper than a second empty closure:
/// an unread `Notices` is one code location the coverage floor already owes a
/// caller, and five hand-written `|_| {}` sinks would be five more.
pub
/// How many scratch directories this process has minted, so two tests running
/// at once never name one directory.
static NEXT: AtomicUsize = new;
/// A throwaway directory, removed when it drops.
///
/// Hand-rolled rather than a crate, because the dependency set is closed
/// (`Cargo.toml`'s approval comment): a scratch directory is a `create_dir_all`
/// and a `remove_dir_all`, and a test-only crate is still a crate in the
/// lockfile, the licence audit and the supply chain.
pub