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 <jcawl@amazon.co.uk>
  • Loading branch information
JonathanWoollett-Light committed Oct 3, 2023
1 parent 5326773 commit 542db3d
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 24 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.

2 changes: 1 addition & 1 deletion docs/cpu_templates/boot-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
10 changes: 5 additions & 5 deletions docs/network-performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions docs/snapshotting/versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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 542db3d

Please sign in to comment.