-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.am
More file actions
167 lines (150 loc) · 5.39 KB
/
Copy pathMakefile.am
File metadata and controls
167 lines (150 loc) · 5.39 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
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src
CARGO ?= cargo
DOCKER ?= docker
DOCKER_IMAGE ?= vmod-wasm-ci
WASMTIME_DIR ?= /opt/wasmtime
WASM_TARGET_DIR = $(abs_top_builddir)/examples-target
WASM_FIXTURE_DIR = $(abs_top_builddir)/tests/wasm
WASM_RELEASE_DIR = $(WASM_TARGET_DIR)/wasm32-unknown-unknown/release
EXTRA_DIST = \
.editorconfig \
.dockerignore \
.gitattributes \
.gitignore \
README.md \
LICENSE \
SECURITY.md \
CODE_OF_CONDUCT.md \
THIRD_PARTY_NOTICES.md \
CONTRIBUTING.md \
CHANGELOG.md \
Dockerfile \
autogen.sh \
scripts/perf-test.sh \
scripts/soak-test.sh \
.github/PULL_REQUEST_TEMPLATE.md \
.github/ISSUE_TEMPLATE/bug_report.md \
.github/ISSUE_TEMPLATE/config.yml \
.github/ISSUE_TEMPLATE/feature_request.md \
.github/workflows/ci.yml \
.github/workflows/release.yml \
docs/ARCHITECTURE.md \
docs/COMPATIBILITY.md \
docs/CONFIGURATION.md \
docs/DEVELOPMENT.md \
docs/PRODUCTION.md \
docs/README.md \
docs/SECURITY.md \
docs/assets/proxy-wasm-live-validation.mp4 \
docs/assets/proxy-wasm-live-validation.mp4.sha256 \
docs/assets/vmod-wasm-perf-demo.gif \
docs/assets/vmod-wasm-perf-demo.mp4 \
examples/Cargo.lock \
examples/Cargo.toml \
examples/README.md \
examples/rustfmt.toml \
examples/rust/Cargo.toml \
examples/rust/README.md \
examples/rust/src/lib.rs \
examples/proxy-wasm-filter/Cargo.toml \
examples/proxy-wasm-filter/README.md \
examples/proxy-wasm-filter/src/lib.rs \
examples/passthrough/Cargo.toml \
examples/passthrough/README.md \
examples/passthrough/src/lib.rs \
examples/transform/Cargo.toml \
examples/transform/README.md \
examples/transform/src/lib.rs \
examples/edge-security-filter/Cargo.toml \
examples/edge-security-filter/README.md \
examples/edge-security-filter/config.json \
examples/edge-security-filter/src/config.rs \
examples/edge-security-filter/src/lib.rs \
tests/allow_decision.vtc \
tests/basic_load.vtc \
tests/block_decision.vtc \
tests/error_handling.vtc \
tests/filter_chain.vtc \
tests/fuel_exhaustion.vtc \
tests/host_block_bot.vtc \
tests/host_header.vtc \
tests/host_url_method.vtc \
tests/memory_limit.vtc \
tests/pool_stats.vtc \
tests/proxy_wasm_block.vtc \
tests/proxy_wasm_edge_filter_basic.vtc \
tests/proxy_wasm_edge_filter_bot.vtc \
tests/proxy_wasm_edge_filter_callout.vtc \
tests/proxy_wasm_edge_filter_config.vtc \
tests/proxy_wasm_edge_filter_metrics.vtc \
tests/proxy_wasm_edge_filter_ratelimit.vtc \
tests/proxy_wasm_lifecycle.vtc \
tests/proxy_wasm_metrics.vtc \
tests/proxy_wasm_response.vtc \
tests/proxy_wasm_response_body.vtc \
tests/proxy_wasm_sdk.vtc \
tests/proxy_wasm_security.vtc \
tests/resource_config.vtc \
tests/vcl_reload_lifecycle.vtc \
tests/wasm/test_module.wasm
# Unit tests cannot link standalone against the VMOD because Varnish internal
# symbols (http_SetH, VRT_priv_task_get, etc.) are only available inside
# varnishd at runtime. Integration testing is done via VTC tests below.
.PHONY: build build-wasm-test-fixtures lint fmt audit test docker-test perf-test soak-test release-dry-run
build: all build-wasm-test-fixtures
build-wasm-test-fixtures:
@if ! command -v "$(CARGO)" >/dev/null 2>&1; then \
echo "ERROR: cargo not found; install Rust or use Docker"; \
exit 1; \
fi
@mkdir -p "$(WASM_FIXTURE_DIR)"
@cd "$(abs_top_srcdir)/examples" && \
CARGO_TARGET_DIR="$(WASM_TARGET_DIR)" \
"$(CARGO)" build --release --target wasm32-unknown-unknown
@cp "$(WASM_RELEASE_DIR)/test_module.wasm" "$(WASM_FIXTURE_DIR)/"
@cp "$(WASM_RELEASE_DIR)/proxy_wasm_filter.wasm" "$(WASM_FIXTURE_DIR)/"
@cp "$(WASM_RELEASE_DIR)/passthrough.wasm" "$(WASM_FIXTURE_DIR)/"
@cp "$(WASM_RELEASE_DIR)/transform.wasm" "$(WASM_FIXTURE_DIR)/"
@cp "$(WASM_RELEASE_DIR)/edge_security_filter.wasm" "$(WASM_FIXTURE_DIR)/"
lint:
cd "$(abs_top_srcdir)/examples" && "$(CARGO)" fmt --all --check
cd "$(abs_top_srcdir)/examples" && "$(CARGO)" clippy --target wasm32-unknown-unknown --all-targets -- -D warnings
fmt:
cd "$(abs_top_srcdir)/examples" && "$(CARGO)" fmt --all
audit:
@if ! "$(CARGO)" audit --version >/dev/null 2>&1; then \
"$(CARGO)" install cargo-audit --locked; \
fi
cd "$(abs_top_srcdir)/examples" && "$(CARGO)" audit
test: docker-test
docker-test:
$(DOCKER) build -t "$(DOCKER_IMAGE)" "$(abs_top_srcdir)"
$(DOCKER) run --rm "$(DOCKER_IMAGE)" make check
perf-test:
"$(abs_top_srcdir)/scripts/perf-test.sh" --image "$(DOCKER_IMAGE)"
soak-test:
"$(abs_top_srcdir)/scripts/soak-test.sh" --image "$(DOCKER_IMAGE)"
release-dry-run:
$(DOCKER) build -t "$(DOCKER_IMAGE)" "$(abs_top_srcdir)"
$(DOCKER) run --rm "$(DOCKER_IMAGE)" make check
$(DOCKER) run --rm "$(DOCKER_IMAGE)" make distcheck DISTCHECK_CONFIGURE_FLAGS="--with-wasmtime=$(WASMTIME_DIR)"
# Run VTC tests (integration tests inside varnishd)
check-local: build-wasm-test-fixtures
@if test -n "$(VARNISHTEST)"; then \
for t in $(abs_top_srcdir)/tests/*.vtc; do \
echo "Running $$t..."; \
$(VARNISHTEST) -t 120 \
-Dvmod_wasm="$(abs_top_builddir)/src/.libs/libvmod_wasm.so" \
-Dwasm_module="$(WASM_FIXTURE_DIR)/test_module.wasm" \
-Dwasm_passthrough="$(WASM_FIXTURE_DIR)/passthrough.wasm" \
-Dwasm_transform="$(WASM_FIXTURE_DIR)/transform.wasm" \
-Dsdk_module="$(WASM_FIXTURE_DIR)/proxy_wasm_filter.wasm" \
-Dedge_filter="$(WASM_FIXTURE_DIR)/edge_security_filter.wasm" \
$$t || exit 1; \
done; \
else \
echo "WARNING: varnishtest not found, skipping VTC tests"; \
fi
clean-local:
rm -rf "$(WASM_TARGET_DIR)" "$(WASM_FIXTURE_DIR)"