mirror of
https://github.com/rust-vmm/rust-vmm-ci.git
synced 2026-08-05 03:08:31 +00:00
Create local rust crate and update config path
In order to be able to run the CI on rust-vmm-ci we needed to make it a rust crate. Also the path to the coverage config file needed to be updated in test_coverage.py so that the path does not depend on the crate; a breadth-first search was used to guarantee that the config file belongs to the crate that is being tested. Signed-off-by: Catalin Dumitru <catdum@amazon.com>
This commit is contained in:
committed by
Laura Loghin
parent
7693628035
commit
0b9d283cff
5
Cargo.toml
Normal file
5
Cargo.toml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[package]
|
||||||
|
name = "rust-vmm-ci"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
5
coverage_config_x86_64.json
Normal file
5
coverage_config_x86_64.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"coverage_score": 33.3,
|
||||||
|
"exclude_path": "",
|
||||||
|
"crate_features": ""
|
||||||
|
}
|
||||||
@@ -7,11 +7,29 @@ import pytest
|
|||||||
|
|
||||||
from utils import get_repo_root_path
|
from utils import get_repo_root_path
|
||||||
|
|
||||||
|
|
||||||
|
def get_coverage_config_path():
|
||||||
|
machine = platform.machine()
|
||||||
|
target_file = f"coverage_config_{machine}.json"
|
||||||
|
# We use a breadth-first search to guarantee that the config file
|
||||||
|
# belongs to the crate that is being tested. Otherwise we might end
|
||||||
|
# up wrongfully using the config file in the rust-vmm-ci submodule.
|
||||||
|
# os.walkdir() offers a depth-first search and couldn't be used here.
|
||||||
|
dirs = [os.getcwd()]
|
||||||
|
while len(dirs):
|
||||||
|
nextDirs = []
|
||||||
|
for dir in dirs:
|
||||||
|
for file in os.listdir(dir):
|
||||||
|
file_path = os.path.join(dir, file)
|
||||||
|
if os.path.isdir(file_path):
|
||||||
|
nextDirs.append(file_path)
|
||||||
|
elif file == target_file:
|
||||||
|
return file_path
|
||||||
|
dirs = nextDirs
|
||||||
|
|
||||||
|
|
||||||
REPO_ROOT_PATH = get_repo_root_path()
|
REPO_ROOT_PATH = get_repo_root_path()
|
||||||
if platform.machine() == "x86_64":
|
COVERAGE_CONFIG_PATH = get_coverage_config_path()
|
||||||
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():
|
def _read_test_config():
|
||||||
|
|||||||
3
src/lib.rs
Normal file
3
src/lib.rs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
pub fn main() {
|
||||||
|
println!("It works!");
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user