-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathJustfile
More file actions
159 lines (132 loc) · 6.19 KB
/
Copy pathJustfile
File metadata and controls
159 lines (132 loc) · 6.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# Justfile for composefs-rs
# Run `just --list` to see available targets.
# --------------------------------------------------------------------
mod bootc
# Build all crates
build:
cargo build --workspace
# Build in release mode
build-release:
cargo build --workspace --release
# Run unit tests (excludes integration-tests crate)
test:
cargo test --workspace --exclude composefs-integration-tests
# Run clippy lints
clippy:
cargo clippy --workspace -- -D warnings
# Verify cfsctl builds with each optional feature combination
check-feature-combos:
cargo clippy -p composefs-ctl --no-default-features -- -D warnings
cargo clippy -p composefs-ctl --no-default-features --features oci -- -D warnings
cargo clippy -p composefs-ctl --no-default-features --features http -- -D warnings
cargo clippy -p composefs-oci -- -D warnings
cargo clippy -p composefs-oci --features boot -- -D warnings
# Run rustfmt check
fmt-check:
cargo fmt --all -- --check
# Format code
fmt:
cargo fmt --all
# Check that fuzz targets compile
check-fuzz:
cargo check --manifest-path crates/composefs/fuzz/Cargo.toml
# Run unit + non-privileged integration tests (no VM, no root)
test-all: test test-integration
# Run all checks (clippy + fmt + test + fuzz build)
check: clippy check-feature-combos fmt-check test check-fuzz
# Base image for test container builds.
# Defaults to centos-bootc:stream10: ghcr.io/bootcrew/debian-bootc:latest currently
# fails to bootstrap (a circular dependency in Debian sid's systemd/mount/libselinux1
# packaging surfaces when apt installs onto the empty dpkg database that debian-bootc
# ships with by design; this is an upstream packaging issue, not ours).
# Override to test on a different distro, e.g.:
# just base_image=ghcr.io/bootcrew/debian-bootc:latest cfsctl_features='' test-integration-vm
base_image := env("COMPOSEFS_BASE_IMAGE", "quay.io/centos-bootc/centos-bootc:stream10")
# cfsctl feature flags for the container build. Defaults match the base_image:
# debian (>= 6.15 kernel): no compat features needed
# centos stream10 (6.12): pre-6.15
# centos stream9 (5.14): rhel9
cfsctl_features := env("COMPOSEFS_CFSCTL_FEATURES", "pre-6.15")
# Derive test image name from base_image
_test_image := if base_image =~ "debian" { "localhost/composefs-rs-test-debian:latest" } else if base_image =~ "stream9" { "localhost/composefs-rs-test-c9s:latest" } else { "localhost/composefs-rs-test:latest" }
# Run unprivileged integration tests against the cfsctl binary (no root, no VM)
# Prefers nextest for parallelism control and better UX; falls back to direct harness.
test-integration *ARGS: build
#!/usr/bin/env bash
set -euo pipefail
export CFSCTL_PATH=$(pwd)/target/debug/cfsctl
if command -v cargo-nextest &> /dev/null; then
cargo nextest run -p composefs-integration-tests -E 'not test(/^privileged_/)' {{ ARGS }}
else
cargo test -p composefs-integration-tests --test cfsctl-integration-tests -- --skip privileged_ {{ ARGS }}
fi
# Run mount.composefs shell tests (needs fsverity-utils; mount tests need root)
test-mount-composefs: build
crates/composefs-ctl/tests/test-mount-composefs.sh $(pwd)/target/debug/cfsctl
# Build the test container image for VM-based integration tests
_integration-container-build:
podman build --build-arg base_image={{base_image}} --build-arg cfsctl_features={{cfsctl_features}} -t {{_test_image}} .
# Run all integration tests including privileged VM tests (requires podman + libvirt)
# Uses nextest with the integration profile for parallelism control of VM tests.
test-integration-vm *ARGS: build _integration-container-build
#!/usr/bin/env bash
set -euo pipefail
export COMPOSEFS_TEST_IMAGE={{_test_image}}
export CFSCTL_PATH=$(pwd)/target/debug/cfsctl
if command -v cargo-nextest &> /dev/null; then
cargo nextest run -P integration -p composefs-integration-tests {{ ARGS }}
else
cargo test -p composefs-integration-tests --test cfsctl-integration-tests -- {{ ARGS }}
fi
# Install cargo-nextest if not already installed
install-nextest:
@which cargo-nextest > /dev/null 2>&1 || cargo install cargo-nextest --locked
# Build and run a bls example locally.
# Usage: just test-example-local bls arch
# just test-example-local bls arch fsfmt=ext4 verity=none
# 'fsfmt' defaults to ext4, 'verity' defaults to none (no fs-verity enforcement).
# Requires: qemu-kvm, OVMF, skopeo, mtools, fsverity, mkfs.erofs, systemd-repart, podman.
test-example-local example os fsfmt="ext4" verity="none": build
#!/usr/bin/env bash
set -euo pipefail
export FS_FORMAT={{ fsfmt }}
export FS_VERITY_MODE={{ verity }}
export CFSCTL_PATH=$(pwd)/target/debug/cfsctl
cd examples
{{ example }}/build {{ os }}
TEST_IMAGE="{{ example }}/{{ os }}-{{ example }}-efi.qcow2" pytest test -v
# Run everything: checks + full integration tests including VM
ci: check test-integration-vm
# Run a specific erofs fuzz target (e.g., `just fuzz read_image -- -max_total_time=60`)
fuzz target *ARGS:
cd crates/composefs && cargo +nightly fuzz run {{target}} {{ARGS}}
# Run all erofs fuzz targets for a given duration each (default: 120 seconds)
fuzz-all seconds="120":
#!/usr/bin/env bash
set -euo pipefail
mkdir -p target/fuzz-logs
for target in $(cd crates/composefs && cargo +nightly fuzz list); do
echo "--- Fuzzing $target for {{seconds}}s ---"
log="target/fuzz-logs/$target.log"
if (cd crates/composefs && cargo +nightly fuzz run "$target" -- -max_total_time={{seconds}}) > "$log" 2>&1; then
echo " $target: OK"
tail -1 "$log"
else
echo " $target: FAILED"
cat "$log"
exit 1
fi
done
# Generate seed corpus for fuzz targets
generate-corpus:
cargo run --manifest-path crates/composefs/fuzz/Cargo.toml --bin generate-corpus
# List available fuzz targets
fuzz-list:
cd crates/composefs && cargo +nightly fuzz list
# Test composefs-capi against the C composefs test suite in a container.
# Optionally pass the path to a local checkout of the C composefs repo.
test-capi *ARGS:
crates/composefs-capi/tests/test-capi-container.sh {{ARGS}}
# Clean build artifacts
clean:
cargo clean