From 542db3d1574cb7dcffcc7a30cd92a6af697dda7b Mon Sep 17 00:00:00 2001 From: Jonathan Woollett-Light Date: Tue, 3 Oct 2023 17:07:41 +0100 Subject: [PATCH] ci: Test for unused dependencies Adds a test for unused cargo dependencies, and removes unused dependencies to satisfy this test. Signed-off-by: Jonathan Woollett-Light --- Cargo.lock | 1 - docs/cpu_templates/boot-protocol.md | 2 +- docs/network-performance.md | 10 +++++----- docs/snapshotting/versioning.md | 8 ++++---- src/snapshot-editor/Cargo.toml | 4 +++- src/utils/Cargo.toml | 2 -- src/vmm/Cargo.toml | 4 +++- tests/integration_tests/build/test_dependencies.py | 7 +++++++ tools/devctr/Dockerfile | 3 ++- tools/devctr/poetry.lock | 14 +++++++------- tools/devtool | 2 +- 11 files changed, 33 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ba2ea6c69e2e..d418238c64ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1316,7 +1316,6 @@ dependencies = [ "derive_more", "displaydoc", "libc", - "net_gen", "serde", "serde_json", "thiserror", diff --git a/docs/cpu_templates/boot-protocol.md b/docs/cpu_templates/boot-protocol.md index d22086daae1a..690d06b96d56 100644 --- a/docs/cpu_templates/boot-protocol.md +++ b/docs/cpu_templates/boot-protocol.md @@ -28,6 +28,6 @@ and MSR_IA32_MISC_ENABLE is set to `1`. On aarch64, the following registers are set: -- PSTATE to PSR_MODE_EL1h | PSR_A_BIT | PSR_F_BIT | PSR_I_BIT | PSR_D_BIT +- PSTATE to `PSR_MODE_EL1h | PSR_A_BIT | PSR_F_BIT | PSR_I_BIT | PSR_D_BIT` - PC to kernel load address (vCPU0 only) - X0 to DTB/FDT address (vCPU0 only) diff --git a/docs/network-performance.md b/docs/network-performance.md index 74e928c8bf5d..b863e3214570 100644 --- a/docs/network-performance.md +++ b/docs/network-performance.md @@ -7,11 +7,11 @@ Scope of the measurements is to illustrate the limits for the emulation thread. ## TCP Throughput -Segment size/ Direction | 1460bytes | 256bytes | 128bytes | 96bytes ---- | --- | --- | --- |--- -Ingress| 25Gbps | 23Gbps | 20Gbps | 18Gbps -Egress | 25Gbps | 23Gbps | 20Gbps | 18Gbps -Bidirectional | 18Gbps | 18Gbps | 18Gbps | 18Gbps +Segment size/ Direction | 1460bytes | 256bytes | 128bytes | 96bytes | +--- | --- | --- | --- |--- | +Ingress| 25Gbps | 23Gbps | 20Gbps | 18Gbps | +Egress | 25Gbps | 23Gbps | 20Gbps | 18Gbps | +Bidirectional | 18Gbps | 18Gbps | 18Gbps | 18Gbps | **Setup and test description** Throughput measurements were done using [iperf3](https://iperf.fr/). The target diff --git a/docs/snapshotting/versioning.md b/docs/snapshotting/versioning.md index e4033337a0da..b595a524e386 100644 --- a/docs/snapshotting/versioning.md +++ b/docs/snapshotting/versioning.md @@ -71,10 +71,10 @@ A microVM state file is further split into four different fields: | Field | Bits| Description | |----|----|----| -| magic_id | 64 | Firecracker snapshot, architecture (x86_64/aarch64) and storage version. -| version | 16 | The snapshot version number internally mapped 1:1 to a specific Firecracker version. -| state | N | Bincode blob containing the microVM state. - | crc| 64 | Optional CRC64 sum of magic_id, version and state fields. +| magic_id | 64 | Firecracker snapshot, architecture (x86_64/aarch64) and storage version. | +| version | 16 | The snapshot version number internally mapped 1:1 to a specific Firecracker version. | +| state | N | Bincode blob containing the microVM state. | +| crc| 64 | Optional CRC64 sum of magic_id, version and state fields. | **Note**: the last 16 bits of `magic_id` encode the storage version which specifies the encoding used for the `version` and `state` fields. The current diff --git a/src/snapshot-editor/Cargo.toml b/src/snapshot-editor/Cargo.toml index 17f892aa71ea..747ad53edd3a 100644 --- a/src/snapshot-editor/Cargo.toml +++ b/src/snapshot-editor/Cargo.toml @@ -11,7 +11,6 @@ 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" } @@ -19,3 +18,6 @@ thiserror = "1.0.49" vmm = { path = "../vmm" } fc_utils = { package = "utils", path = "../utils" } + +[target.'cfg(target_arch = "aarch64")'.dependencies] +clap-num = "1.0.2" diff --git a/src/utils/Cargo.toml b/src/utils/Cargo.toml index c00d850b37ea..578e1b50b339 100644 --- a/src/utils/Cargo.toml +++ b/src/utils/Cargo.toml @@ -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" diff --git a/src/vmm/Cargo.toml b/src/vmm/Cargo.toml index 65b0f07d1c68..7987b14ffc97 100644 --- a/src/vmm/Cargo.toml +++ b/src/vmm/Cargo.toml @@ -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"] } @@ -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" diff --git a/tests/integration_tests/build/test_dependencies.py b/tests/integration_tests/build/test_dependencies.py index 778f5facc228..04c72da93a37 100644 --- a/tests/integration_tests/build/test_dependencies.py +++ b/tests/integration_tests/build/test_dependencies.py @@ -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") diff --git a/tools/devctr/Dockerfile b/tools/devctr/Dockerfile index d3fd64d893de..9ada623be373 100644 --- a/tools/devctr/Dockerfile +++ b/tools/devctr/Dockerfile @@ -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" \ diff --git a/tools/devctr/poetry.lock b/tools/devctr/poetry.lock index 3baa62a9c88e..c0cc23756bc8 100644 --- a/tools/devctr/poetry.lock +++ b/tools/devctr/poetry.lock @@ -160,13 +160,13 @@ python-dateutil = ">=2.7.0" [[package]] name = "astroid" -version = "2.15.6" +version = "2.15.7" description = "An abstract syntax tree for Python with inference support." optional = false python-versions = ">=3.7.2" files = [ - {file = "astroid-2.15.6-py3-none-any.whl", hash = "sha256:389656ca57b6108f939cf5d2f9a2a825a3be50ba9d589670f393236e0a03b91c"}, - {file = "astroid-2.15.6.tar.gz", hash = "sha256:903f024859b7c7687d7a7f3a3f73b17301f8e42dfd9cc9df9d4418172d3e2dbd"}, + {file = "astroid-2.15.7-py3-none-any.whl", hash = "sha256:958f280532e36ca84a13023f15cb1556fb6792d193acb87e1f3ca536b6fa6bd2"}, + {file = "astroid-2.15.7.tar.gz", hash = "sha256:c522f2832a900e27a7d284b9b6ef670d2495f760ede3c8c0b004a5641d3c5987"}, ] [package.dependencies] @@ -1256,17 +1256,17 @@ plugins = ["importlib-metadata"] [[package]] name = "pylint" -version = "2.17.5" +version = "2.17.6" description = "python code static checker" optional = false python-versions = ">=3.7.2" files = [ - {file = "pylint-2.17.5-py3-none-any.whl", hash = "sha256:73995fb8216d3bed149c8d51bba25b2c52a8251a2c8ac846ec668ce38fab5413"}, - {file = "pylint-2.17.5.tar.gz", hash = "sha256:f7b601cbc06fef7e62a754e2b41294c2aa31f1cb659624b9a85bcba29eaf8252"}, + {file = "pylint-2.17.6-py3-none-any.whl", hash = "sha256:18a1412e873caf8ffb56b760ce1b5643675af23e6173a247b502406b24c716af"}, + {file = "pylint-2.17.6.tar.gz", hash = "sha256:be928cce5c76bf9acdc65ad01447a1e0b1a7bccffc609fb7fc40f2513045bd05"}, ] [package.dependencies] -astroid = ">=2.15.6,<=2.17.0-dev0" +astroid = ">=2.15.7,<=2.17.0-dev0" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} dill = {version = ">=0.2", markers = "python_version < \"3.11\""} isort = ">=4.2.5,<6" diff --git a/tools/devtool b/tools/devtool index 9c724a346bff..907fdbb0ced5 100755 --- a/tools/devtool +++ b/tools/devtool @@ -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.