You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: bin_tests/doc/WINDOWS_BIN_TESTS_ARCHITECTURE.md
+1-70Lines changed: 1 addition & 70 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,13 +22,7 @@ Following WER's architecture, crash handling occurs in a separate process. This
22
22
- Ability to use full system APIs in the handler
23
23
- Realistic testing of production crash handling flow
24
24
25
-
**3. Coverage Collection Support**
26
-
The architecture is designed from the ground up to support code coverage collection through:
27
-
- Environment variable propagation to spawned processes
28
-
- Multiple process profraw file generation
29
-
- Integration with cargo-llvm-cov workflow
30
-
31
-
**4. Platform Parity with Unix Tests**
25
+
**3. Platform Parity with Unix Tests**
32
26
While implementation differs fundamentally, the testing API mirrors the Unix bin_tests structure to maintain consistency across platforms.
33
27
34
28
## Architectural Components
@@ -124,29 +118,6 @@ This approach mimics real WER behavior where the out-of-process handler reads cr
124
118
- Support timeouts for fault tolerance
125
119
- Atomic signaling with no race conditions
126
120
127
-
### 5. Coverage Collection Architecture
128
-
129
-
**Challenge**: Coverage from spawned processes must contribute to overall coverage report.
130
-
131
-
**Solution Strategy**:
132
-
133
-
**Build-Time Instrumentation**:
134
-
When `cargo llvm-cov` builds test binaries, it sets `RUSTFLAGS` with `-C instrument-coverage`. The build system propagates these flags to spawned `cargo build` commands to ensure all test binaries are instrumented.
135
-
136
-
**Runtime Coverage Propagation**:
137
-
The `LLVM_PROFILE_FILE` environment variable contains patterns like `%p` (process ID) that are expanded by each process at runtime:
138
-
- Main test process: `cargo-test-1000-abc.profraw`
Separate Windows coverage job runs in parallel with Linux:
144
-
- Both upload coverage to Codecov
145
-
- Codecov merges reports based on commit SHA
146
-
- Flags allow filtering by platform
147
-
148
-
**Design Rationale**: This approach requires no code changes in test binaries—coverage "just works" when environment variables are propagated correctly.
149
-
150
121
## Testing Workflow
151
122
152
123
### Standard Windows Test Flow
@@ -192,31 +163,6 @@ Separate Windows coverage job runs in parallel with Linux:
- Unix: Main process + receiver process profraw files
314
-
- Windows: Main process + crash binary + WER simulator profraw files
315
-
316
258
### Implications for Test Design
317
259
318
260
**Test Timing**:
@@ -451,23 +393,12 @@ When tests fail, they should:
451
393
452
394
**Implementation**: Rich error types, verbose logging, debug files written to temp directories.
453
395
454
-
### Coverage as First-Class Concern
455
-
456
-
Test infrastructure considers coverage collection from the start:
457
-
- Environment variable propagation built-in
458
-
- Multiple process profraw files expected
459
-
- CI workflow includes coverage verification
460
-
- Documentation explains coverage architecture
461
-
462
-
**Rationale**: Without coverage, we can't know what the tests actually exercise.
463
-
464
396
## Conclusion
465
397
466
398
The Windows bin_tests architecture balances several competing concerns:
467
399
-**Realism**: Match production WER behavior as closely as possible
468
400
-**Testability**: Enable testing without WER service in CI
469
401
-**Safety**: Handle crashes in separate process like real WER
470
-
-**Observability**: Collect coverage from all spawned processes
471
402
-**Maintainability**: Clear abstractions and extension points
472
403
473
404
The result is a comprehensive testing framework that validates Windows crash tracking in realistic scenarios while supporting both local development and CI environments. The architecture's flexibility allows future extension while maintaining strong type safety and clear separation of concerns.
0 commit comments