Skip to content

Commit f8b4cf9

Browse files
committed
Remove coverage for now
1 parent c4faa32 commit f8b4cf9

File tree

4 files changed

+2
-151
lines changed

4 files changed

+2
-151
lines changed

.github/workflows/coverage.yml

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- main
88

99
jobs:
10-
coverage-linux:
10+
coverage:
1111
runs-on: ubuntu-latest
1212
env:
1313
CARGO_TERM_COLOR: always
@@ -46,38 +46,4 @@ jobs:
4646
with:
4747
token: ${{ secrets.CODECOV_TOKEN }}
4848
files: lcov.info
49-
flags: linux
50-
fail_ci_if_error: true
51-
52-
coverage-windows:
53-
runs-on: windows-latest
54-
env:
55-
CARGO_TERM_COLOR: always
56-
CARGO_INCREMENTAL: 0
57-
steps:
58-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
59-
- name: Install Rust
60-
run: rustup install nightly-2024-12-16 && rustup default nightly-2024-12-16
61-
- name: Install cargo-llvm-cov
62-
uses: taiki-e/install-action@2c41309d51ede152b6f2ee6bf3b71e6dc9a8b7df # 2.49.27
63-
with:
64-
65-
- name: Cache [rust]
66-
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1
67-
with:
68-
cache-targets: true
69-
cache-bin: true
70-
- name: Generate code coverage for Windows tests
71-
shell: bash
72-
run: |
73-
cargo llvm-cov --all-features --workspace --no-report nextest
74-
cargo llvm-cov --all-features --workspace --no-report --doc
75-
cargo llvm-cov report --doctests --lcov --output-path lcov-windows.info
76-
cargo clean
77-
- name: Upload Windows coverage to Codecov
78-
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # 5.5.1
79-
with:
80-
token: ${{ secrets.CODECOV_TOKEN }}
81-
files: lcov-windows.info
82-
flags: windows
8349
fail_ci_if_error: true

bin_tests/doc/WINDOWS_BIN_TESTS_ARCHITECTURE.md

Lines changed: 1 addition & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,7 @@ Following WER's architecture, crash handling occurs in a separate process. This
2222
- Ability to use full system APIs in the handler
2323
- Realistic testing of production crash handling flow
2424

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**
3226
While implementation differs fundamentally, the testing API mirrors the Unix bin_tests structure to maintain consistency across platforms.
3327

