Commit 60f5cbe
committed
feat: add env var VM_JOB_QUEUE_SHARED for tests
This adds a kind of turbo-mode for running unit tests.
Normally the job-queue is a shared singleton instance.
When running unit tests, a shared instance has these characteristics:
1. tests must wait for each other's jobs to complete. CPU usage tends to
be low for much of the testing duration.
2. it is possible to run all tests in parallel and generate proofs when
proofs do not exist in local cache or on proof-server.
3. total time for running all tests increases substantially compared to
scenario where each test using its own job-queue instance.
A non-shared instance has these characteristics:
1. tests run independently and use up all CPU cores.
2. it is not possible to run all tests in parallel and generate proofs
as it would exhaust device's resources, especially RAM. This mode
only works well when proofs are already cached. A workaround is to
run with --test-threads 1 to generate proofs.
3. total time for running all tests decrease substantially (assuming
proofs are cached) vs the shared-instance scenario.
When running unit tests, shared mode is the default. The mode can now
be selected at runtime via:
```
VM_JOB_QUEUE_SHARED=false cargo test <args>
VM_JOB_QUEUE_SHARED=true cargo test <args>
```1 parent ca608d4 commit 60f5cbe
1 file changed
+49
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
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 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
43 | 91 | | |
44 | 92 | | |
45 | 93 | | |
| |||
0 commit comments