Skip to content

Commit

Permalink
ci: Test for unused dependencies
Browse files Browse the repository at this point in the history
Adds a test for unused cargo dependencies, and removes unused
dependencies to satisfy this test.

Signed-off-by: Jonathan Woollett-Light <[email protected]>
  • Loading branch information
Jonathan Woollett-Light committed Oct 3, 2023
1 parent 5326773 commit 0d7731f
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 14 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

4 changes: 3 additions & 1 deletion src/snapshot-editor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ bench = false

[dependencies]
clap = { version = "4.4.6", features = ["derive", "string"] }
clap-num = "1.0.2"
displaydoc = "0.2.4"
libc = "0.2.148"
snapshot = { path = "../snapshot" }
thiserror = "1.0.49"
vmm = { path = "../vmm" }

fc_utils = { package = "utils", path = "../utils" }

[target.'cfg(target_arch = "aarch64")'.dependencies]
clap-num = "1.0.2"
2 changes: 0 additions & 2 deletions src/utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,5 @@ versionize_derive = "0.1.5"
vmm-sys-util = "0.11.0"
vm-memory = { version = "0.12.0", features = ["backend-mmap", "backend-bitmap"] }

net_gen = { path = "../net_gen" }

[dev-dependencies]
serde_json = "1.0.99"
4 changes: 3 additions & 1 deletion src/vmm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ userfaultfd = "0.7.0"
versionize = "0.1.10"
versionize_derive = "0.1.5"
vm-allocator = "0.1.0"
vm-fdt = "0.2.0"
vm-superio = "0.7.0"
log = { version = "0.4.17", features = ["std", "serde"] }
aes-gcm = { version = "0.10.1", default-features = false, features = ["aes"] }
Expand All @@ -42,6 +41,9 @@ snapshot = { path = "../snapshot"}
utils = { path = "../utils" }
virtio_gen = { path = "../virtio_gen" }

[target.'cfg(target_arch = "aarch64")'.dependencies]
vm-fdt = "0.2.0"

[dev-dependencies]
criterion = { version = "0.5.0", default-features = false }
device_tree = "1.1.0"
Expand Down
7 changes: 7 additions & 0 deletions tests/integration_tests/build/test_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ def test_licenses():
)

cargo("deny", f"--manifest-path {toml_file} check licenses bans")


def test_unused_dependencies():
"""
Test that there are no unused dependencies.
"""
cargo("+nightly udeps --all")
3 changes: 2 additions & 1 deletion tools/devctr/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ RUN cd /tmp/poetry && \

# Install the Rust toolchain. Kani only work on x86, so only try to install it there.
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain "$RUST_TOOLCHAIN" \
&& rustup install nightly \
&& rustup target add $ARCH-unknown-linux-musl \
&& rustup component add llvm-tools-preview \
&& cargo install cargo-audit cargo-deny grcov cargo-sort \
&& cargo install cargo-audit cargo-deny grcov cargo-sort cargo-udeps \
&& (if [ "$ARCH" = "x86_64" ]; then cargo install kani-verifier && cargo kani setup; else true; fi) \
&& rm -rf "$CARGO_HOME/registry" \
&& ln -s "$CARGO_REGISTRY_DIR" "$CARGO_HOME/registry" \
Expand Down
14 changes: 7 additions & 7 deletions tools/devctr/poetry.lock

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

2 changes: 1 addition & 1 deletion tools/devtool
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
DEVCTR_IMAGE_NO_TAG="public.ecr.aws/firecracker/fcuvm"

# Development container tag
DEVCTR_IMAGE_TAG=${DEVCTR_IMAGE_TAG:-v64}
DEVCTR_IMAGE_TAG=${DEVCTR_IMAGE_TAG:-v65}

# Development container image (name:tag)
# This should be updated whenever we upgrade the development container.
Expand Down

0 comments on commit 0d7731f

Please sign in to comment.