3428
## Architectural Components
@@ -124,29 +118,6 @@ This approach mimics real WER behavior where the out-of-process handler reads cr
124118
- Support timeouts for fault tolerance
125119
- Atomic signaling with no race conditions
126120

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`
139-
- Spawned crash binary: `cargo-test-1001-def.profraw`
140-
- WER simulator: `cargo-test-1002-ghi.profraw`
141-
142-
**Workflow Integration**:
143-
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-
150121
## Testing Workflow
151122

152123
### Standard Windows Test Flow
@@ -192,31 +163,6 @@ Separate Windows coverage job runs in parallel with Linux:
192163
- Remove temporary files
193164
- Clean up registry keys (if applicable)
194165

195-
### Parallel Coverage Collection Flow
196-
197-
**Coverage CI Workflow**:
198-
```
199-
coverage-linux (ubuntu-latest)
200-
├─ Build with instrumentation
201-
├─ Run Unix bin_tests
202-
├─ Spawned processes write profraw files
203-
├─ Generate lcov.info
204-
└─ Upload to Codecov (flag: linux)
205-
206-
coverage-windows (windows-latest)
207-
├─ Build with instrumentation
208-
├─ Run Windows bin_tests
209-
├─ Spawned processes write profraw files
210-
├─ WER simulator writes profraw file
211-
├─ Generate lcov-windows.info
212-
└─ Upload to Codecov (flag: windows)
213-
214-
Codecov Server:
215-
├─ Receives both uploads (same commit SHA)
216-
├─ Merges line-by-line coverage
217-
└─ Presents unified report
218-
```
219-
220166
## Design Trade-offs
221167

222168
### Process Isolation vs Simplicity
@@ -309,10 +255,6 @@ Codecov Server:
309255
- Unix: Simpler synchronization, immediate results
310256
- Windows: Complex synchronization, asynchronous validation
311257

312-
**Coverage Collection**:
313-
- Unix: Main process + receiver process profraw files
314-
- Windows: Main process + crash binary + WER simulator profraw files
315-
316258
### Implications for Test Design
317259

318260
**Test Timing**:
@@ -451,23 +393,12 @@ When tests fail, they should:
451393

452394
**Implementation**: Rich error types, verbose logging, debug files written to temp directories.
453395

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-
464396
## Conclusion
465397

466398
The Windows bin_tests architecture balances several competing concerns:
467399
- **Realism**: Match production WER behavior as closely as possible
468400
- **Testability**: Enable testing without WER service in CI
469401
- **Safety**: Handle crashes in separate process like real WER
470-
- **Observability**: Collect coverage from all spawned processes
471402
- **Maintainability**: Clear abstractions and extension points
472403

473404
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.

bin_tests/src/lib.rs

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -195,43 +195,3 @@ macro_rules! timeit {
195195
res
196196
}};
197197
}
198-
199-
/// Propagates coverage environment variables to spawned processes.
200-
///
201-
/// This function enables coverage collection from integration tests that spawn separate
202-
/// processes (like bin_tests spawning crashtracker_bin_test). It propagates the
203-
/// `LLVM_PROFILE_FILE` environment variable which contains patterns like `%p` (process ID)
204-
/// that the LLVM profiling runtime expands at runtime, ensuring each process writes to a
205-
/// unique coverage file.
206-
///
207-
/// # How It Works
208-
///
209-
/// 1. Parent propagates the pattern: `LLVM_PROFILE_FILE="path/cargo-test-%p-%m.profraw"`
210-
/// 2. Each process expands at runtime: Parent PID 1000 → `cargo-test-1000-abc.profraw`
211-
/// 3. Coverage report merges all `.profraw` files
212-
///
213-
/// # Platform Support
214-
///
215-
/// - **Unix/Linux**: Fully supported, used in CI coverage collection
216-
/// - **Windows**: Fully supported, enables Windows bin_tests coverage
217-
///
218-
/// # Arguments
219-
/// * `cmd` - The Command to add environment variables to (before spawning)
220-
///
221-
/// # Example
222-
/// ```no_run
223-
/// use bin_tests::propagate_coverage_env;
224-
/// use std::process::Command;
225-
///
226-
/// let mut cmd = Command::new("path/to/test_binary");
227-
/// propagate_coverage_env(&mut cmd);
228-
/// let child = cmd.spawn().expect("Failed to spawn");
229-
/// ```
230-
pub fn propagate_coverage_env(cmd: &mut process::Command) {
231-
// LLVM_PROFILE_FILE tells the instrumented binary where to write coverage data.
232-
// The LLVM profiling runtime expands patterns like %p (PID) and %m (module signature)
233-
// at runtime to ensure each spawned process writes to a unique file.
234-
if let Ok(profile_file) = env::var("LLVM_PROFILE_FILE") {
235-
cmd.env("LLVM_PROFILE_FILE", profile_file);
236-
}
237-
}

bin_tests/src/test_runner_windows.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,6 @@ where
275275
.arg(&crash_ready_event_name)
276276
.arg(&info_file);
277277

278-
// Pass coverage-related environment variables to spawned processes
279-
crate::propagate_coverage_env(&mut cmd);
280-
281278
eprintln!(
282279
"[TEST_RUNNER] Spawning crash binary: {}",
283280
binary_path.display()
@@ -351,9 +348,6 @@ where
351348
.arg(&simulator_ready_event_name)
352349
.arg(&fixtures.output_dir); // Pass output directory for debug files
353350

354-
// Pass coverage-related environment variables to spawned WER simulator
355-
crate::propagate_coverage_env(&mut simulator_cmd);
356-
357351
let simulator_process = simulator_cmd
358352
.spawn()
359353
.context("Failed to spawn WER simulator")?;

0 commit comments

Comments
 (0)