Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Test for unused dependencies #4117

Merged
merged 4 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 1 addition & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/jailer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 0 additions & 7 deletions src/utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
1 change: 0 additions & 1 deletion src/vmm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
11 changes: 10 additions & 1 deletion tests/host_tools/cargo_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,27 @@
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 = "",
subcommand_args: str = "",
*,
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)


Expand Down
12 changes: 12 additions & 0 deletions tests/integration_tests/build/test_dependencies.py
Original file line number Diff line number Diff line change
@@ -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)
Loading