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:
Catalin Dumitru
2021-07-29 16:01:18 +03:00
committed by Laura Loghin
parent 7693628035
commit 0b9d283cff
4 changed files with 35 additions and 4 deletions
+22 -4
View File
@@ -7,11 +7,29 @@ import pytest
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()
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")
COVERAGE_CONFIG_PATH = get_coverage_config_path()
def _read_test_config():