diff --git a/Cargo.lock b/Cargo.lock index 28561608a6a..8be5eab9cf6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -284,12 +284,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - [[package]] name = "ciborium" version = "0.2.2" @@ -803,7 +797,6 @@ version = "1.11.0-dev" dependencies = [ "libc", "log-instrument", - "nix 0.29.0", "regex", "thiserror 2.0.6", "utils", @@ -965,18 +958,6 @@ dependencies = [ "libc", ] -[[package]] -name = "nix" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "cfg_aliases", - "libc", -] - [[package]] name = "nom" version = "7.1.3" @@ -1467,7 +1448,7 @@ dependencies = [ "bitflags 2.6.0", "cfg-if", "libc", - "nix 0.27.1", + "nix", "thiserror 1.0.69", "userfaultfd-sys", ] @@ -1493,15 +1474,10 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" name = "utils" version = "0.1.0" dependencies = [ - "derive_more", "displaydoc", "libc", "log-instrument", - "serde", - "serde_json", "thiserror 2.0.6", - "vm-memory", - "vmm-sys-util", ] [[package]] @@ -1600,7 +1576,6 @@ dependencies = [ "itertools 0.13.0", "kvm-bindings", "kvm-ioctls", - "lazy_static", "libc", "linux-loader", "log", diff --git a/src/jailer/Cargo.toml b/src/jailer/Cargo.toml index f486944ac3b..c84b09450b0 100644 --- a/src/jailer/Cargo.toml +++ b/src/jailer/Cargo.toml @@ -14,7 +14,6 @@ bench = false [dependencies] libc = "0.2.168" log-instrument = { path = "../log-instrument", optional = true } -nix = { version = "0.29.0", default-features = false, features = ["dir"] } regex = { version = "1.11.1", default-features = false, features = ["std"] } thiserror = "2.0.6" vmm-sys-util = "0.12.1" diff --git a/src/utils/Cargo.toml b/src/utils/Cargo.toml index 923155c265e..dd5652718da 100644 --- a/src/utils/Cargo.toml +++ b/src/utils/Cargo.toml @@ -9,17 +9,10 @@ license = "Apache-2.0" bench = false [dependencies] -derive_more = { version = "1.0.0", default-features = false, features = ["from"] } displaydoc = "0.2.5" libc = "0.2.168" log-instrument = { path = "../log-instrument", optional = true } -serde = { version = "1.0.215", features = ["derive"] } thiserror = "2.0.6" -vm-memory = { version = "0.16.1", features = ["backend-mmap", "backend-bitmap"] } -vmm-sys-util = "0.12.1" - -[dev-dependencies] -serde_json = "1.0.133" [features] tracing = ["log-instrument"] diff --git a/src/vmm/Cargo.toml b/src/vmm/Cargo.toml index ec3137be748..0ab810b6573 100644 --- a/src/vmm/Cargo.toml +++ b/src/vmm/Cargo.toml @@ -24,7 +24,6 @@ gdbstub = { version = "0.7.3", optional = true } gdbstub_arch = { version = "0.3.1", optional = true } kvm-bindings = { version = "0.10.0", features = ["fam-wrappers", "serde"] } kvm-ioctls = "0.19.1" -lazy_static = "1.5.0" libc = "0.2.168" linux-loader = "0.13.0" log = { version = "0.4.22", features = ["std", "serde"] } diff --git a/tests/host_tools/cargo_build.py b/tests/host_tools/cargo_build.py index da72e5433b2..5a029f8c5f4 100644 --- a/tests/host_tools/cargo_build.py +++ b/tests/host_tools/cargo_build.py @@ -14,6 +14,11 @@ DEFAULT_TARGET_DIR = f"{DEFAULT_TARGET}/release/" +def nightly_toolchain() -> str: + """Receives the name of the installed nightly toolchain""" + return utils.check_output("rustup toolchain list | grep nightly").stdout.strip() + + def cargo( subcommand, cargo_args: str = "", @@ -21,11 +26,15 @@ def cargo( *, env: dict = None, cwd: str = None, + nightly: bool = False, ): """Executes the specified cargo subcommand""" + toolchain = f"+{nightly_toolchain()}" if nightly else "" env = env or {} env_string = " ".join(f'{key}="{str(value)}"' for key, value in env.items()) - cmd = f"{env_string} cargo {subcommand} {cargo_args} -- {subcommand_args}" + cmd = ( + f"{env_string} cargo {toolchain} {subcommand} {cargo_args} -- {subcommand_args}" + ) return utils.check_output(cmd, cwd=cwd) diff --git a/tests/integration_tests/build/test_dependencies.py b/tests/integration_tests/build/test_dependencies.py new file mode 100644 index 00000000000..6ee3a675702 --- /dev/null +++ b/tests/integration_tests/build/test_dependencies.py @@ -0,0 +1,12 @@ +# Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 +"""Enforces controls over dependencies.""" + +from host_tools.cargo_build import cargo + + +def test_unused_dependencies(): + """ + Test that there are no unused dependencies. + """ + cargo("udeps", "--all", nightly=True)