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
//! Scaffolding the suite shares, and nothing production reads. Compiled only
//! under `cfg(test)`.
//!
//! Two things live here that live nowhere else in the crate, and both are
//! deliberate:
//!
//! - **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 ;
/// 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
/// 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