Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
220 lines (192 loc) · 10.1 KB
/
Copy pathMakefile
File metadata and controls
220 lines (192 loc) · 10.1 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# Test Infrastructure for Eggsec
# ================================
.PHONY: test test-fast test-slow test-unit test-integration test-nse test-coverage test-ci test-feature-matrix test-architecture-guards test-tui-pty check-no-default check check-deps check-python check-full check-feature-profiles check-features-individual clippy clippy-domain release-check fmt build clean help
# Default: run unit tests only (fast feedback loop)
test: test-unit
# Compatibility alias for the default fast unit-test loop
test-fast: test-unit
# Run only unit tests (lib tests, no network, no wiremock)
test-unit:
cargo test --lib -p eggsec
# Run the eggsec package test suite without Cargo fail-fast
# Phase E WS2: engine default is empty, so integration suites that exercise
# CLI types/dispatch (via default in earlier phases) request `cli` explicitly.
test-ci:
cargo test -p eggsec --features rest-api,cli --tests --no-fail-fast
# Run integration tests (alias for test-ci; uses wiremock, may need network)
test-integration: test-ci
# Run NSE tests (requires nse feature)
test-nse:
cargo test -p eggsec --features nse,cli --test nse_tests --test nse_integration_tests
# Run slow/explicitly-ignored tests
test-slow:
cargo test -p eggsec --features rest-api,cli --tests -- --ignored
# Run clippy (routine: engine + dependency-light leaf crates)
# Phase E WS2: engine default is empty; lint both the empty library default
# and the `cli` process-host surface (used by eggsec-cli/eggsec-tui).
#
# eggsec-tui / eggsec-cli (the process hosts) and the knowledge-corpus leaves
# are listed explicitly: they had no clippy coverage at all, so `-D warnings`
# had never gated them — including the crate with the most guard rules. Keep
# this list in sync with the workspace members `make check` builds.
clippy:
cargo clippy --lib -p eggsec -- -D warnings
cargo clippy --lib -p eggsec --features cli -- -D warnings
cargo clippy -p eggsec-core -p eggsec-tool-core -p eggsec-report-model -p eggsec-output -p eggsec-runtime -p eggsec-ui-model -p eggsec-agent -p eggsec-transport -p eggsec-transport-eggfetch -p eggsec-policy -- -D warnings
cargo clippy -p eggsec-tui -p eggsec-cli -- -D warnings
cargo clippy -p eggsec-secrets -p eggsec-payloads -p eggsec-service-db -p eggsec-udp-scan -- -D warnings
# Lint domain/platform crates with their relevant features (deep checks only:
# heavier closures, may need system prerequisites like libssl-dev).
# The standalone NSE runtime owns its own lint gate in eggstack/eggsec-nse CI.
clippy-domain:
cargo clippy -p eggsec-db-lab --features db-drivers -- -D warnings
cargo clippy -p eggsec-web-proxy --features web-proxy -- -D warnings
cargo clippy -p eggsec-mobile-lab -- -D warnings
cargo clippy -p eggsec-daemon -- -D warnings
# Run format check
fmt:
cargo fmt --all -- --check
# Run code coverage
test-coverage:
cargo llvm-cov -p eggsec --features rest-api,nse --lcov --output-dir coverage
# Build release
build:
cargo build --release -p eggsec-cli
# Feature matrix and metadata validation
test-feature-matrix:
cargo test -p eggsec --test feature_matrix
cargo test -p eggsec --test metadata_consistency
# Architecture drift guards (static grep checks)
test-architecture-guards:
bash scripts/check-architecture-guards.sh
# TUI PTY regression smoke (Phase B WS6, specialist/deep-checks only).
# Runs the real eggsec binary in a pseudo-terminal (stdlib pty, no Rust
# runtime deps) and proves a representative tracing warning no longer leaks
# outside the frame plus terminal restoration on the daemon-attach path.
# Unix/Linux only; the script reports SKIP on Windows. Never part of the
# normal unit-test loop (depends on terminal timing).
test-tui-pty:
cargo build -p eggsec-cli
python3 scripts/tui_pty_smoke.py --binary ./target/debug/eggsec
# Validate no-default-features build
check-no-default:
cargo check --workspace --no-default-features
# Validate MSRV (requires `rustup toolchain install 1.89`)
check-msrv:
cargo +1.89 check --workspace --no-default-features
cargo +1.89 check -p eggsec-cli --no-default-features
cargo +1.89 check -p eggsec-transport
cargo +1.89 check -p eggsec-transport-eggfetch
cargo +1.89 check -p eggsec --no-default-features
# Dependency advisory/license/source policy (Phase F supply-chain hardening).
# Canonical gate: `deny.toml` via cargo-deny over the full workspace closure
# (`--workspace --all-features`; deny.toml also sets [graph] all-features).
# Fails closed when cargo-deny is absent — install with
# `cargo install cargo-deny` (CI installs a SHA-pinned version). Never silently
# skip: a missing tool is a failed check, not a pass.
check-deps:
@command -v cargo-deny >/dev/null 2>&1 || (echo "FAIL: cargo-deny not found. Install with 'cargo install cargo-deny' (CI uses a SHA-pinned install-action)." >&2; exit 1)
cargo deny --workspace --all-features check
cargo deny --workspace --all-features check advisories
cargo deny --workspace --all-features check bans
cargo deny --workspace --all-features check licenses
cargo deny --workspace --all-features check sources
# Full mandatory Rust CI contract (no cargo-nextest required)
check:
cargo fmt --all --check
cargo check --workspace --no-default-features
# Build the *test* targets for the no-default-features profile too:
# `cargo check --workspace` only compiles library/binary targets, so a
# feature-gated `use eggsec::commands` in tests/ can break unnoticed.
cargo check -p eggsec --all-targets --no-default-features
cargo check -p eggsec
cargo check -p eggsec-cli
cargo check -p eggsec-cli --no-default-features
$(MAKE) check-deps
$(MAKE) clippy
cargo test -p eggsec --doc
cargo test -p eggsec --no-default-features --test tool_registration --test loadtest_tests --no-fail-fast
cargo test -p eggsec --features rest-api,cli --tests --no-fail-fast
cargo test -p eggsec-output --tests
cargo test -p eggsec-report-model --tests
cargo test -p eggsec-policy --tests
cargo test -p eggsec-service-db --tests
cargo test -p eggsec-secrets --tests
cargo test -p eggsec-payloads --tests
cargo test -p eggsec-udp-scan --tests
cargo test -p eggsec-transport-eggfetch --tests --no-fail-fast
cargo test -p eggsec-tui --lib --no-fail-fast
bash scripts/check-architecture-guards.sh
# Optional broad validation (pre-release, not required for merge)
# Note: dependency policy (`check-deps`) already runs inside `check`; this
# target adds domain lint and representative feature profiles only.
check-full: check
$(MAKE) clippy-domain
$(MAKE) check-feature-profiles
$(MAKE) test-tui-pty
# Exhaustive per-feature compilation sweep (weekly/manual, not per-PR).
# `full` is a curated aggregate, so this sweep is the completeness oracle.
check-features-individual:
bash scripts/check-features-individual.sh
# Representative feature profile checks (representative, not exhaustive)
check-feature-profiles:
cargo check -p eggsec --features tool-api,rest-api
cargo check -p eggsec --features grpc-api
cargo check -p eggsec --features db-pentest
cargo check -p eggsec --features db-pentest-mcp,tool-api,rest-api
cargo check -p eggsec --features mobile
cargo check -p eggsec --features mobile-dynamic
cargo check -p eggsec --features web-proxy
cargo check -p eggsec --features web-proxy-mcp,tool-api,rest-api
cargo check -p eggsec --features c2-mcp,tool-api,rest-api
# Marker-feature profiles that previously regressed silently (stale
# TaskResult match arms); keep these compiling.
cargo check -p eggsec --features compliance
cargo check -p eggsec --features finding-workflow
cargo check -p eggsec --features vuln-management
# Broad TUI profile (dependency-light, deterministic): exercises the
# feature-gated runtime request builders (db-pentest, intercept,
# C2) plus adjacent tabs for cross-feature compile drift. Fast
# detection between weekly deep sweeps; NOT a substitute for the
# eggsec-tui/full aggregate in Deep Checks.
cargo check -p eggsec-tui --features db-pentest,web-proxy,c2
cargo test -p eggsec-tui --features db-pentest,web-proxy,c2 --lib --no-fail-fast
# Release validation (local only, no publication)
release-check:
bash scripts/release-check.sh
# Clean build artifacts
clean:
cargo clean
# ── Python checks ─────────────────────────────────────────────────────────
# Unified Python CI check (one venv, one maturin develop, all retained checks)
check-python:
bash scripts/check-python.sh
# Help
help:
@echo "Primary (run these):"
@echo " make check - Full mandatory Rust CI contract (format, lint, test, guards, deps)"
@echo " make check-deps - Dependency advisory/license/source policy (cargo deny)"
@echo " make check-python - Python CI check (one build, all checks)"
@echo " make test - Unit tests only (default)"
@echo " make check-full - Optional broad validation (pre-release)"
@echo " make release-check - Release validation (no publication)"
@echo " make clean - Clean artifacts"
@echo ""
@echo "Specialist diagnostics (as needed):"
@echo " make clippy - Lint (engine + leaf crates)"
@echo " make clippy-domain - Lint domain/platform crates (deep checks)"
@echo " make check-features-individual - Per-feature compile sweep (deep checks)"
@echo " make fmt - Format check"
@echo " make build - Release build"
@echo " make test-ci - Full package tests with rest-api"
@echo " make test-fast - Fast unit-test alias"
@echo " make test-integration - Integration tests (alias for test-ci)"
@echo " make test-nse - NSE tests (requires nse feature)"
@echo " make test-slow - Run ignored tests"
@echo " make test-coverage - Code coverage"
@echo " make test-feature-matrix - Feature metadata validation tests"
@echo " make test-tui-pty - TUI PTY regression smoke (specialist/deep-checks)"
@echo " make test-architecture-guards - Static grep checks for invariant regressions"
@echo " make check-no-default - Validate no-default-features build"
@echo " make check-msrv - Validate MSRV (requires rustup toolchain install 1.89)"
@echo " make check-feature-profiles - Representative feature profile checks"