Skip to content

Commit ea6580d

Browse files
committed
Fix cross-platform plugin test prerequisites and repository paths
Canonicalize the repository root before relative path calculation on Windows. Treat Wasmtime disk caching as optional when the cache directory is unavailable. Install the WASI target for coverage integration tests. AI-assisted by Codex.
1 parent 829f1b8 commit ea6580d

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

‎.github/workflows/coverage.yml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ jobs:
1010
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
1111

1212
- name: Install Rust
13-
run: rustup toolchain install stable --component llvm-tools-preview
13+
run: rustup toolchain install stable --component llvm-tools-preview --target wasm32-wasip2
1414
- name: Install cargo-llvm-cov
1515
uses: taiki-e/install-action@ff869c26e4a7acc3087d9d6c1163a80d3957bca7 # cargo-llvm-cov
1616

17+
# WASI guests cannot use the host LLVM coverage runtime.
18+
- name: Build WASM plugins
19+
run: cargo +stable xtask build-plugins
20+
1721
- name: Generate code coverage
22+
env:
23+
DIFFR_PLUGINS_BUILT: "1"
1824
run: cargo +stable llvm-cov --all-features --workspace --lcov --output-path lcov.info
1925
- name: Upload coverage to Codecov
2026
uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5

‎src/cli.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,9 @@ fn select(
223223
}
224224
}
225225
paths.extend(explicit_paths);
226-
let prefix = location.strip_prefix(repo.workdir().unwrap_or(repo.path()))?;
226+
// Match canonical path forms, including Windows verbatim path prefixes.
227+
let root = std::fs::canonicalize(repo.workdir().unwrap_or(repo.path()))?;
228+
let prefix = location.strip_prefix(&root)?;
227229
let paths = paths
228230
.into_iter()
229231
.map(|path| normalize_path(prefix, &path))

‎src/plugin/wasm.rs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ use bindings::diffr::plugin::{host, types};
4747
pub(crate) fn engine() -> anyhow::Result<Engine> {
4848
let mut config = Config::new();
4949
config.wasm_component_model(true);
50-
config.cache(Some(
51-
Cache::new(CacheConfig::new()).context("wasmtime's compilation cache")?,
52-
));
50+
// The disk cache is an optimization; read-only homes must still run plugins.
51+
if let Ok(cache) = Cache::new(CacheConfig::new()) {
52+
config.cache(Some(cache));
53+
}
5354
Engine::new(&config)
5455
}
5556

0 commit comments

Comments
 (0)