diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..42bd971 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,5 @@ +[package] +name = "rust-vmm-ci" +version = "0.1.0" + +[dependencies] diff --git a/coverage_config_x86_64.json b/coverage_config_x86_64.json new file mode 100644 index 0000000..d80d206 --- /dev/null +++ b/coverage_config_x86_64.json @@ -0,0 +1,5 @@ +{ + "coverage_score": 33.3, + "exclude_path": "", + "crate_features": "" +} diff --git a/integration_tests/test_coverage.py b/integration_tests/test_coverage.py index ffd307a..65ccc23 100644 --- a/integration_tests/test_coverage.py +++ b/integration_tests/test_coverage.py @@ -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(): diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..a285917 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,3 @@ +pub fn main() { + println!("It works!"); +}