Skip to content

add Go code coverage reporting to Makefile and CI #939

Description

@Princess0407

Description

make unittest runs tests across pkg/unikontainers, pkg/network, internal/metrics, and hypervisor/unikernel packages, but coverage profiles are discarded. The .gitignore explicitly ignores *.out files, and there is no Makefile target to generate or inspect coverage reports.

Proposed Work

  1. Add make coverage that runs go test -coverprofile=coverage.out -covermode=atomic across all unit-test packages.
  2. Add make coverage-html to generate a browsable report.
  3. Update .github/workflows/unit_test.yml to upload coverage.out as a build artifact.

Why This Matters

As urunc adds support for more unikernel frameworks and hypervisors, coverage reporting helps contributors identify which VM lifecycle paths (network setup, initrd construction, monitor spawning) lack test coverage before merging.

Acceptance Criteria

  • make coverage passes on both amd64 and arm64.
  • Coverage artifact is downloadable from CI runs.
  • Badge or report link is visible in repository documentation.

Non-Priorities

  • Setting coverage thresholds or gating PRs (can be discussed in follow-up).
  • Refactoring existing tests.

I can open a PR starting with the Makefile targets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions