Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
154 lines (127 loc) · 5.76 KB
/
Copy pathjustfile
File metadata and controls
154 lines (127 loc) · 5.76 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
# zenflate development recipes
# Run all tests (safe mode)
test:
cargo test
# Full cross-API matrix: new/png 0–31 and all libdeflate compatibility levels
# on inputs up to 1 MiB (the default `cargo test` uses smaller inputs)
conformance-full:
ZENFLATE_CONFORMANCE=full cargo test --release --test conformance
# Run all tests with unchecked bounds elimination
test-unchecked:
cargo test --features unchecked
# Check + test every supported feature combination (decode-only, no-simd, no_std)
check-features:
cargo check --no-default-features
cargo check --no-default-features --features alloc
cargo check --no-default-features --features std
cargo check --no-default-features --features compress
cargo check --no-default-features --features compress,unchecked
cargo check --no-default-features --features compress,simd
cargo check --no-default-features --features simd,avx512,std
cargo check --no-default-features --features std,unchecked
cargo test --lib --no-default-features --features std
cargo test --lib --no-default-features --features compress,std,threads
# Run all benchmarks
bench:
cargo bench
# Run all benchmarks with unchecked bounds elimination
bench-unchecked:
cargo bench --features unchecked
# Run clippy (both feature sets)
clippy:
cargo clippy --all-targets -- -D warnings
cargo clippy --all-targets --features unchecked -- -D warnings
# Format check + regenerate the public-API surface snapshots (docs/public-api/).
# The snapshot runner lives in the standalone apidoc/ package, so it is never
# built or run by plain `cargo test` or any CI job.
fmt:
cargo fmt -p zenflate -- --check
cargo test --manifest-path apidoc/Cargo.toml
# Regenerate the public-API surface snapshots only
api-doc:
cargo test --manifest-path apidoc/Cargo.toml
# Verify the committed snapshots are current
api-doc-check:
ZEN_API_DOC=check cargo test --manifest-path apidoc/Cargo.toml
# Format fix
fmt-fix:
cargo fmt -p zenflate
# Profile compression with callgrind (level and data type)
callgrind level data:
cargo build --release --features unchecked --example compress_file 2>/dev/null || \
cargo bench --no-run --features unchecked
@echo "Running callgrind for L{{level}} {{data}}..."
mkdir -p "$HOME/tmp"
valgrind --tool=callgrind --callgrind-out-file="$HOME/tmp/callgrind-L{{level}}-{{data}}.out" \
cargo bench --features unchecked -- "compress/{{data}}/zenflate/L{{level}}" --profile-time 1
# Profile compression with cachegrind
cachegrind level data:
@echo "Running cachegrind for L{{level}} {{data}}..."
mkdir -p "$HOME/tmp"
valgrind --tool=cachegrind --cachegrind-out-file="$HOME/tmp/cachegrind-L{{level}}-{{data}}.out" \
cargo bench --features unchecked -- "compress/{{data}}/zenflate/L{{level}}" --profile-time 1
# Check everything (tests + clippy + fmt)
check: fmt clippy test test-unchecked check-features
# Build benchmarks without running (CI verification)
bench-check:
cargo bench --no-run
cargo bench --no-run --features unchecked
# Run a specific benchmark group
bench-group group:
cargo bench --features unchecked -- "{{group}}"
# Run corpus benchmarks (Canterbury, Silesia, photos)
bench-corpus:
cargo bench --bench corpus --features unchecked
# Download corpus files (Canterbury + Silesia) if not cached
corpus-download:
#!/usr/bin/env bash
set -euo pipefail
CACHE="$HOME/.cache/compression-corpus"
mkdir -p "$CACHE"
if [ ! -d "$CACHE/canterbury" ]; then
echo "Downloading Canterbury corpus..."
wget -q -O "$CACHE/cantrbry.tar.gz" "https://corpus.canterbury.ac.nz/resources/cantrbry.tar.gz"
mkdir -p "$CACHE/canterbury"
tar xzf "$CACHE/cantrbry.tar.gz" -C "$CACHE/canterbury"
rm "$CACHE/cantrbry.tar.gz"
echo "Canterbury corpus ready."
else
echo "Canterbury corpus already cached."
fi
if [ ! -d "$CACHE/silesia" ]; then
echo "Downloading Silesia corpus (~200MB)..."
wget -q -O "$CACHE/silesia.zip" "https://sun.aei.polsl.pl//~sdeor/corpus/silesia.zip"
mkdir -p "$CACHE/silesia"
cd "$CACHE/silesia" && unzip -o ../silesia.zip && rm ../silesia.zip
echo "Silesia corpus ready."
else
echo "Silesia corpus already cached."
fi
# Fuzz decompression with arbitrary input (default 60s)
fuzz-decompress seconds="60":
cargo +nightly fuzz run fuzz_decompress -- -max_total_time={{seconds}} -max_len=65536
# Fuzz compress+decompress round-trip (default 60s)
fuzz-roundtrip seconds="60":
cargo +nightly fuzz run fuzz_roundtrip -- -max_total_time={{seconds}} -max_len=65536
# Differential inflate, round-trip, or API fuzzing with caller-owned corpus storage.
fuzz-review target corpus artifacts seconds="300":
cargo +nightly fuzz run {{target}} {{corpus}} -- -max_total_time={{seconds}} -max_len=65536 -rss_limit_mb=2048 -artifact_prefix={{artifacts}}/
# Check checksum result lifetimes when a decoder is reused.
test-checksum-reuse:
cargo test --test checksum_reuse
# Build fuzz targets without running
fuzz-check:
cargo +nightly fuzz build
# Exact match-copy semantics across chunk boundaries and the full DEFLATE window.
test-match-copy:
cargo test --lib chunked_copy_matches_bytewise_back_references
# Documentation links must work with and without allocation support.
check-docs:
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --no-default-features
# Interpret the dynamic-header regression while retaining its Rust assertions
miri-header:
cargo +nightly miri test --features unchecked --lib dynamic_header_with_every_precode_symbol_decodes
# PNG ladder through whole-buffer, incremental, segmented and reuse checks.
test-conformance-png:
cargo test --release --test conformance png_levels