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
feat: add code coverage support using native-simulator
- Add ctor dependency and coverage_flush module to native-simulator template
- Add coverage targets to workspace Makefile (coverage, coverage-html, coverage-lcov)
- Add coverage documentation to README.md
- Add coverage test step to CI workflow (ubuntu-latest only, not ARM)
Note: Only contract template supports native-simulator feature, and coverage
only runs on x86_64 (ubuntu-latest) as native-simulator doesn't support ARM.
Copy file name to clipboardExpand all lines: README.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -255,3 +255,21 @@ make generate-native-simulator CRATE=example_crate
255
255
256
256
- The `CRATE` parameter must refer to a subproject.
257
257
- Missing subprojects will cause the command to fail.
258
+
259
+
### Code Coverage
260
+
261
+
The templates include built-in support for code coverage reporting using LLVM's coverage tools.
262
+
263
+
**Prerequisites:**
264
+
```bash
265
+
make coverage-install
266
+
```
267
+
268
+
**Generate Reports:**
269
+
```bash
270
+
make coverage # Text report to console
271
+
make coverage-html # HTML report in target/coverage/html/
272
+
make coverage-lcov # LCOV format for CI integration
273
+
```
274
+
275
+
Coverage works by running tests with the `native-simulator` feature, which executes contract code natively on x86_64 instead of in CKB-VM. This allows LLVM's coverage instrumentation to track which lines of code are executed.
0 commit comments