41 lines
1.5 KiB
Makefile
41 lines
1.5 KiB
Makefile
# XCE project — test targets
|
|
# Usage:
|
|
# make test # unit tests only (no server needed, CGO_ENABLED=0)
|
|
# make test-backend # backend CGO conversion tests (requires nix dev shell + build dir)
|
|
# make test-integration # regression suite against live server
|
|
# make test-all # unit + integration tests
|
|
|
|
XCE_BIN ?= /tmp/xce_static
|
|
SRV_URL ?= http://localhost:8080
|
|
GOFLAGS := CGO_ENABLED=0
|
|
|
|
.PHONY: build-cli build-server test test-backend test-integration test-all
|
|
|
|
build-cli:
|
|
cd xcecli && $(GOFLAGS) go build -o $(XCE_BIN) ./cmd/main.go
|
|
|
|
build-server:
|
|
cd apiserver && go build -o /tmp/apiserver ./cmd/main.go
|
|
|
|
## Run all Go unit tests that do not require CGO or a live server.
|
|
test:
|
|
@echo "=== Unit tests: apiserver ==="
|
|
cd apiserver && $(GOFLAGS) go test ./store/... ./utils/... ./controllers/... ./backend/... -count=1
|
|
@echo ""
|
|
@echo "=== Unit tests: xcecli ==="
|
|
cd xcecli && $(GOFLAGS) go test ./... -count=1
|
|
|
|
## Run backend CGO conversion tests.
|
|
## Requires CGO_ENABLED=1 and CGO_CFLAGS/CGO_LDFLAGS pointing at the build tree.
|
|
## Run from within the nix develop shell after a full meson build.
|
|
test-backend:
|
|
@echo "=== Backend CGO tests: apiserver/backend ==="
|
|
cd apiserver && CGO_ENABLED=1 go test ./backend/... -count=1
|
|
|
|
## Run regression suite against a live server (requires XCE_BIN and SRV_URL)
|
|
test-integration: build-cli
|
|
@echo "=== Integration regression: $(SRV_URL) ==="
|
|
XCE=$(XCE_BIN) URL=$(SRV_URL) bash tests/regression/run.sh
|
|
|
|
## Run everything
|
|
test-all: test test-integration
|