Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
329 lines (285 loc) · 13.2 KB
/
Copy pathMakefile
File metadata and controls
329 lines (285 loc) · 13.2 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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# Makefile for MoQT interop testing
#
# This is the moq-interop-runner - an implementation-neutral framework for
# testing interoperability between MoQT implementations.
#
# Usage:
# make interop-list # List registered implementations
# make interop-remote # Test all public relay endpoints
# make interop-all # Run full test matrix
# make test RELAY_URL=... # Test specific endpoint
#
# For local Docker-based testing, you need to provide images.
# See IMPLEMENTATIONS.md for how to register your implementation.
SHELL := /bin/bash
.PHONY: test test-verbose test-single test-external clean mlog-clean certs \
interop-all interop-docker interop-remote interop-relay interop-client interop-list \
relay-start relay-stop logs logs-relay logs-client \
build-adapters build-moxygen-adapter build-impl build-moq-rs build-moq-go report help _ensure-certs \
xquic-client-build xquic-client-test-draft18 xquic-relay-build
#############################################################################
# Image Configuration
#
# These can be overridden to test different implementations:
# make test RELAY_IMAGE=ghcr.io/facebookexperimental/moqrelay:latest
# make test CLIENT_IMAGE=my-test-client:dev
#############################################################################
# Default images - override these or provide your own
RELAY_IMAGE ?= moq-relay-ietf:latest
CLIENT_IMAGE ?= moq-test-client:latest
# For test-external (direct URL, not docker-compose)
RELAY_URL ?= https://relay:4443
TLS_DISABLE_VERIFY ?= false
# Optional extra args for `docker run` in test-external.
# Example: EXTRA_DOCKER_RUN_ARGS="--add-host local.nokiaresearch.com:host-gateway"
EXTRA_DOCKER_RUN_ARGS ?=
# Track whether RELAY_URL was set by user (command line or environment)
RELAY_URL_ORIGIN := $(origin RELAY_URL)
# Resolve relay URL for docker-compose tests.
# Priority:
# 1) Explicit RELAY_URL from CLI/environment
# 2) Matched implementations.json roles.relay.docker.url for RELAY_IMAGE
# 3) RELAY_URL default value from this Makefile
define RESOLVE_RELAY_URL
resolved_relay_url="$(RELAY_URL)"; \
if [ "$(RELAY_URL_ORIGIN)" = "file" ] || [ "$(RELAY_URL_ORIGIN)" = "default" ] || [ "$(RELAY_URL_ORIGIN)" = "undefined" ]; then \
if command -v jq >/dev/null 2>&1; then \
config_relay_url=$$(jq -r --arg image "$(RELAY_IMAGE)" '.implementations | to_entries[] | select(.value.roles.relay?.docker?.image? == $$image) | .value.roles.relay.docker.url // empty' implementations.json | head -n1); \
if [ -n "$$config_relay_url" ]; then \
resolved_relay_url="$$config_relay_url"; \
fi; \
fi; \
fi
endef
#############################################################################
# Certificate Generation (following QUIC interop runner conventions)
#############################################################################
# Generate TLS certificates for testing
certs:
@echo "Generating TLS certificates..."
@chmod +x generate-certs.sh
./generate-certs.sh ./certs
# Check if certs exist, generate if not
_ensure-certs:
@if [ ! -f certs/cert.pem ] || [ ! -f certs/priv.key ]; then \
echo "Generating TLS certificates..."; \
chmod +x generate-certs.sh; \
./generate-certs.sh ./certs; \
fi
#############################################################################
# Test Targets
#############################################################################
# Run tests with configured images (requires Docker images to exist)
test: _ensure-certs mlog-clean
@$(RESOLVE_RELAY_URL); \
echo "Running interop tests..."; \
echo " Relay: $(RELAY_IMAGE)"; \
echo " Client: $(CLIENT_IMAGE)"; \
echo " URL: $$resolved_relay_url"; \
RELAY_URL="$$resolved_relay_url" RELAY_IMAGE=$(RELAY_IMAGE) CLIENT_IMAGE=$(CLIENT_IMAGE) \
docker compose -f docker-compose.test.yml up --abort-on-container-exit
@echo ""
@echo "Test results in mlog/"
test-verbose: _ensure-certs mlog-clean
@$(RESOLVE_RELAY_URL); \
echo "Running interop tests (verbose)..."; \
echo " Relay: $(RELAY_IMAGE)"; \
echo " Client: $(CLIENT_IMAGE)"; \
echo " URL: $$resolved_relay_url"; \
RELAY_URL="$$resolved_relay_url" RELAY_IMAGE=$(RELAY_IMAGE) CLIENT_IMAGE=$(CLIENT_IMAGE) VERBOSE=1 \
docker compose -f docker-compose.test.yml up --abort-on-container-exit
# Run a specific test
test-single:
@$(RESOLVE_RELAY_URL); \
echo "Running test: $(TESTCASE)"; \
echo " Relay: $(RELAY_IMAGE)"; \
echo " Client: $(CLIENT_IMAGE)"; \
echo " URL: $$resolved_relay_url"; \
RELAY_URL="$$resolved_relay_url" RELAY_IMAGE=$(RELAY_IMAGE) CLIENT_IMAGE=$(CLIENT_IMAGE) \
docker compose -f docker-compose.test.yml run --rm \
-e TESTCASE=$(TESTCASE) \
test-client
# Run against external relay URL (not using compose)
test-external:
@echo "Running tests against $(RELAY_URL)..."
@echo " Client: $(CLIENT_IMAGE)"
@if [ -n "$(EXTRA_DOCKER_RUN_ARGS)" ]; then echo " Extra docker args: $(EXTRA_DOCKER_RUN_ARGS)"; fi
docker run --rm --init \
$(EXTRA_DOCKER_RUN_ARGS) \
--network host \
-e RELAY_URL=$(RELAY_URL) \
$(if $(TESTCASE),-e TESTCASE=$(TESTCASE)) \
$(if $(MOQ_CLIENT_VERSION),-e MOQ_CLIENT_VERSION=$(MOQ_CLIENT_VERSION)) \
-e TLS_DISABLE_VERIFY=$(TLS_DISABLE_VERIFY) \
$(CLIENT_IMAGE)
# Start relay only (for manual testing)
relay-start: _ensure-certs
RELAY_IMAGE=$(RELAY_IMAGE) docker compose -f docker-compose.test.yml up -d relay
@echo "Relay started on port 4443"
relay-stop:
docker compose -f docker-compose.test.yml stop relay
# Clean up
clean:
docker compose -f docker-compose.test.yml down -v --rmi local 2>/dev/null || true
rm -rf mlog/ certs/ results/
mlog-clean:
rm -rf mlog/
mkdir -p mlog/relay mlog/client
# Show logs
logs:
docker compose -f docker-compose.test.yml logs
logs-relay:
docker compose -f docker-compose.test.yml logs relay
logs-client:
docker compose -f docker-compose.test.yml logs test-client
#############################################################################
# Config-Driven Test Runner (reads from implementations.json)
#############################################################################
# Run all tests (Docker + remote) from implementations.json
interop-all: _ensure-certs
@test -x ./run-interop-tests.sh || (echo "ERROR: run-interop-tests.sh not found or not executable" && exit 1)
@./run-interop-tests.sh
# Run only Docker-based tests
interop-docker: _ensure-certs
@./run-interop-tests.sh --docker-only
# Run only remote endpoint tests (optionally filter by relay: make interop-remote RELAY=moxygen)
interop-remote:
@./run-interop-tests.sh --remote-only $(if $(RELAY),--relay $(RELAY))
# Run tests for specific relay implementation
interop-relay:
@./run-interop-tests.sh --relay $(RELAY)
# Run tests for specific client implementation
interop-client:
@./run-interop-tests.sh --client $(CLIENT)
# List available implementations
interop-list:
@./run-interop-tests.sh --list
#############################################################################
# Adapter Builds
#
# These build adapter images that wrap upstream implementation images
# to conform to the interop testing conventions (e.g., /certs mount point).
#############################################################################
# Build all adapter images (reads build info from implementations.json)
build-adapters:
@set -o pipefail; jq -r '.implementations | to_entries[] | .value.roles | to_entries[]? | select(.value.docker.build.dockerfile != null) | select(.value.docker.build.dockerfile | startswith("adapters/")) | "\(.value.docker.image)|\(.value.docker.build.dockerfile)|\(.value.docker.build.context)"' implementations.json | while IFS='|' read -r image dockerfile context; do \
echo "Building adapter: $$image"; \
docker build -t "$$image" -f "$$dockerfile" "$$context"; \
done
# Build individual adapter (kept for convenience / backward compatibility)
build-moxygen-adapter:
@echo "Building moxygen adapter image..."
docker build -t moxygen-interop:latest -f adapters/moxygen/Dockerfile.relay adapters/moxygen/
#############################################################################
# Source Builds
#
# Build Docker images from source code. These are NEVER run automatically
# by test targets - users must explicitly opt-in.
#
# See builds/README.md for documentation.
#############################################################################
# Generic build target - requires IMPL parameter
build-impl:
@if [ -z "$(IMPL)" ]; then \
echo "Usage: make build-impl IMPL=<implementation>"; \
echo "Available implementations:"; \
ls -1 builds/ 2>/dev/null | grep -v README.md || echo " (none)"; \
exit 1; \
fi
@if [ ! -f "builds/$(IMPL)/build.sh" ]; then \
echo "ERROR: No build definition for '$(IMPL)'"; \
echo "Expected: builds/$(IMPL)/build.sh"; \
exit 1; \
fi
@./builds/$(IMPL)/build.sh $(BUILD_ARGS)
# Convenience target for moq-rs
build-moq-rs:
@./builds/moq-rs/build.sh $(BUILD_ARGS)
# Convenience target for moq-go
build-moq-go:
@./builds/moq-go/build.sh $(BUILD_ARGS)
#############################################################################
# xquic draft-18 client development loop
#############################################################################
xquic-client-build:
@if [ -z "$(XQUIC_SOURCE)" ]; then \
echo "Usage: make xquic-client-build XQUIC_SOURCE=/absolute/path/to/xquic"; \
exit 1; \
fi
@./builds/xquic/build.sh --local "$(XQUIC_SOURCE)" --target client-draft-18
xquic-client-test-draft18:
@XQUIC_SOURCE="$(XQUIC_SOURCE)" ./scripts/test-xquic-draft18.sh $(XQUIC_TEST_ARGS)
xquic-relay-build:
@if [ -z "$(XQUIC_SOURCE)" ]; then \
echo "Usage: make xquic-relay-build XQUIC_SOURCE=/absolute/path/to/xquic"; \
exit 1; \
fi
@./builds/xquic/build.sh --local "$(XQUIC_SOURCE)" --target relay-draft-18
#############################################################################
# Report Generation
#############################################################################
report:
@./generate-report.sh
#############################################################################
# Help
#############################################################################
help:
@echo "MoQT Interop Runner"
@echo ""
@echo "This is an implementation-neutral framework for testing interoperability"
@echo "between MoQT (Media over QUIC Transport) implementations."
@echo ""
@echo "Quick Start:"
@echo " make interop-list List registered implementations"
@echo " make interop-remote Test all public relay endpoints"
@echo ""
@echo "Interop Tests (config-driven from implementations.json):"
@echo " interop-all Run all tests (Docker + remote endpoints)"
@echo " interop-docker Run only Docker-based tests"
@echo " interop-remote Run only remote endpoint tests (RELAY=x to filter)"
@echo " interop-relay Test specific relay: make interop-relay RELAY=moxygen"
@echo " interop-client Test specific client: make interop-client CLIENT=moq-rs"
@echo " interop-list List available implementations"
@echo ""
@echo "Single Tests (requires Docker images):"
@echo " test Run tests with configured images"
@echo " test-verbose Run tests with verbose output"
@echo " test-single Run single test: make test-single TESTCASE=setup-only"
@echo " test-external Test external relay: make test-external RELAY_URL=https://..."
@echo ""
@echo "Building Images:"
@echo " build-adapters Build all adapter images"
@echo " build-impl Build from source: make build-impl IMPL=moq-rs"
@echo " build-moq-rs Convenience target for moq-rs"
@echo " build-moq-go Convenience target for moq-go"
@echo ""
@echo "xquic draft-18 development:"
@echo " xquic-client-build Build from XQUIC_SOURCE=/absolute/path/to/xquic"
@echo " xquic-client-test-draft18 Run all supported tests against draft-18 raw-QUIC relays"
@echo " xquic-relay-build Build draft-18 relay from XQUIC_SOURCE=/absolute/path/to/xquic"
@echo ""
@echo " BUILD_ARGS examples:"
@echo " --local ~/git/moq-rs Use local checkout"
@echo " --ref feature-branch Build specific ref"
@echo " --target relay Build only relay image"
@echo ""
@echo "Other:"
@echo " certs Generate TLS certificates"
@echo " relay-start Start relay container (for manual testing)"
@echo " relay-stop Stop relay container"
@echo " clean Remove containers, mlog, and certs"
@echo " report Generate HTML report from results"
@echo ""
@echo "Image Configuration:"
@echo " RELAY_IMAGE Relay Docker image (default: moq-relay-ietf:latest)"
@echo " CLIENT_IMAGE Test client Docker image (default: moq-test-client:latest)"
@echo ""
@echo "Examples:"
@echo " make interop-remote # Test all public relays"
@echo " make interop-relay RELAY=moxygen # Test moxygen only"
@echo " make interop-client CLIENT=moq-rs # Test moq-rs client only"
@echo " make test RELAY_IMAGE=moxygen-interop:latest # Test with moxygen Docker"
@echo " make test-external RELAY_URL=https://example.com # Test specific URL"
@echo " make build-moq-rs BUILD_ARGS=\"--local ~/git/moq-rs\" # Build from local"
@echo ""
@echo "See IMPLEMENTATIONS.md for how to add your implementation."