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
// src/test_support.rs
//
// Tests that touch process-global state -- the session's open project, 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
// What every guard here sets up before taking the lock.
// Open a project away from the working directory, with the caches on a root of
// their own.
//
// The cache root persists and is shared, so a shader that has not changed is
// compiled once for the machine rather than once per test. The content and
// writable roots are this process's own directory, emptied when it first asks:
// the blobs, the editor's session store, the saves and the settings are state,
// not cache, and a test that inherited them would assert against what another
// left. Per process rather than per machine because the guard below is per
// process, so under a runner that gives each test one -- `cargo nextest` --
// nothing here excludes the test in the process beside it.
pub