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
#![cfg(feature = "test-support")]
use std::process::Command;
use std::sync::atomic::{AtomicBool, Ordering};
use crate::core::mark_initialized;
static TEST_MODE: AtomicBool = AtomicBool::new(false);
#[macro_export]
macro_rules! enable_test_support {
() => {
#[ctor::ctor]
#[used]
fn __procspawn_test_support_init() {
$crate::testsupport::enable();
}
#[test]
fn procspawn_test_helper() {
$crate::init();
}
};
}
pub fn enable() {
TEST_MODE.store(true, Ordering::SeqCst);
mark_initialized();
}
pub fn update_command_for_tests(cmd: &mut Command) {
if TEST_MODE.load(Ordering::SeqCst) {
cmd.arg("procspawn_test_helper");
cmd.arg("--exact");
cmd.arg("--test-threads=1");
cmd.arg("-q");
}
}