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
//! Shared helpers for tests that must run in an isolated subprocess.
//!
//! Some tests have process-wide side effects — redirecting std fds, closing
//! inherited fds, forking — that corrupt the shared test harness or clobber
//! file descriptors held by tests running in parallel. Such a test is marked
//! `#[ignore]` (so it never runs in the normal pass) and paired with a wrapper
//! that re-invokes the test binary for just that one test via
//! [`run_in_subprocess`]. The body guards on [`is_subprocess`] so it executes
//! only when spawned this way.
use Command;
/// Environment variable set in the spawned subprocess so the `#[ignore]` test
/// body knows it is running in isolation (see [`is_subprocess`]).
const SUBPROCESS_ENV: &str = "__BLIVET_SUBPROCESS_TEST";
/// Returns `true` when running inside a subprocess spawned by
/// [`run_in_subprocess`].
pub
/// Re-invokes the test binary to run a single `#[ignore]` test in its own
/// process, then asserts it succeeded.
///
/// `--include-ignored` is required: without it the named `#[ignore]` test is
/// skipped, the subprocess exits 0, and this helper passes *vacuously* without
/// ever running the test body.
pub