Skip to content

Commit

Permalink
Enable rust-vmm coverage test in CI
Browse files Browse the repository at this point in the history
1. Enabled the aarch64 coverage test in `test_coverage` script.

2. Seperated the coverage json sample file to two sample files for
different machine achitectures.

3. Updated Buildkite pipeline container version.

4. Updated README for the description of coverage files and container
version.

Signed-off-by: Henry Wang <[email protected]>
  • Loading branch information
MrXinWang authored and andreeaflorescu committed Feb 21, 2020
1 parent c309d06 commit cd7096e
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 23 deletions.
40 changes: 27 additions & 13 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ steps:
os: linux
plugins:
- docker#v3.0.1:
image: "rustvmm/dev:v4"
image: "rustvmm/dev:v5"
always-pull: true

- label: "build-gnu-arm"
Expand All @@ -24,7 +24,7 @@ steps:
os: linux
plugins:
- docker#v3.0.1:
image: "rustvmm/dev:v4"
image: "rustvmm/dev:v5"
always-pull: true

- label: "build-musl-x86"
Expand All @@ -37,7 +37,7 @@ steps:
os: linux
plugins:
- docker#v3.0.1:
image: "rustvmm/dev:v4"
image: "rustvmm/dev:v5"
always-pull: true

- label: "build-musl-arm"
Expand All @@ -50,7 +50,7 @@ steps:
os: linux
plugins:
- docker#v3.0.1:
image: "rustvmm/dev:v4"
image: "rustvmm/dev:v5"
always-pull: true

- label: "style"
Expand All @@ -62,7 +62,7 @@ steps:
os: linux
plugins:
- docker#v3.0.1:
image: "rustvmm/dev:v4"
image: "rustvmm/dev:v5"
always-pull: true

- label: "unittests-gnu-x86"
Expand All @@ -76,7 +76,7 @@ steps:
plugins:
- docker#v3.0.1:
privileged: true
image: "rustvmm/dev:v4"
image: "rustvmm/dev:v5"
always-pull: true

- label: "unittests-gnu-arm"
Expand All @@ -90,7 +90,7 @@ steps:
plugins:
- docker#v3.0.1:
privileged: true
image: "rustvmm/dev:v4"
image: "rustvmm/dev:v5"
always-pull: true

- label: "unittests-musl-x86"
Expand All @@ -104,7 +104,7 @@ steps:
plugins:
- docker#v3.0.1:
privileged: true
image: "rustvmm/dev:v4"
image: "rustvmm/dev:v5"
always-pull: true

- label: "unittests-musl-arm"
Expand All @@ -118,7 +118,7 @@ steps:
plugins:
- docker#v3.0.1:
privileged: true
image: "rustvmm/dev:v4"
image: "rustvmm/dev:v5"
always-pull: true

- label: "clippy-x86"
Expand All @@ -131,7 +131,7 @@ steps:
os: linux
plugins:
- docker#v3.0.1:
image: "rustvmm/dev:v4"
image: "rustvmm/dev:v5"
always-pull: true

- label: "check-warnings-x86"
Expand All @@ -145,7 +145,7 @@ steps:
plugins:
- docker#v3.0.1:
privileged: true
image: "rustvmm/dev:v4"
image: "rustvmm/dev:v5"
always-pull: true

- label: "check-warnings-arm"
Expand All @@ -159,7 +159,7 @@ steps:
plugins:
- docker#v3.0.1:
privileged: true
image: "rustvmm/dev:v4"
image: "rustvmm/dev:v5"
always-pull: true

- label: "coverage-x86"
Expand All @@ -173,5 +173,19 @@ steps:
plugins:
- docker#v3.0.1:
privileged: true
image: "rustvmm/dev:v4"
image: "rustvmm/dev:v5"
always-pull: true

- label: "coverage-arm"
commands:
- pytest rust-vmm-ci/integration_tests/test_coverage.py
retry:
automatic: false
agents:
platform: arm.metal
os: linux
plugins:
- docker#v3.0.1:
privileged: true
image: "rustvmm/dev:v5"
always-pull: true
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ git submodule add https://github.com/rust-vmm/rust-vmm-ci.git
git commit -s -m "Added rust-vmm-ci as submodule"
```

2. Create the coverage test configuration file named coverage_config.json in
the root of the repository. One example of the configuration file can be found
in [coverage_config.json.sample](coverage_config.json.sample).
2. Create the coverage test configuration file named coverage_config_ARCH.json in
the root of the repository, where ARCH is the architecture of the machine.
There are two coverage test configuration files, one per each platform.
The example of the configuration file for x86_64 architecture can be found
in [coverage_config_x86_64.json.sample](coverage_config_x86_64.json.sample),
and the example of the configuration file for aarch64 architecture can be found
in [coverage_config_aarch64.json.sample](coverage_config_aarch64.json.sample).

The json must have the following fields:
- *coverage_score*: The coverage of the repository.
Expand Down Expand Up @@ -73,7 +77,7 @@ steps:
platform: x86_64.metal
plugins:
- docker#v3.0.1:
image: "rustvmm/dev:v3"
image: "rustvmm/dev:v5"
always-pull: true
```
Expand Down Expand Up @@ -105,7 +109,7 @@ steps:
platform: x86_64.metal
plugins:
- docker#v3.0.1:
image: "rustvmm/dev:v3"
image: "rustvmm/dev:v5"
always-pull: true
```

Expand Down Expand Up @@ -188,9 +192,9 @@ docker run --device=/dev/kvm \
-it \
--security-opt seccomp=unconfined \
--volume $(pwd)/kvm-ioctls:/kvm-ioctls \
rustvmm/dev:v3
rustvmm/dev:v5
cd kvm-ioctls/
pytest --profile=devel tests/test_coverage.py
pytest --profile=devel rust-vmm-ci/integration_tests/test_coverage.py
```

If the PR coverage is higher than the upstream coverage, the coverage file
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions coverage_config_x86_64.json.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"coverage_score": 90,
"exclude_path": "my_autogenerated_file.rs,second_file.rs",
"crate_features": "my_dummy_feature,dummy_feature2"
}
8 changes: 5 additions & 3 deletions integration_tests/test_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
# SPDX-License-Identifier: Apache-2.0
"""Test the coverage and update the threshold when coverage is increased."""

import json, os, re, shutil, subprocess
import json, os, re, shutil, subprocess, platform
import pytest

from utils import get_repo_root_path

REPO_ROOT_PATH = get_repo_root_path()
COVERAGE_CONFIG_PATH = os.path.join(REPO_ROOT_PATH, "coverage_config.json")

if platform.machine() == "x86_64":
COVERAGE_CONFIG_PATH = os.path.join(REPO_ROOT_PATH, "coverage_config_x86_64.json")
elif platform.machine() == "aarch64":
COVERAGE_CONFIG_PATH = os.path.join(REPO_ROOT_PATH, "coverage_config_aarch64.json")

def _read_test_config():
"""
Expand Down

0 comments on commit cd7096e

Please sign in to comment.