From 8ec7bae25cef6ccc06b54b8a9ac30975364e8ba4 Mon Sep 17 00:00:00 2001 From: Diana Popa Date: Wed, 19 Aug 2020 17:48:45 +0300 Subject: [PATCH 1/4] devctr: add cargo kcov for aarch64 Signed-off-by: Diana Popa --- tools/devctr/Dockerfile.aarch64 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/devctr/Dockerfile.aarch64 b/tools/devctr/Dockerfile.aarch64 index 0ea325e07ac..8faae953c6c 100644 --- a/tools/devctr/Dockerfile.aarch64 +++ b/tools/devctr/Dockerfile.aarch64 @@ -31,6 +31,7 @@ RUN apt-get update \ iperf3 \ iproute2 \ jq \ + libbfd-dev \ libcurl4-openssl-dev \ libdw-dev \ libfdt-dev \ @@ -71,13 +72,19 @@ RUN apt-get update \ # Install the Rust toolchain # -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain "$RUST_TOOLCHAIN" \ +RUN mkdir "$TMP_BUILD_DIR" \ + && curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain "$RUST_TOOLCHAIN" \ && rustup target add aarch64-unknown-linux-musl \ + && cd "$TMP_BUILD_DIR" \ + && cargo install cargo-kcov \ + && cargo kcov --print-install-kcov-sh | sh \ && rm -rf "$CARGO_HOME/registry" \ && ln -s "$CARGO_REGISTRY_DIR" "$CARGO_HOME/registry" \ && rm -rf "$CARGO_HOME/git" \ - && ln -s "$CARGO_GIT_REGISTRY_DIR" "$CARGO_HOME/git" -# + && ln -s "$CARGO_GIT_REGISTRY_DIR" "$CARGO_HOME/git" \ + && cd / \ + && rm -rf "$TMP_BUILD_DIR" + # Add the tini init binary. ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION_TAG}/tini-static-arm64 /sbin/tini RUN chmod +x /sbin/tini From 50752d9d0c4c6bde84223963635533ceae77b655 Mon Sep 17 00:00:00 2001 From: Diana Popa Date: Wed, 7 Oct 2020 18:55:10 +0300 Subject: [PATCH 2/4] devtool: use kcov enabled image v21 Signed-off-by: Diana Popa --- tools/devtool | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/devtool b/tools/devtool index 0edab50a49d..438ed363690 100755 --- a/tools/devtool +++ b/tools/devtool @@ -73,7 +73,7 @@ # Development container image (name:tag) # This should be updated whenever we upgrade the development container. # (Yet another step on our way to reproducible builds.) -DEVCTR_IMAGE="fcuvm/dev:v20" +DEVCTR_IMAGE="fcuvm/dev:v21" # Naming things is hard MY_NAME="Firecracker $(basename "$0")" From 3dfb36a7b53d0815190b042d2cc5d0888d7c1178 Mon Sep 17 00:00:00 2001 From: Diana Popa Date: Wed, 19 Aug 2020 17:55:17 +0300 Subject: [PATCH 3/4] tests: enable coverage on aarch64 Fixes #1579. Signed-off-by: Diana Popa --- tests/host_tools/proc.py | 5 +++++ tests/integration_tests/build/test_coverage.py | 13 ++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/host_tools/proc.py b/tests/host_tools/proc.py index f39a9d296ad..d9d1963a4c0 100644 --- a/tests/host_tools/proc.py +++ b/tests/host_tools/proc.py @@ -13,4 +13,9 @@ def proc_type(): for line in lines: if "model name" in line: return re.sub(".*model name.*:", "", line, 1) + + cmd = "uname -m" + result = utils.run_cmd(cmd).stdout.strip() + if "aarch64" in result: + return "ARM" return "" diff --git a/tests/integration_tests/build/test_coverage.py b/tests/integration_tests/build/test_coverage.py index 16b71deb38e..b18ca3da462 100644 --- a/tests/integration_tests/build/test_coverage.py +++ b/tests/integration_tests/build/test_coverage.py @@ -23,7 +23,7 @@ # this contains the frequency while on AMD it does not. # Checkout the cpuid crate. In the future other # differences may appear. -COVERAGE_DICT = {"Intel": 85.20, "AMD": 84.36} +COVERAGE_DICT = {"Intel": 85.20, "AMD": 84.36, "ARM": 82.70} PROC_MODEL = proc.proc_type() COVERAGE_MAX_DELTA = 0.05 @@ -78,10 +78,6 @@ def test_ensure_mod_tests(): @pytest.mark.timeout(400) -@pytest.mark.skipif( - platform.machine() != "x86_64", - reason="kcov hangs on aarch64" -) def test_coverage(test_session_root_path, test_session_tmp_path): """Test line coverage with kcov. @@ -106,14 +102,17 @@ def test_coverage(test_session_root_path, test_session_tmp_path): '_gen' ) exclude_region = '\'mod tests {\'' + target = "{}-unknown-linux-musl".format(platform.machine()) cmd = ( - 'CARGO_TARGET_DIR={} cargo kcov --all ' - '--output {} -- ' + 'RUSTFLAGS="{}" CARGO_TARGET_DIR={} cargo kcov --all ' + '--target {} --output {} -- ' '--exclude-pattern={} ' '--exclude-region={} --verify' ).format( + host.get_rustflags(), os.path.join(test_session_root_path, CARGO_KCOV_REL_PATH), + target, test_session_tmp_path, exclude_pattern, exclude_region From 579965146b4d3279def474981d1a1ec3c015e5e7 Mon Sep 17 00:00:00 2001 From: Diana Popa Date: Fri, 23 Oct 2020 16:51:12 +0300 Subject: [PATCH 4/4] temporarily disable assert for aarch64 For a full description, checkout Github issue 2216. Signed-off-by: Diana Popa --- src/vmm/src/signal_handler.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/vmm/src/signal_handler.rs b/src/vmm/src/signal_handler.rs index ec748ceb361..313a64de6c7 100644 --- a/src/vmm/src/signal_handler.rs +++ b/src/vmm/src/signal_handler.rs @@ -282,6 +282,8 @@ mod tests { assert!(METRICS.signals.sigxcpu.count() >= 1); assert!(METRICS.signals.sigpipe.count() >= 1); assert!(METRICS.signals.sighup.count() >= 1); + // Workaround to GitHub issue 2216. + #[cfg(not(target_arch = "aarch64"))] assert!(METRICS.signals.sigill.count() >= 1); } }