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
// src/test_support.rs
//
// Tests that touch process-global state -- the working directory, the
// debug/hot-reload statics, and the engine's development flags -- must not run
// concurrently, because Cargo runs a binary's tests in parallel threads within
// one process.
//
// The guard is the workspace's one process-global lock, so a test here writing
// a development flag excludes the engine's own readers of that same flag
// rather than racing them under a second, private lock.
pub
// Exclusive access with the working directory moved into a temp tree, for a
// test that writes a cwd-relative path (the build's `world-lock.json`).
//
// A test takes this *instead of* `lock`, never as well: both are the one
// exclusive guard, and taking it twice on a thread deadlocks.
pub
// What every guard here sets up before taking the lock.
// Anchor both state roots away from the working directory.
//
// The content root is the suite's stable cache root, so a shader that has not
// changed is compiled once for the machine rather than once per test.
//
// The writable root is a subdirectory of it, not the same path, which is what
// `writable_state_dir` falls back to. It holds the editor's session store, the
// saves and the settings -- state, not cache -- and sharing it let a run
// inherit the last one's camera bookmarks. The clear leaves it empty.
pub