Skip to content

Commit

Permalink
Emulation code coverage : persist and merge coverage bitmaps (#992)
Browse files Browse the repository at this point in the history
* This commit extends sw-emulator coverage functionality so the coverage bitmap of indiividual test runs can be
dumped to the file system and subsequently merged so the coverage can be calculated.

* misc fixes

* Remove expensive .clone() call.

---------

Co-authored-by: Kor Nielsen <[email protected]>
  • Loading branch information
rusty1968 and korran authored Nov 13, 2023
1 parent 625c206 commit edeb9e2
Show file tree
Hide file tree
Showing 20 changed files with 547 additions and 282 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
SCCACHE_VERSION: 0.3.3
SCCACHE_GHA_CACHE_TO: sccache-caliptra-sw
SCCACHE_GHA_CACHE_FROM: sccache-caliptra-sw
# CPTRA_COVERAGE_PATH: /tmp

# Change this to a new random value if you suspect the cache is corrupted
SCCACHE_C_CUSTOM_CACHE_BUSTER: 8b42a6e70ec4
Expand Down Expand Up @@ -154,6 +155,10 @@ jobs:
run: |
(cd rom/dev && make run)
- name: ROM Coverage
run: |
CPTRA_COVERAGE_PATH=/tmp cargo test --manifest-path ./rom/dev/Cargo.toml && CPTRA_COVERAGE_PATH=/tmp cargo run --manifest-path ./coverage/Cargo.toml
- name: Caliptra HW-Model C Binding Smoke Test
run: |
git submodule update --init
Expand All @@ -165,3 +170,4 @@ jobs:
- name: DPE Verification Tests
run: |
(cd test/dpe_verification && make run)
19 changes: 19 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ members = [
"ci-tools/file-header-fix",
"ci-tools/size-history",
"common",
"coverage",
"cpu",
"drivers",
"drivers/test-fw",
Expand Down Expand Up @@ -88,6 +89,7 @@ caliptra-api = { path = "api" }
caliptra-cfi-lib = { path = "cfi/lib", default-features = false, features = ["cfi", "cfi-counter" ] }
caliptra-cfi-derive = { path = "cfi/derive" }
caliptra_common = { path = "common", default-features = false }
caliptra-coverage = { path = "coverage" }
caliptra-builder = { path = "builder" }
caliptra-cpu = { path = "cpu" }
caliptra-drivers = { path = "drivers" }
Expand Down
18 changes: 18 additions & 0 deletions coverage/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed under the Apache-2.0 license

[package]
name = "caliptra-coverage"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow.workspace = true
serde = {workspace = true, features = ["derive"]}
serde_json.workspace = true
hex.workspace = true
rand.workspace = true
bit-vec = { workspace = true, features = ["serde"] }
caliptra-builder.workspace = true
elf.workspace = true
Loading

0 comments on commit edeb9e2

Please sign in to comment.